I hereby claim:
- I am jczimm on github.
- I am jczimm (https://keybase.io/jczimm) on keybase.
- I have a public key whose fingerprint is F12C FDA4 2608 B5F4 7582 0D1B DFB5 382A 5D4D E45C
To claim this, I am signing this object:
Object.prototype.pipe = function pipe(fn) { return fn(this.constructor(this)); } |
const auto = rules => | |
(strs, ...vars) => strs.map((str, i) => { | |
if (i >= vars.length) return str; | |
const v = vars[i]; | |
const r = rules[typeof v]; | |
return str + (r ? r(v) : v); | |
}).join(''); | |
// examples: | |
const t = auto({ boolean: v => v || '', object: JSON.stringify }); |
const toHexCharCode = char => char.charCodeAt(0).toString(16).padStart(2, '0'); | |
function encodeGolf(plain) { | |
return unescape( // enter unicode escape codes land | |
plain.match(/[\s\S]{1,2}/g) // split string into pairs of letters | |
.map(([a, b]) => b ? '%uD8' + toHexCharCode(a) + '%uDC' + toHexCharCode(b) : a) // encode each pair as a high surrogate and low surrogate in unicode (where an odd character, just include it unencoded to preserve odd length) | |
.join('') // concatenate the escape codes as a string | |
); // exit escape codes land; return actual unicode characters | |
} | |
// 5 bytes fewer than decode |
const choo = require('choo') | |
const app = choo() | |
app.model({ | |
// namespace: "app", | |
state: { title: 'Set the title' }, | |
reducers: { | |
update: (action, state) => ({ title: action.value }) | |
} | |
}) |
const a4Freq = 440; | |
const noteNames = ["A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"]; | |
function noteToFrequency(noteName) { | |
const [, noteLetter, octaveNum] = noteName.match(/^(\w#?)(\d)$/) || []; | |
const numStepsFromA = noteNames.indexOf(noteLetter.toUpperCase()); | |
if (numStepsFromA === -1 || !noteLetter) return new Error("Invalid note"); | |
const numStepsFromMiddleA = numStepsFromA + 12 * (octaveNum - 4); | |
module['exports'] = function jczimmCLI (hook) { | |
var request = require('request'); | |
var http = require('http') | |
, vm = require('vm') | |
, concat = require('concat-stream'); | |
request.get("https://npmcdn.com/hget@3.0.0/index.js", function(err, res, body) { | |
var sandbox = { require: require }; | |
vm.createContext(sandbox); | |
vm.runInThisContext(body, './remote_modules/hget.js', sandbox); | |
var hget = require('./remote_modules/hget.js'); |
// Syntax 1: | |
s.val(13)::third::second::first::s.run(); | |
// Syntax 2: (-> s.val completely unnecessary) | |
third::second::first::s.run(13); | |
// | |
// Example programmatic creation of a chain | |
let chain = third; |
var charMap = function charMap(str, from, to, tryLowerCase = false) { | |
return str | |
.split("") | |
.map((char, i) => to.charAt(from.indexOf(tryLowerCase ? char.toLowerCase() : char)) || char) | |
.join(""); | |
}; | |
var normal = "abcdefghijklmnopqrstuvwxyz", | |
smallLetters = "\u1d00\u0299\u1d04\u1d05\u1d07\u0493\u0262\u029c\u026a\u1d0a\u1d0b\u029f\u1d0d\u0274\u1d0f\u1d18\u01eb\u0280s\u1d1b\u1d1c\u1d20\u1d21x\u028f\u1d22"; |
function Chain (datum) { | |
if (datum != undefined) { | |
this.length = this.length !== undefined ? this.length + 1 : 1; | |
this[this.length - 1] = datum; | |
return Chain.bind(this); | |
} else { | |
return this; | |
} |
I hereby claim:
To claim this, I am signing this object: