identify <image>
// 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, () => { |
- Marble diagrams are awesome and show the streams really well. When you cannot fit them due to space constraints - time to refactor
- Testing Rx.js code is still hard and requires controlling timing of events. See https://glebbahmutov.com/blog/testing-reactive-code/
- Reactive is all about controlling sequence of events. A simple operation might be take
In its first form it just takes N items s.take(2)
which creates second stream with first 2 events from s
and the completes. But what happens if you don't know how many items to take? Maybe there is a condition,
a simple function that operates on the event data and/or global state that tells when to stop taking items.
In this case takeWhile
is useful s.takeWhile(x => x < 10)
var benv = require('benv'); | |
benv.setup(function () { | |
benv.expose({ | |
$: benv.require('./bower_components/zepto/zepto.js', 'Zepto'), | |
angular: benv.require('./bower_components/angular/angular.js', 'angular') | |
}); | |
console.log('loaded angular', angular.version); | |
console.log('loaded zepto'); | |
$('body').html('<body>\n' + |
Install on Mac using brew install tmux
and start with tmux
See help (list of commands) with Control-b ?
key combination. Leave help view by pressing q
key.
From now on use Control-b
(aka C-b
) to start all tmux commands (C-b
is called command prefix
and can be changed, see tmux.config
options).
- Boston new technology https://www.meetup.com/Boston_New_Technology/
- Mobile tea https://www.meetup.com/mobiletea/events/239566288/
- Startup grind https://www.meetup.com/Startup-Grind-Boston/
- Entrepreneurs + VCs https://www.meetup.com/bostonbusiness/
- Tech in Motion https://www.meetup.com/TechinmotionBoston/
- Boston TechBreakfast https://www.meetup.com/Boston-TechBreakfast/
Also recommended: http://productcampboston.org/ June 10, 2017
// use point-free callbacks | |
// http://glebbahmutov.com/blog/point-free-programming-is-not-pointless/ | |
var middleware = require('./middleware'); | |
app.get('example/uri', function (req, res, next) { | |
middleware.first(req, res) | |
.then(next) | |
.catch(res.json) | |
.done(); | |
}, function (req, res, next) { | |
middleware.second(req, res) |
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; |