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'); |
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 |
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)})()' |
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
// Our incremental JSON parser (simplified only to use strings and arrays) | |
// while iterator result != done keep using .next(moreSrc) or .next(null) if you are done providing data | |
// while the iterator is not done it will return the state of the iterator | |
// the iterator is seeking more data to get a valid value | |
// call .next(str) to provide it more data | |
var NEED_MORE_DATA = 0; | |
// the iterator has a valid result and will return a result if you provide .next(null) | |
// this is not automatic, due to numbers and potentially invalid trailing characters after an expected end |
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'; | |
/** | |
* @template {Object} O | |
* @constructor | |
* @param {O} o | |
* @returns {O} | |
*/ | |
function Override(o) { | |
return o; | |
} |
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 |
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/ |
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 inspector from "inspector"; | |
const url2scriptid = new Map<string, string>(); | |
const session = new inspector.Session(); | |
session.connect(); | |
setupDebugger(); | |
function setupDebugger() { |
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
//Attach me to Node.prototype as well | |
var DOCUMENT_POSITION_DISCONNECTED = Node.prototype.DOCUMENT_POSITION_DISCONNECTED = 0x01 | |
var DOCUMENT_POSITION_PRECEDING = Node.prototype.DOCUMENT_POSITION_PRECEDING = 0x02 | |
var DOCUMENT_POSITION_FOLLOWING = Node.prototype.DOCUMENT_POSITION_FOLLOWING = 0x04 | |
var DOCUMENT_POSITION_CONTAINS = Node.prototype.DOCUMENT_POSITION_CONTAINS = 0x08 | |
var DOCUMENT_POSITION_CONTAINED_BY = Node.prototype.DOCUMENT_POSITION_CONTAINED_BY = 0x10 | |
Node.prototype.compareDocumentPosition = function compareDocumentPosition( otherNode ) { | |
if( !(otherNode instanceof Node) ) { | |
throw Error("Comparing position against non-Node values is not allowed") |
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
const loop = Machine({ | |
context: { x: 3 }, | |
initial: 'while (x > 0)', | |
states: { | |
"while (x > 0)": { | |
on: { | |
EVAL: [ | |
{ | |
target: "x--", | |
cond(ctx, evt) { |