Skip to content

Instantly share code, notes, and snippets.

@aod
aod / backoff.ts
Last active July 9, 2025 00:20
Simple KV backoff with Deno
// const voidFn = (...args: unknown[]) => void args
const log = console.log /* voidFn */;
export async function expensive() {
const kv = await Deno.openKv();
const now = `[${performance.now()}]`;
const key = ["namespace", "expensive"];
const cache = await kv.get(key);
log(`${now} kv.get(${key}) = ${cache.value}`);
if (cache.value) {
@aod
aod /
Last active February 15, 2022 23:32
We couldn’t find that file to show.
@aod
aod / resources.txt
Created October 24, 2021 12:20
compiler/interpreter resources
Crafting Interpreters
https://craftinginterpreters.com
978-0990582939
Writing An Interpreter In Go
https://interpreterbook.com
978-3982016115
Engineering: A Compiler (2nd Edition)
978-0120884780
@aod
aod / beginland.css
Created July 13, 2020 15:27
dont look
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
/* Document
========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in iOS.
*/
@aod
aod / JSON.pegjs
Created November 5, 2019 00:36
JSON parser example - PEG.js
JSON
= _ v:Value _ { return v }
Value
= Object
/ Number
/ StringLiteral
/ Array
/ Boolean
/ Null