Install pre-git for handling Git hooks and commitizen for helping format the commit messages
npm install pre-git commitizen cz-conventional-changelog --save-dev
// I am trying to open PouchDB normally, but this fails in Firefox Incognito mode | |
var db = new PouchDB('test'); | |
// InvalidStateError | |
// I see the idb error callback being called if the open request fails | |
exports.idbError = function (callback) { | |
return function (event) { | |
var message = (event.target && event.target.error && | |
event.target.error.name) || event.target; | |
callback(errors.error(errors.IDB_ERROR, message, event.type)); | |
}; |
// NOTE does not work in strict mode | |
function parent(a, b) { | |
console.log('in parent, a', a, 'b', b); | |
var parentArguments = arguments; | |
function child() { | |
console.log('in child, a', a, 'b', b); | |
console.log('is parentArguments === c.args?', parentArguments === c.args); | |
console.log('parentArguments', parentArguments); | |
return a + b; |
Install pre-git for handling Git hooks and commitizen for helping format the commit messages
npm install pre-git commitizen cz-conventional-changelog --save-dev
// node-canvas | |
var Canvas = require('canvas') | |
console.log('Canvas is', Canvas) | |
var nodeCanvas = new Canvas(120, 120) | |
var ctx = nodeCanvas.getContext('2d') | |
// canvas-5-polyfill patches CanvasRenderingContext2D.prototype | |
// lets give it one | |
global.CanvasRenderingContext2D = {}; | |
global.CanvasRenderingContext2D.prototype = ctx; |
# See list of docker virtual machines on the local box | |
$ docker-machine ls | |
NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS | |
default * virtualbox Running tcp://192.168.99.100:2376 v1.9.1 | |
# Note the host URL 192.168.99.100 - it will be used later! | |
# Build an image from current folder under given image name | |
$ docker build -t gleb/demo-app . |
docker is configured to use the default machine with IP 192.168.99.100
redis:alpine
prebuilt container from docker hub.docker run --name redis -p 6379:6379 -d redis:alpine
On Mac OSX
To find the local network (WIFI usually) address ipconfig getifaddr en0
ipconfig getifaddr en0
192.168.0.8
// A: is this pure function? | |
function sum(a, b) { return a + b } | |
// B: is this a pure function? | |
const k = 2 | |
function addK(a) { return a + k } | |
// C: is this a pure function? | |
function sub(a, b) { return sum(a, -b) } | |
// D: is this a pure function? | |
function sub(a, b, summer) { return summer(a, b) } | |
// E: is this a pure function? |
// if our data is more complicated and has to form things from items for example | |
// just pass around list of functions | |
const API = { | |
github: (username) => 'http://github.com/' + username, | |
photo: (username) => `http://github.com/${username}/avatar/` | |
} | |
const users = ['bahmutov', 'adity'] | |
Object.keys(API).forEach((apiName) => { | |
const formApiUrl = API[apiName] | |
describe('api ' + apiName, () => { |