Skip to content

Instantly share code, notes, and snippets.

Verifying that +0x00 is my openname (Bitcoin username). https://onename.com/0x00

Keybase proof

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:

# fetch a pull request locally
# git pr REMOTE PR#
pr = "!f() { git fetch $1 pull/$2/head:pr-$2 && git checkout pr-$2; }; f"
@alandotcom
alandotcom / keybase.md
Created January 4, 2015 16:19
keybase

Keybase proof

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:

@alandotcom
alandotcom / functions.js
Created December 23, 2014 17:31
Function declaration vs. statement
a();
b();
var a = function() {
console.log("hello world");
};
function b() {
console.log("hello, again");
}
@alandotcom
alandotcom / pagination_streams.js
Last active August 29, 2015 14:11
Paginating ripple-rest responses with streams
#!/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)
@alandotcom
alandotcom / paginate_offers.js
Created December 12, 2014 20:47
Paginating offers from ripple-rest
#!/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) {
@alandotcom
alandotcom / promiseLoop.js
Created December 10, 2014 03:00
Async promise loop
var Promise = require('bluebird');
var _ = require('lodash');
function promiseA() {
return Promise.resolve([1]);
}
function promiseB(prevResult) {
prevResult.push(2)
return Promise.resolve(prevResult);
@alandotcom
alandotcom / powerset.rb
Last active August 29, 2015 14:09
Power Set
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

Keybase proof

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 4633 F361 A0D4 9653 A019 6F3B BD00 2615 CC77 8356

To claim this, I am signing this object: