This file contains 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
<html> | |
<head> | |
<title>Psychedelic Protovis experiment by @MetaThis</title> | |
<script type="text/javascript" src="http://vis.stanford.edu/protovis/protovis-r3.2.js"></script> | |
<style type="text/css"> | |
body { | |
background: black; | |
margin: 0; | |
} | |
#fig { |
This file contains 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
//some sample data for the example | |
var people = [ {firstName: "Bob", lastName: "Barker", age: 100}, {firstName: "John", lastName: "Smith", age: 40}, {firstName: "Sam", lastName: "Adams", age: 42}, {firstName: "John", lastName: "Adams", age: 42}, {firstName: "Bernard", lastName: "Adams", age: 42}, {firstName: "Adam", lastName: "Adams", age: 42} ]; | |
//generalized comparator function factory enabling composition with nested comparators | |
var comparatorComposer = function(compareBy, nextComparator) { | |
var comparator = function(a, b) { | |
return ((a[compareBy] < b[compareBy]) ? -1 : ((a[compareBy] > b[compareBy]) ? 1 : (nextComparator ? nextComparator(a, b) : 0))); | |
}; | |
return comparator; | |
}; |
This file contains 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'), | |
request = require('request'), // request module from https://github.com/mikeal/request | |
url = require('url'); | |
http.createServer(function (req, res) { | |
var href = url.parse(req.url,true).href; | |
request('http://127.0.0.1:5984' + href).pipe(res); | |
}).listen(1337); | |
// now try something like http://127.0.0.1:1337/your_db_name/_all_docs/?limit=10 |