View regulator.js
'use strict';
/**
* A regulator connects Source and Reducer/Effect with regards of responsiveness.
*/
class Regulator {
constructor(configs) {
this._source = null;
View oauthmultipartform.js
var fs = require('fs');
var request = require('request');
/*
var plurkTokens =
{ "consumer_key": "<key>"
, "consumer_secret": "<secret>"
, "token": "<token>"
, "token_secret": "<secret>"
};
View ncu-exam.js
// This would provide `createFile`, `createReadStream`, `writeContent` and `createWriteStream`.
var FileSystem = require('FileSystem');
var Reader = function() {
this.counter = 0;
};
Reader.prototype = FileSystem.prototype;
Reader.prototype.paths = ['/tmp/urandom-1.txt', '/tmp/urandom-2.txt'];
Reader.prototype.start = function() {
this.mainPromise = Promise.resolve()
.then(function() {
View ncu-q4.js
var Cube = function(width) {
this.width = width;
};
Cube.prototype.volume = function() {
return Math.pow(this.width, 3);
};
var cube = new Cube(4)
cube.volume = cube.volume.bind({ width: 3});
View ncu-q3.js
var Cuboid = function() {
this.volume = function() {
return this.cuboidSize[0] *
this.cuboidSize[1] *
this.cuboidSize[2] ;
};
};
Cuboid.prototype.cuboidSize = [12, 8, 10];
View ncu-q2.js
var Foo = function() {};
Foo.prototype.bark = function() {
console.log('Foo barks');
};
var Bar = function() {};
Bar.prototype = Foo.prototype;
Bar.prototype.bark = function() {
console.log('Bar barks');
};
View simpleClosureTrick.js
(function() {
let action = 'barks';
let foo = function() {
console.log('foo', action);
};
})();
console.log(typeof foo);
View simpleThisTrick.js
let Foo = function() {
this._name = 'Foo';
};
Foo.prototype.bark = function() {
console.log(this._name, ' barks');
};
let foo = new Foo();
let fooBark = foo.bark;
View gist:b866c4f1f18363a300bb
https://github.com/altercation/solarized/issues/146
View gist:6e459e097a2a97a93317
export PATH=$PATH:~/.bin:~/.nvm
export DOCKER_HOST=tcp://localhost:4243
export PS1="\[\033[1;32m\]`hostname`\[\033[0m\] \[\033[1;35m\]\u\[\033[0m\]:\[\033[1;33m\]\w\[\033[0m\]$ "
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
export PATH=$PATH:/usr/local/share/gcutil
source ~/.nvm/nvm.sh