Johnny Austin
@recursivefunk
CodePen DC
1/15/15
Director of Technoloy
Contributor
Reluctant Proponent
Fanboy! (oh-em-gee)
var bar = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];
var foo = bar
.filter(function(item) {
return item > 5;
})
.map(function(item) {
return item * 2;
});
log( foo ); // [ 12, 14, 16, 18, 20 ]
log( bar ); // [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
// the dom ---------------------------------
$('#text-input').on('click', function(e){
var entered = e.target.value;
$('#output').html( entered );
});
// the server ------------------------------
fs
.createReadStream( './some/file.txt' )
.on('data', function(){
// do something with the data
})
.on('error', function(){
// :(
})
.pipe( anotherStream );
// socket.io --------------------------------
io.sockets.on('connection', function (socket) {
var payload = {
msg: 'all your events are belong to us'
};
socket.broadcast.emit( 'readMe', payload );
});
github.com/jray/tiny-frp