/* Copy an array */
b = a.slice();
/* Predicate is true everywhere (`all` in some languages) */
a.every(pred)
/* Predicate is true for some values (`any in some languages`) */
a.some(pred)
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
#!/usr/bin/env node | |
const fs = require('fs'); | |
const path = require('path'); | |
const Readable = require('readable-stream').Readable; | |
function complements(arr, predicate) { | |
const out = [[],[]]; | |
arr.forEach(e => out[Number(!!predicate(e))].push(e)); | |
return out; |
- E. Tufte: The Visual Display of Quantitative Information (1983)
- Standard work on data visualization
- M. Itkonen: Typografian käsikirja (2012)
M. Butterick: Practical typography (2013)- L. Verou: CSS Secrets (2014)
J. Keith: Resilient web design
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
#!/usr/bin/env node | |
/** | |
./binarify.js < SOME_FILE > OUT_FILE | |
./binarify.js -d < OUT_FILE | |
*/ | |
const { Transform } = require("stream"); |
"use strict";
// Requires NodeJS >= 11.6.0
const crypto = require("crypto");
const util = require("util");
const generateKeyPair = util.promisify(crypto.generateKeyPair);
#include <stdio.h>
// cc rockit.c -o rock
// ./rock | tee rock.wav | mplayer -rawaudio rate=8000:channels=1:samplesize=2 -demuxer rawaudio -cache 256 -
int main (int argc, char *argv[])
{
for (int t=0;;t++)
putchar (t>>6|t|t>>(t>>16)*10 + ((t>>11)&7));
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
#!/usr/bin/env node | |
"use strict"; | |
const AWS = require("aws-sdk"); | |
const assert = require("assert"); | |
assert(process.env.AWS_PROFILE, "AWS_PROFILE must be defined"); | |
assert(process.env.AWS_REGION, "AWS_REGION must be defined"); | |
assert(process.env.APP_HOSTNAME, "APP_HOSTNAME must be defined"); |
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 os = require("os"); | |
async function main() { | |
let input = Buffer.from([]); | |
for await (const chunk of process.stdin) { | |
input = Buffer.concat([input, chunk]); | |
} |
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 function uuidv4() { | |
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) { | |
const r = (Math.random() * 16) | 0, | |
v = c == "x" ? r : (r & 0x3) | 0x8; | |
return v.toString(16); | |
}); | |
} | |
export function lazy<T>(value: T) { | |
return () => value; |
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
#!/usr/bin/env node | |
const fetch = require("node-fetch"); | |
const query = | |
` | |
{ | |
stops(ids: ["HSL:1040406", "HSL:1050432"]) { | |
name | |
stoptimesForPatterns { |
OlderNewer