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
import ParentStream from "workerstream/parent"; | |
global.stream = ParentStream(); |
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
import Promise from "q" | |
function* getAsyncIterator() { | |
for (let i = 0; i < 10; i++) { | |
yield Promise.resolve(i).delay(250); | |
} | |
} | |
Promise.async(function*() { | |
for (let p of getAsyncIterator()) { |
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
// Runs in iojs or node.js versions >= 0.11.2 | |
// | |
// npm install bluebird | |
// node collate.js | |
// | |
var Promise = require('bluebird'); | |
var stream = require('stream'); | |
var util = require('util'); |
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
var fbp = require("../..") | |
, InputPort = require('../../core/InputPort') | |
, InputPortArray = require('../../core/InputPortArray') | |
, OutputPort = require('../../core/OutputPort') | |
, OutputPortArray = require('../../core/OutputPortArray') | |
, IP = require('../../core/IP'); | |
function sort() { | |
var inPort = InputPort.openInputPort('IN'); | |
var outPort = OutputPort.openOutputPort('OUT'); |
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 bash | |
set -eu | |
disk_file="$1" | |
bytes="$(diskutil info "$disk_file" | grep -Eo '\(\d+ Bytes\)' | grep -Eo '\d+')" | |
block_size="$((1024 * 1024))" | |
blocks="$((bytes / block_size))" |
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 bash | |
set -eu | |
name="library/redis" | |
tag="latest" | |
registry="https://registry-1.docker.io" | |
blobs="blobs" | |
data="images/$name/$tag" |
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
launchctl load ~/Library/LaunchAgents/net.tlrobinson.mute.plist | |
launchctl load ~/Library/LaunchAgents/net.tlrobinson.unmute.plist |
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
Firebase = require "firebase" | |
Immutable = require "immutable" | |
{ EventEmitter } = require "events" | |
# Recursively listens to Firebase ref for modifications and emits "add", | |
# "change", and "remove" events with a path and value (except for "remove") | |
class FirebaseEventEmitter extends EventEmitter | |
constructor: (url) -> | |
EventEmitter.call(@) |
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
var Future = require('fibers/future'); | |
function Lock() { | |
this.futures = []; | |
} | |
Lock.prototype.enter = function() { | |
this.futures.push(new Future); | |
if (this.futures.length > 1) { | |
this.futures[this.futures.length - 2].wait(); | |
} |
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 bash | |
docker inspect --format='{{.Name}}' $(docker ps -q | xargs) | \ | |
sed 's/[^a-zA-Z0-9-]//' | \ | |
awk '{ printf "%s: docker logs -f %s\n", $1, $1 }' | \ | |
foreman start -f /dev/stdin |