flowchart TD
A(start) -- "my task" --> C["outline"]
C -- "next" --> D["do task"]
D --> E{"works?"}
E -- "yes" --> C
E -- "no (too large a piece)" --> G["break piece"] -- "add" --> C
E -- "yes" --> I["working code library"]
D -- "using" --> I
C -- "done" --> H["end"]
This file contains hidden or 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 -S jq -nrf | |
"Hello world!" |
This file contains hidden or 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
alias runmd="<README.md marked -t | jaq -r '.[]|select(.type==\"code\")|.text' | fzf | rush {}" |
This file contains hidden or 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
// helpers | |
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); | |
const rand = (max) => Math.floor(Math.random() * max); | |
const times = (n, cb) => { | |
const ret = []; | |
for (let i = 0; i < n; i++) { | |
ret.push(cb()); | |
} |
This file contains hidden or 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 _ = require("lodash"); | |
function subgroups(elements) { | |
const bits = _.range(32); | |
const indices = (i) => | |
_(bits) | |
.map((b) => (1 + b) * (0x1 & (i >> b))) | |
.compact() // only leave the `1`s | |
.map((b) => b - 1) |
This file contains hidden or 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 _ = require("lodash"); | |
function subgroups(elements) { | |
if (elements.length == 1) { | |
return [elements]; | |
} | |
const drop = subgroups(_.drop(elements)); | |
const first = _.take(elements); | |
const combined = [..._.map(drop, (i) => [...i, ...first]), ...[...drop, first]]; |
This file contains hidden or 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
String.metaClass.isJson << { -> | |
def normalize = { it.replaceAll("\\s", "") } | |
try { | |
normalize(delegate) == normalize(JsonOutput.toJson(new JsonSlurper().parseText(delegate))) | |
} catch (e) { | |
false | |
} | |
} |