Playing with D3.js to get a drill down behavior for a hierarchical data collection represented in pie charts. See live example
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: | |
| :-1: | |
| :airplane: | |
| :art: | |
| :bear: | |
| :beer: | |
| :bike: | |
| :bomb: | |
| :book: | |
| :bulb: |
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
| ## The Problem | |
| Standard practices say no non-root process gets to talk to the Internet on a port less than 1024. How, then, could I get Node talking on port 80 on EC2? (I wanted it to go as fast as possible and use the smallest possible share of my teeny tiny little micro-instance's resources, so proxying through nginx or Apache seemed suboptimal.) | |
| ## The temptingly easy but ultimately wrong solution: | |
| Alter the port the script talks to from 8000 to 80: | |
| }).listen(80); |
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 fs = require('fs'); | |
| var lame = require('lame'); | |
| var Speaker = require('speaker'); | |
| fs.createReadStream(process.argv[2]) | |
| .pipe(new lame.Decoder()) | |
| .on('format', function (format) { | |
| this.pipe(new Speaker(format)); | |
| }); |
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 lru = require('lru-cache') | |
| , couchwatch = require('couchwatch') | |
| , request = require('request') | |
| ; | |
| function RegistryCache () { | |
| this.cache = lru() | |
| this.watch = couchwatch('http://isaacs.iriscouch.com/registry', -1) | |
| this.watch.on('row', function (change) { | |
| this.cache.del(change.id) |
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
| // data comes from here http://stat-computing.org/dataexpo/2009/the-data.html | |
| // download 1994.csv.bz2 and unpack by running: cat 1994.csv.bz2 | bzip2 -d > 1994.csv | |
| // 1994.csv should be ~5.2 million lines and 500MB | |
| // importing all rows into leveldb took ~50 seconds on my machine | |
| // there are two main techniques at work here: | |
| // 1: never create JS objects, leave the data as binary the entire time (binary-split does this) | |
| // 2: group lines into 16 MB batches, to take advantage of leveldbs batch API (byte-stream does this) | |
| var level = require('level') |
In August 2007 a hacker found a way to expose the PHP source code on facebook.com. He retrieved two files and then emailed them to me, and I wrote about the issue:
http://techcrunch.com/2007/08/11/facebook-source-code-leaked/
It became a big deal:
http://www.techmeme.com/070812/p1#a070812p1
The two files are index.php (the homepage) and search.php (the search page)
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
| /* Cranium MVC | |
| * A minimalist MVC implementation written for | |
| * demonstration purposes at my workshops | |
| * http://addyosmani.com | |
| * Copyright (c) 2012 Addy Osmani; Licensed MIT */ | |
| var Cranium = Cranium || {}; | |
| // Set DOM selection utility |
Last weekend I spent a few hours implementing the CouchDB document storage model on top of levelup in node.js.
Today I had a few spare hours in my Sunday and decided to implement the HTTP interface and compare the performance with Apach CouchDB. The benchmarks can be found here https://github.com/mikeal/couchup/tree/master/tests/benchmark
node compare-new-writes.js
Apache CouchDB 67140 writes
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
| /* Cranium MVC | |
| * A minimalist MVC implementation written for | |
| * demonstration purposes at my workshops | |
| * http://addyosmani.com | |
| * Copyright (c) 2012 Addy Osmani; Licensed MIT */ | |
| var Cranium = Cranium || {}; | |
| // Set DOM selection utility |