Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am gavri on github.
  • I am gavri (https://keybase.io/gavri) on keybase.
  • I have a public key ASBPf-HxjQWL8qXh3rCzjAOj0wGAjjSRw7F9OM9JLHUQ1Qo

To claim this, I am signing this object:

@gavri
gavri / gist:8171528
Last active January 1, 2016 16:38
ranju
function foo() {
op1().then(function(result) {
return Q.all([op2(), Q(result)]);
}).then(function(data0, data1) {
// data[0] is context from previous function
// data[1] is data for this call
return Q.all([op3(), Q(data1)]);
}).then(function(data1, data2) {
// do something with both the contexts
});
@gavri
gavri / gist:8171522
Last active January 1, 2016 16:29
ranju
function foo() {
op1().then(function(result) {
return Q.all([op2(), Q(result)]);
}).then(function(data0, data1) {
// data[0] is context from previous function
// data[1] is data for this call
return Q.all([op3, Q(data1)]);
}).then(function(data1, data2) {
// do something with both the contexts
});
split n = [ceil half, floor half]
where half = n / 2
incomplete x n = Bin x (incomplete x first) (incomplete x second)
where let (first, second) = split n