var cluster = require('cluster');
var http = require('http');
if (cluster.isMaster) {
var worker = cluster.fork();
cluster.on('exit', function(worker, code, signal) {
console.log('worker ' + worker.process.pid + ' died');
});
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
| Verifying that +0x00 is my openname (Bitcoin username). https://onename.com/0x00 |
I hereby claim:
- I am lumberj on github.
- I am 0x00 (https://keybase.io/0x00) on keybase.
- I have a public key whose fingerprint is F01D 24C9 4CCD 9F30 D84D 5A84 4C49 D755 E94C 41E1
To claim this, I am signing this object:
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
| # fetch a pull request locally | |
| # git pr REMOTE PR# | |
| pr = "!f() { git fetch $1 pull/$2/head:pr-$2 && git checkout pr-$2; }; f" |
I hereby claim:
- I am lumberj on github.
- I am 0x00 (https://keybase.io/0x00) on keybase.
- I have a public key whose fingerprint is 68BF 6F42 9BCA 67B5 9520 3750 FB3D EFB3 272B 9393
To claim this, I am signing this object:
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
| a(); | |
| b(); | |
| var a = function() { | |
| console.log("hello world"); | |
| }; | |
| function b() { | |
| console.log("hello, again"); | |
| } |
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 node | |
| var oboe = require('oboe'); | |
| const address = 'rQE5Z3FgVnRMbVfS6xiVQFgB4J3X162FVD'; | |
| const baseUrl = 'http://localhost:5990/v1/accounts/' + address + '/orders?limit=10'; | |
| const stream = process.stdout; | |
| stream.write('[\n'); | |
| streamOrders(baseUrl,true) |
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 node | |
| var http = require('http'); | |
| var concat = require('concat-stream'); | |
| var address = 'rQE5Z3FgVnRMbVfS6xiVQFgB4J3X162FVD'; | |
| var url = 'http://localhost:5990/v1/accounts/' + address + '/orders?limit=10'; | |
| function getOrders(url, cb) { | |
| var req = http.get(url, function(res) { | |
| res.pipe(concat(function(body) { |
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
| var Promise = require('bluebird'); | |
| var _ = require('lodash'); | |
| function promiseA() { | |
| return Promise.resolve([1]); | |
| } | |
| function promiseB(prevResult) { | |
| prevResult.push(2) | |
| return Promise.resolve(prevResult); |
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
| def power_set(set) | |
| # Base Case: The power set of the empty set is a set with only the empty set [ [] ] | |
| return [set] if set.empty? | |
| # General Case: PS(set): PS(set - element) UNION [ element UNION for each subset in PS(set-element) ] | |
| ps = power_set(set[1..-1]) | |
| ps | ps.map { |subset| [set[0]] | subset } | |
| end |