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
!(A || B) === !A && !B | |
!(A && B) === !A || !B |
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
cartesian([arr1, arr2, arr3, arr4]).forEach( | |
(option1, option2, option3, option4) => { | |
// use option1, option2, option3, option4 here | |
}); |
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
arr1.forEach(option1 => { | |
arr2.forEach(option2 => { | |
arr3.forEach(option3 => { | |
arr4.forEach(option4 => { | |
// use option1, option2, option3, option4 here | |
}); | |
}); | |
}); | |
}); |
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 f = (a, b) => [].concat(...a.map(d => b.map(e => [].concat(d, e)))); | |
const cartesian = (a, b, ...c) => (b ? cartesian(f(a, b), ...c) : a); |
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
export type BlogEntryId = string; | |
type BlogEntryType = {| | |
id: BlogEntryId, | |
... | |
|}; | |
const blogEntry: = { | |
id: 'ddjj38302mmd92m2k2', | |
... |
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
[options] | |
suppress_type=FixMeAny |
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
[options] | |
suppress_comment= \\(.\\|\n\\)*\\$FlowExpectError |
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
[strict] | |
untyped-import |
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
// part 1 | |
const array = $0.textContent.split(',').map(Number); | |
array[1] = 12; | |
array[2] = 2; | |
let i = 0; | |
while (i < array.length) { | |
const current = array[i]; |
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
// part 1 | |
const fuel = x => Math.floor(x/3) - 2; | |
$0.textContent.split("\n").map(Number).map(fuel).filter(i => i > 0).reduce((a, b) => a + b, 0) | |
// part 2 | |
($0.textContent.split("\n").map(Number).filter(i => i > 0).map(mass => {const res = []; let i = mass; while (i > 0) {i = fuel(i); res.push(i)} return res})).flat().reduce((a, b) => a + b, 0) |
NewerOlder