The approach and the client side code you can find here: https://github.com/yahoo/flux-examples/blob/master/routing/app.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var | |
beginBuff, | |
beginBuffStr; | |
// type detection | |
if (chunkNum === 0) { | |
beginBuff = data.slice(0, 8); | |
beginBuffStr = beginBuff.toString('hex', 0, beginBuff.length); | |
// jpg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/ | |
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server | |
############################################### | |
# To use: | |
# wget https://raw.github.com/gist/2776679/04ca3bbb9f085b192f6aca945120fe12d59f15f9/install-redis.sh | |
# chmod 777 install-redis.sh | |
# ./install-redis.sh | |
############################################### | |
echo "*****************************************" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
1. | |
a: NaN | |
b: 0123 | |
c: 6 | |
*/ | |
var transactions = [{ id: 1, value: 1 }, { id: 2, value: 2 }, { id: 3, value: 3 }]; | |
var total = transactions.reduce(function(prev, transaction) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var http = require('http'); | |
var select = require('html-select'); | |
var tokenize = require('html-tokenize'); | |
var url = 'http://www.bbc.com/news/health-27422547'; | |
http.get(url, function (response) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var select = require('../'); | |
var tokenize = require('html-tokenize'); | |
var fs = require('fs'); | |
var s = select('ul > li dt[name*="sample"]', function (e) { | |
console.log('*** MATCH ***'); | |
e.createReadStream().on('data', function (row) { | |
console.log([ row[0], row[1].toString() ]); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var util = require('util'); | |
var fs = require('fs'); | |
var es = require('event-stream'); | |
var request = require('request'); | |
function nicely(data, cb) { | |
cb(null, util.inspect(data)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Readable = require('stream').Readable; | |
var es = require('event-stream'); | |
var request = require('superagent'); | |
var React = require('react'); | |
var data1 = '{ "name": "substack" }\n{ "name": "dominictarr" }\n'; | |
var data2 = '{ "name": "mikeal" }\n{ "name": "indutny" }\n{ "name": "dead-horse" }'; | |
function filterOutEmpty (data, cb){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var stream = require('stream'); | |
var _ = require('highland'); | |
var $ = require('jquery'); | |
var toConsoleStream = new stream.Writable({ objectMode: true }); | |
toConsoleStream._write = function (data, encoding, done) { | |
console.log(data); | |
done(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
var _ = require('highland'); | |
var mongoose = require('mongoose'); | |
var httpServer = http.createServer(); | |
var server = _('request', httpServer, ['req', 'res']); | |
mongoose.connect('mongodb://localhost/test'); | |
var UserSchema = new mongoose.Schema({ |
OlderNewer