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
> ./open-remote.sh |
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('davy'); | |
//get user as promise | |
function getUser() { | |
return new Promise(function (resolve) { | |
setTimeout(function () { | |
resolve('user name'); | |
}, 1000); | |
}); | |
} |
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 Transform = require('stream').Transform, | |
http = require('http'); | |
function DelayStream () { | |
Transform.apply(this, arguments); | |
} | |
DelayStream.prototype = Object.create(Transform.prototype); | |
DelayStream.prototype._transform = Transform.prototype.push; | |
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 CustomError = function(message, anotherField) { | |
this.message = message; | |
this.anotherField = anotherField; | |
if (Error.captureStackTrace) { | |
Error.captureStackTrace(this, CustomError); | |
} else { | |
var e = new Error; | |
this.fileName = e.fileName; | |
this.lineNumber = e.lineNumber; |
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
sudo apt-get install -y python-software-properties python g++ make | |
sudo add-apt-repository ppa:chris-lea/node.js | |
sudo apt-get update | |
sudo apt-get install nodejs | |
sudo npm install -g npm | |
sudo apt-get install n |
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 supported = true; | |
try { | |
eval('(function *() {})'); | |
} catch (e) { | |
supported = false; | |
} | |
console.log(supported); |
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
function uniq(array) { | |
return array.filter(function (val, index) { | |
return array.indexOf(val) === index; | |
}); | |
} |
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 suspend = require('suspend'), | |
fs = require('fs'); | |
suspend(function *(resume){ | |
var users = yield fs.readdir('/Users', resume); | |
console.log(users); | |
})(); |
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 co = require('co'), | |
fs = require('fs'), | |
read = co.wrap(fs.readdir); | |
co(function *(){ | |
var users = yield read('/Users'); | |
console.log(users); | |
}); |
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
{ | |
get: {..}, | |
routeMatches: [..], | |
res: instanceOfResponce | |
} |