View local-storage-example.cjs
This file contains 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
// node [--trace-gc] local-storage-exmaple.cjs | |
// creates a server | |
// will drop /favicon.ico connections poorly without properly closing them | |
// `cleanupContext` AsyncLocalStorage + `cleanup` FinalizationRegistry will clean up | |
// will track the http request URL for errors in httpContext | |
// will show up in error generated for bad permissions | |
// will grant permissions in permissionsContext based upon query params / search params | |
// need ?fs=true to make / respond with a 200 | |
// | |
// goto /?fs=true in browser to see it work |
View local-storage-example.cjs
This file contains 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
// node [--trace-gc] local-storage-exmaple.cjs | |
// creates a server | |
// will drop /favicon.ico connections poorly without properly closing them | |
// `cleanupContext` AsyncLocalStorage + `cleanup` FinalizationRegistry will clean up | |
// will track the http request URL for errors in httpContext | |
// will show up in error generated for bad permissions | |
// will grant permissions in permissionsContext based upon query params / search params | |
// need ?fs=true to make / respond with a 200 | |
// | |
// goto /?fs=true in browser to see it work |
View dangling_promise.mjs
This file contains 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
import util from 'util'; | |
const promiseDebugging = util.debuglog('promises').enabled; | |
const danglingPromise = new FinalizationRegistry((stack) => { | |
danglingStacks.delete(stack); | |
console.log(stack); | |
}); | |
const danglingStacks = new Set(); | |
const stackCache = new WeakMap(); | |
/** | |
* @template T |
View wip.mjs
This file contains 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
import * as ns from './index.js'; | |
import {promisify} from 'util'; | |
import {createReadStream, createWriteStream} from 'fs'; | |
import {Session} from 'inspector'; | |
import {PassThrough} from 'stream'; | |
import {createHash} from 'crypto'; | |
const session = new Session(); | |
const stream = new PassThrough(); |
View gc.js
This file contains 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
#!/usr/bin/env node | |
// call using --inspect brk, GC using memory tab of devtools | |
// call globalThis.tick() to move the code along and see when things reap from | |
// manually calling GC | |
{ | |
const registry = new FinalizationRegistry((_) => console.log(_, 'reaped')); | |
let EASY_TO_FIND = class EASY_TO_FIND2 { | |
big = new Uint8Array(1024 * 1024 * 10); | |
constructor(_) { | |
registry.register(this, _); |
View harness.js
This file contains 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 foo(x, y) { | |
return Object; | |
} | |
const { stop } = trace(); | |
new foo([1], new Date()); | |
stop(); | |
// boilerplate after this |
View lone surrogates - split codepoint problem.sh
This file contains 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
# see the replacement character ( Buffer.from(new TextEncoder().encode('\u{fffd}')) ) instead | |
# https://en.wikipedia.org/wiki/Specials_(Unicode_block)#Replacement_character | |
node -e 'process.stdout.write("👌"[0]);setTimeout(() => {process.stdout.end("👌"[1]); process.exit()},3e3)' | | |
node -e '(async (s = "") => {for await (const a of process.stdin) {console.log(a); s+= a}; console.log(s)})()' |
View node-policies.json
This file contains 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
{ | |
"type": "object", | |
"title": "Node.js Policy Manifest", | |
"description": "https://nodejs.org/api/policy.html", | |
"definitions": { | |
"cascade": { | |
"defaultSnippets": [ | |
{ | |
"label": "Allow scope fall through.", | |
"body": true |
View total-pages.txt
This file has been truncated, but you can view the full file.
This file contains 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
http://0-chromosome.hatenablog.jp/ | |
http://0.lifecell.com.ua/ | |
http://002tousan.seesaa.net/ | |
http://00monochrome.blog32.fc2.com/ | |
http://00room.blog.fc2.com/ | |
http://0301244.hatenablog.com/ | |
http://0316shank.hatenablog.com/ | |
http://03310711.blog59.fc2.com/ | |
http://04-09.gaidline.media/ |
View transactional-proxy.mjs
This file contains 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
'use strict'; | |
const readOnlyViews = new WeakMap(); | |
function ReadOnlyProxy(target) { | |
if (!canBeAProxyTarget(target)) return target; | |
if (readOnlyViews.has(target)) return readOnlyViews.get(target); | |
/** | |
* @type {()=>never} | |
*/ | |
function fail() { | |
throw new Error('cannot mutate a read only view'); |
NewerOlder