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
/tmp $ git clone -q github.com/unravelin/tomono | |
/tmp $ cat sub-repositories.txt | |
https://github.com/outr/scalarelational.git scalarelational | |
https://github.com/realph/gulp-zero.git zero | |
https://github.com/reaxis/mu µ | |
/tmp $ cat sub-repositories.txt | ./tomono/tomono.sh | |
… crunch crunch crunch | |
/tmp $ cd core | |
/tmp/core $ git branch | |
2.0.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
Object.defineProperty(Array.prototype, 'all', { | |
get: function () { | |
return new Proxy(this, { | |
get: function(target, name, receiver) { | |
return target.map(x => x[name]); | |
}, | |
set: function (target, name, value) { | |
target.forEach(x => x[name] = value); | |
}, | |
// ... call:, etc. |
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
// Imagine you want to explicitly define which members of a public API | |
// interface your implementation actually uses. Example: you implement | |
// a web extension, but only use a few of the members on the argument | |
// to the onHeadersReceived handler. Explicitly typing this is useful | |
// when creating mocks in your unit tests. | |
// | |
// Here's now you could do it: | |
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
// Simplistic directory watcher | |
// | |
// example usage: | |
// | |
// $ node watch.js | while read line ; do echo compiling ... ; ( while read -r -t 0; do read -r ; done ) ; rm -rf build ; npm run build ; echo done ; done | |
// | |
var fs = require('fs'); |
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
package main | |
import ( | |
"encoding/json" | |
) | |
// PotentialJSON acts as a JSON encoding wrapper for []byte. The encoding is | |
// tentative: | |
// | |
// * if the contents already happen to be valid JSON, then it is represented |
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
sudo: false | |
services: | |
- docker | |
before_script: | |
- sudo service docker stop | |
- if [ "$(ls -A /home/travis/docker)" ]; then echo "/home/travis/docker already set"; else sudo mv /var/lib/docker /home/travis/docker; fi | |
- sudo bash -c "echo 'DOCKER_OPTS=\"-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock -g /home/travis/docker\"' > /etc/default/docker" | |
- sudo service docker start |
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
$ /tmp/test.sh | |
$*: [] | |
"$*": [''] | |
$@: [] | |
"$@": [] | |
$ /tmp/test.sh a b "c d" | |
$*: ['a', 'b', 'c', 'd'] |
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 carthesian<T>(columns: T[][], f: (x: T[]) => void, stackOut: T[] = []): void { | |
if (columns.length === 0) { | |
f(stackOut) | |
} else { | |
const column = columns.shift()!; | |
column.forEach(entry => { | |
stackOut.push(entry); | |
carthesian(columns, f, stackOut); | |
stackOut.pop(); | |
}); |
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
// Inspired by: | |
// https://github.com/tc39/proposal-pipeline-operator/blob/37119110d40226476f7af302a778bc981f606cee/README.md#object-decorators | |
// | |
// Once pipe operator is implemented in TS, use this example to check if it | |
// survives type checking. | |
// Describe mixed in functionality |
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.tomas-dvorak.cz/posts/nodejs-request-without-dependencies/ | |
// Licensed under: Attribution 4.0 International (CC BY 4.0) | |
// https://creativecommons.org/licenses/by/4.0/ | |
// (note: there's some funky url parsing business which I didn't fully test; caveat emptor) | |
import * as http from "http"; | |
import * as https from "https"; | |
import * as url from "url"; |