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 () { | |
const log = () => console.log(a); | |
// log(); (1) | |
const a = 42; | |
log(); | |
} | |
foo(); |
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
// https://twitter.com/thecat/status/1427419888650383364 | |
const values = [ | |
[1, 2, 3], | |
[4, 5], | |
[6, 7, 8], | |
]; | |
console.log(values.reduce((xs, cs) => cs.flatMap(c => xs.map(x => [...x, c])), [[]])); |
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 { | |
createHistogram, | |
performance: { | |
timerify | |
} | |
} = require('perf_hooks'); | |
const users = [ |
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
// Copied from https://www.gss.com.tw/blog/parser-combinators | |
type Option<T> = T | undefined; | |
type Parser<T> = (input: string) => [Option<T>, string]; | |
const str | |
: (s: string) => Parser<string> | |
= (s) => (input) => { | |
if (input.startsWith(s)) return [s, input.slice(s.length)]; | |
return [, input]; | |
}; |
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
test.only('Array of objects not parsed correctly #252', function (st) { | |
st.deepEqual(qs.parse('param[][id]=X¶m[][id]=Y'), { | |
param: [ | |
{ id: ['X', 'Y'] } | |
] | |
}); | |
// the same as default | |
st.deepEqual(qs.parse('param[][id]=X¶m[][id]=Y', { separateArrayItem: 'never' }), { | |
param: [ | |
{ id: ['X', 'Y'] } |
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 round (state, current, max) { | |
const p1 = state[current]; | |
const p2 = state[p1]; | |
const p3 = state[p2]; | |
state[current] = state[p3]; | |
let dest = current - 1; | |
const pickuped = [p1, p2, p3]; | |
while (dest == 0 || pickuped.includes(dest)) { | |
if (dest == 0) { |
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 solve (ns, end) { | |
const seenMap = new Map(); | |
function say (n, idx) { | |
if (!seenMap.has(n)) { | |
seenMap.set(n, [idx]); | |
return; | |
} | |
const record = seenMap.get(n); | |
record[1] = record[0]; |
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
// ~/.deno/deno run --allow-net --allow-read ./deno-test-redirect-server.ts | |
import { serve } from "https://deno.land/std/http/server.ts"; | |
const s = serve({ port: 8000 }); | |
console.log("http://localhost:8000/"); | |
for await (const req of s) { | |
console.log(req.url); |
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
<template> | |
<div> | |
<button role="button" @click="foo += 1" >Click me!</button> | |
<SendToBody > | |
<h1>Current Foo: {{ foo }}</h1> | |
</SendToBody> | |
</div> | |
</template> | |
<style scoped> |
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
https://jstrieb.github.io/urlpages/#JTBBJTNDIURPQ1RZUEUlMjBodG1sJTNFJTBBJTNDaGVhZCUzRSUwQSUzQ3N0eWxlJTNFJTBBJTNBcm9vdCUyMCU3QiUwQSUyMG1heC13aWR0aCUzQSUyMDY0cmVtJTNCJTBBJTdEJTBBJTNDJTJGc3R5bGUlM0UlMEElM0NzY3JpcHQlMjB0eXBlJTNEJTIydGV4dCUyRmphdmFzY3JpcHQlMjIlM0UlMEElMEElM0MlMkZzY3JpcHQ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