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
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 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 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 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 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 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
#include <Servo.h> | |
int MOTOR_PIN = 9; | |
int MIN = 1000; | |
int MAX = 2000; | |
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
// nested | |
callA().then(function () { | |
return callB().then(function () { | |
return callC() | |
}); | |
}); | |
// equivalent |
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
function someAction({x, y, z}) { | |
console.log('x:', x); | |
console.log('y:', y); | |
console.log('z:', z); | |
} | |
someAction({ | |
y: 1, | |
z: 2 | |
}); |
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 browserify = require('browserify'); | |
var watchify = require('watchify'); | |
var gutil = require('gulp-util'); | |
var fs = require('fs') | |
var files = { | |
js: { | |
src: 'path to src', | |
dst: 'path to dst' | |
} |
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
{ | |
get: {..}, | |
routeMatches: [..], | |
res: instanceOfResponce | |
} |
OlderNewer