This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export ASDF_VERSION=0.18.0 | |
| export NODE_VERSION=25.2.1 | |
| # make sure we're up to date | |
| sudo apt update --yes | |
| # add dependencies for asdf and nodejs | |
| sudo apt install --yes git bash rsync libatomic1 | |
| # add asdf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- | |
| Usage: | |
| <Debug bind:this={debug} {world} width=800 height=600 scale=10 /> | |
| Then during game loop call: | |
| debug.render() | |
| --> | |
| <script lang="ts"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function add(a: number, b: number) { | |
| return a + b | |
| } | |
| function multiply(a: number, b: number) { | |
| return a * b | |
| } | |
| function doubler<T extends Function>(fn: T): T { | |
| return new Proxy(fn, { | |
| apply(target, self, args) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function perf<T extends object>(target: T, methods: string[]): T { | |
| return new Proxy(target, { | |
| get(target, key) { | |
| const item = Reflect.get(target, key) | |
| if (!methods.includes(key.toString())) { | |
| return item | |
| } | |
| return (...args: any[]) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function logger<T extends object>(target: T, methods: string[]): T { | |
| return new Proxy(target, { | |
| get(target, key) { | |
| const item = Reflect.get(target, key) | |
| if (!methods.includes(key.toString())) { | |
| return item | |
| } | |
| return (...args: any[]) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- insert a default snippet when file is first opened | |
| local luasnip = require('luasnip') | |
| local collection = require('luasnip.session.snippet_collection') | |
| local util = require('luasnip.util.util') | |
| local default_snippets = { | |
| { pattern = "/[+]page.svelte$", snippet = "page" }, | |
| { pattern = "/[+]page.js$", snippet = "page" }, | |
| { pattern = "/[+]page.ts$", snippet = "page" }, | |
| { pattern = "/[+]page.server.js$", snippet = "page.server" }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- neovim snippets from scratch | |
| local api = vim.api | |
| local Snippets = { | |
| list = { | |
| lua = { | |
| ["if"] = "if $ then\nend", | |
| p = "print($)", | |
| func = "function $()\nend" | |
| }, | |
| javascript = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * usage: | |
| * | |
| * // parse markdown | |
| * const file = await parseMarkdown('posts/foo.md') | |
| * | |
| * // extract front matter | |
| * const { title, summary, date, author, tags } = file.data.matter | |
| * | |
| * // access html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <body> | |
| <h1></h1> | |
| <button onclick="decrement()">-</button> | |
| <button onclick="increment()">+</button> | |
| <script> | |
| function signal(initial, callback = null) { | |
| let value = initial |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from time import sleep_ms | |
| from machine import SPI, Pin | |
| from framebuf import FrameBuffer, MONO_HLSB | |
| ''' | |
| Driver for Waveshare e-Paper 1.54in V2 | |
| Note: This is for V2, check for V2 sticker on back of module. | |
| Datasheet: https://files.waveshare.com/upload/e/e5/1.54inch_e-paper_V2_Datasheet.pdf |
NewerOlder