As configured in my dotfiles.
start new:
tmux
start new with session name:
package main | |
import ( | |
"fmt" | |
"io" | |
"log" | |
"net/http" | |
"os" | |
) |
As configured in my dotfiles.
start new:
tmux
start new with session name:
var mongoose = require('mongoose'); | |
var Schema = mongoose.Schema; | |
var assert = require('assert') | |
console.log('\n==========='); | |
console.log(' mongoose version: %s', mongoose.version); | |
console.log('========\n\n'); | |
(Full description and list of commands at - https://npmjs.org/doc/index.html)
Make sure to export your local $PATH and prepand relative ./node_modules/.bin/:
function Event(name){ | |
this.name = name; | |
this.callbacks = []; | |
} | |
Event.prototype.registerCallback = function(callback){ | |
this.callbacks.push(callback); | |
} | |
function Reactor(){ | |
this.events = {}; |
// === Arrays | |
var [a, b] = [1, 2]; | |
console.log(a, b); | |
//=> 1 2 | |
// Use from functions, only select from pattern | |
var foo = () => [1, 2, 3]; |
A quick overview of the node.js streams interface with basic examples.
This is based on @brycebaril's presentation, Node.js Streams2 Demystified
Streams are a first-class construct in Node.js for handling data.
Think of them as as lazy evaluation applied to data.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
// Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository | |
$ git ls-files | xargs wc -l |