Implementation of Jarke J. van Wijk and Wim A.A. Nuij's smooth and efficient zooming and panning for Polymaps.
Type a place name in the search box, top right, and hit "Go!" to fly there.
Implementation of Jarke J. van Wijk and Wim A.A. Nuij's smooth and efficient zooming and panning for Polymaps.
Type a place name in the search box, top right, and hit "Go!" to fly there.
// first of all make sure we have enough arguments (exit if not) | |
if (process.argv.length != 5) | |
{ | |
console.error("Usage: node csv2html.js input.csv template.ejs output.html") | |
console.error(); | |
console.error("Outputs the given template for each row in the given input.") | |
console.error("Uses the first row of the CSV as column names in the template.") | |
process.exit(1); | |
} |
var url = require('url'), | |
mongodb = require('mongodb'); | |
var sourceUrl = 'mongodb://user:pass@host:port/db', | |
targetUrl = 'mongodb://user:pass@host:port/db', | |
collectionName = 'my_awesome_collection'; | |
function openDbFromUrl(mongoUrl, cb) { | |
var dbUrl = url.parse(mongoUrl), | |
dbName = dbUrl.pathname.slice(1), // no slash |
// preserve Twitter's style of JSON string encoding... | |
// escape higher value unicode (lowercase hex) | |
// escape < and > (uppercase hex) | |
// escape / in strings (\/) | |
// hugs! https://gist.github.com/1306986 | |
// http://stackoverflow.com/questions/4901133/json-and-escaping-characters | |
function escapedStringify(s, emit_unicode) { | |
var json = JSON.stringify(s); | |
return emit_unicode ? json : json.replace(/\//g, | |
function(c) { |
// node.js geo polygon map tile rendering! | |
// requires https://github.com/learnboost/node-canvas and GeoJSON data files | |
// e.g. | |
// data from naturalearthdata.com converted to GeoJSON with GDAL's ogr2ogr | |
// or from datasf.org, reprojected too: | |
// ogr2ogr -f GeoJSON sfbay.js sfbay.shp -t_srs EPSG:4326 | |
var Canvas = require('./vendor/node-canvas/lib/canvas'), | |
http = require('http'), | |
fs = require('fs'); |
/* | |
An Albers Equal Area Conic projection in javascript, for protovis. | |
For centering the contiguous states of the USA in a 800x400 div, I used: | |
var scale = pv.Geo.scale(albers(23, -96, 29.5, 45.5)) | |
.range({ x: -365, y: -375 }, { x: 1200, y: 1200 }); | |
http://mathworld.wolfram.com/AlbersEqual-AreaConicProjection.html |
Key was generated using: | |
tom% openssl genrsa -des3 -out example.com.key 2048 | |
Generating RSA private key, 2048 bit long modulus | |
....+++ | |
..........................................................................................................................+++ | |
e is 65537 (0x10001) | |
Enter pass phrase for example.com.key: | |
Verifying - Enter pass phrase for example.com.key: | |
%tom |
australian-states.json | |
ne_10m_admin_1_states_provinces_lakes.geojson | |
ne_10m_admin_1_states_provinces_lakes.geojson.gz |
This animated bar chart is adapted from Mike Bostock's sample bar chart to allow redrawing and animated transitions.
Fine-grained control of randomly entering and exiting things in D3.js, for impeccable object constancy. Adapted from an example co-authored with Mike Bostock.