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
### Keybase proof | |
I hereby claim: | |
* I am dannyrscott on github. | |
* I am dannyrscott (https://keybase.io/dannyrscott) on keybase. | |
* I have a public key whose fingerprint is 55D8 20DB 7656 E8B0 2DE8 B048 F091 212D 008D F953 | |
To claim this, I am signing this object: |
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 BeanStalkClient = require("./lib/client2").Client('loaderdev12.dc3.homes.com:11300'); | |
console.dir(BeanStalkClient); | |
BeanStalkClient.promisified('watch', 'test-tube') | |
.then(function(){ | |
return BeanStalkClient.promisified('ignore','default') | |
}) | |
.then(function() { | |
return BeanStalkClient.promisified('list_tubes_watched') |
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 Bluebird = require("BlueBird"), | |
BeanStalk = require("nodestalker"); | |
function Stalk(options) { | |
this.client = BeanStalk.Client(options); | |
} | |
Stalk.prototype.DOIT = function(method, args) { | |
var _self = this; | |
return new Bluebird(function(resolve, reject){ |
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 bs = require('nodestalker'), | |
client = bs.Client('127.0.0.1:11300'), | |
Bluebird = require('bluebird'); | |
function use(type) { | |
return new Bluebird(function(resolve,reject){ | |
client.use(type) | |
.onSuccess(resolve) | |
.onError(reject); | |
}); |
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
Promise.all([ | |
aPromiseFunc(), | |
aSyncFunc(), | |
7, | |
x.data ? anAsync(x.data) : null | |
]) | |
.spread(aProm, aSync, num, anAsync) { | |
//aProm is resolve of aPromiseFunc | |
//aSync is return of aSyncFunc | |
//num === 7 |
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
functionThatReturnsAPromise() | |
.then(function(dataFromPromise) { | |
//do stuff | |
return anotherPromise(); | |
}) | |
.then(function(dataFromAnotherPromse) { | |
//do stuff | |
return 1; |
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 Promise = require("bluebird"); | |
function buildEmail(to, from, subject, body, priority, headers, type, conn) { | |
var email = conn.model("email"), | |
thisEmail = new email({ | |
"to" : to, | |
"from" : from, | |
"subject" : subject, | |
"priority" : priority || 6, | |
"headers" : headers || {}, |
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 Promise = require('bluebird'); | |
var validObject; | |
function getValidationObject() { | |
return new Promise(function(resolve,reject){ | |
if (validObject) | |
return resolve(validObject); | |
else | |
getFromDB() | |
.then(function(valid) { | |
validObject = valid; |
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 Promise = require('bluebird'); | |
var foo = {}; | |
Object.defineProperty(foo, 'bar', { | |
get: (function() { | |
var memo; | |
return function() { | |
return new Promise(function(resolve, reject){ | |
if (memo !== undefined) { | |
console.log('memo...'); |
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 horaa = require('horaa'); | |
var DOA = horaa('./DOA.js'); | |
function newStuff() { | |
console.log('hi'); | |
} | |
DOA.hijack('connect', newStuff); |
NewerOlder