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
process.on('message', function(msg){ | |
require(msg.path)(); | |
}); |
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 when = require('when'); //It is a regular A+ Promises library | |
function somethingThatThrows(){ | |
throw new Error('Boom'); | |
} | |
when.resolve('Hello') | |
.then(function(result){ | |
somethingThatThrows(); | |
return result; |
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 i = setInterval(function(){ | |
setInterval(function(){ | |
console.log('reached'); | |
}, 100); | |
}, 100); | |
setTimeout(function(){ | |
clearInterval(i); | |
}, 101); |
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 async = require('async'); | |
async.parallel([ | |
function(done){ | |
while(true){} | |
}, | |
function(done){ | |
console.log('second running'); | |
setInterval(function(){ | |
console.log('second interval running'); |
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
.provider('Test', ['constant', function(constant){ | |
return { | |
$get: ['constant', function(sameConstant){ | |
sameConstant === constant; | |
}] | |
} | |
}); |
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
module.exports = function(connection){ | |
return { | |
thumb: function(doc){ | |
if(doc.thumbnails) return; | |
var Thumbnal = connection.model('Thumbnail'); | |
Thumbnail.generate(doc.url, function(err, thumb){ | |
doc.thumbnails = thumb; | |
doc.save() | |
}); |