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 item = { | |
done: true, | |
value: null, | |
}; | |
function* wrap(source) { | |
try { | |
yield* source; | |
} catch (e) { | |
// this never happens |
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 { join, normalize, dirname, relative } = require('path'); | |
const { sync: readPkgUp } = require('read-pkg-up'); | |
function pkgname(path) { | |
const match = /(^@?[^/]+\/[^/]+|[^/]+)(.*)/.exec(path); | |
return match && [match[1], match[2]]; | |
} | |
const pkg = readPkgUp({ normalize: false }); | |
const root = dirname(pkg.path); |
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
# EditorConfig is awesome: http://EditorConfig.org | |
root = true | |
[*] | |
end_of_line = lf | |
insert_final_newline = true | |
[{*.{js,json,md}}] | |
charset = utf-8 |
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
2c2,4 | |
< WhatsApp Inc. (“WhatsApp,” “our,” “we,” or “us”) provides messaging, Internet calling, and other services to users around the world. Please read our Terms of Service so you understand what’s up with your use of WhatsApp. You agree to our Terms of Service (“Terms”) by installing, accessing, or using our apps, services, features, software, or website (together, “Services”). | |
--- | |
> If you live in the European Region, WhatsApp Ireland Limited provides WhatsApp to you under this Terms of Service and Privacy Policy. | |
> | |
> WhatsApp LLC (“WhatsApp,” “our,” “we,” or “us”) provides messaging, Internet calling, and other services to users around the world. Please read our Terms of Service so you understand what’s up with your use of WhatsApp. You agree to our Terms of Service (“Terms”) by installing, accessing, or using our apps, services, features, software, or website (together, “Services”). | |
56c58 | |
< Forum and Venue. If you are a WhatsApp user located in the United States or Canada, the “Special Arbitration Provi |
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 { AST as T } from 'regexpp'; | |
export type Expression = T.Pattern | T.Group | T.CapturingGroup | T.LookaroundAssertion; | |
export type Visit<R> = (node: T.Node) => R; | |
export interface Visitors<R> { | |
RegExpLiteral?: (node: T.RegExpLiteral, visit: Visit<R>) => R; | |
Pattern?: (node: T.Pattern, visit: Visit<R>) => R; | |
Alternative?: (node: T.Alternative, visit: Visit<R>) => R; |
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
Battlebots Bracket 2021 | |
B is a buy, where the result was known when the bracket was made | |
(1) HYDRA BLOODSPORT (2) | |
(32) HYPERSHOCK GRUFF (31) | |
B (HYDRA) BLOODSPORT | |
B (GIGABYTE) TANTRUM | |
(16) MALICE FUSION (15) | |
(17) GIGABYTE TANTRUM (18) |
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 recast = require('recast'); | |
const babylon = require('@babel/parser'); | |
function getParseCallOptions({ parse, ...parseOptions }) { | |
return { parse, parseOptions }; | |
} | |
function getPrintCallOptions({ print, ...printOptions }) { | |
return { print, printOptions }; | |
} |
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 lexer = moo.states({ | |
error: { | |
CausedBy: { match: /^\s*[cC]ause(?:d [bB]y)?:/, value: () => "Caused by:" }, | |
At: { match: /^[ \t]*at /, push: "frame", value: () => "at " }, | |
Space: /[ \t]+/, | |
Newline: { match: "\n", lineBreaks: true }, | |
// Any line ending with file:line:col is a stack frame | |
// file:line:col may be wrapped in parens, or may be the literal 'native' |
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 t = { | |
token: (value) => ({ type: 'token', value }), | |
literal: (value) => ({ type: 'literal', value }), | |
}; | |
const escapes = { | |
'"': '"', | |
'\\': '\\', | |
b: '\b', | |
f: '\f', | |
n: '\n', |
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 peekerate from '@iter-tools/peekerate'; | |
export function* tokenize(input) { | |
const peekr = peekerate(input); | |
while (!peekr.done) { | |
const char = peekr.value; | |
if (char === '"') { | |
// yields three tokens: " content " | |
yield* tokenizeString(peekr); |