Skip to content

Instantly share code, notes, and snippets.

@FND
FND / README.md
Last active April 7, 2024 17:03
gabbi in the browser

gabbi in the browser

  1. start a CORS-enabled HTTP server at http://localhost:8000 (see below)
  2. visit Pyodide REPL
  3. paste setup.py contents into the REPL
  4. paste test_case.py contents into the REPL

HTTP Server

@FND
FND / .editorconfig
Last active March 17, 2024 18:39
Enhance SSR with Python (WSGI)
# http://editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 80
@FND
FND / .gitignore
Last active November 24, 2023 06:10
sharing code between bundles, explicitly
/node_modules
/package-lock.json
/dist
@FND
FND / index.mjs
Created July 17, 2023 07:36
AsyncLocalStorage MTC
import { withCounter, withContext, log } from "./util.mjs";
let delay = 200;
log("TOKEN");
withContext("abc123", () => {
log("🅰️");
setTimeout(() => {
log("🅱️");
}, delay * 2);
@FND
FND / .editorconfig
Last active May 21, 2023 16:33
Preact Signals
# http://editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 80
@FND
FND / index.html
Last active March 31, 2023 17:14
SSE client & server
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>exploring browsers' limits WRT event frequency</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
*,
*::before,
@FND
FND / app.js
Last active July 25, 2022 15:49
simplistic router with web standards
import { Router } from "./router.js";
let router = new Router([
["/blog/:article", makeHandler("BLOG")],
["/blog/:article/:comment", makeHandler("COMMENT")],
["/api/*", makeHandler("API")]
]);
let uris = [
"/foo",
@FND
FND / index.html
Last active December 20, 2021 13:17
encryption/decryption
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Encryption/Decryption</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
*,
*::before,
@FND
FND / .gitignore
Last active November 9, 2020 10:43
stateful HTTP client (Node)
/node_modules
@FND
FND / webdav
Last active January 23, 2021 09:23
minimal WebDAV implementation for TiddlyWiki
#!/usr/bin/env python3
import os
from hashlib import md5
ROOT_DIR = os.path.dirname(__file__)
STATUSES = {
200: "OK",