Skip to content

Instantly share code, notes, and snippets.

@fod
fod / ll2tz.pl
Created March 23, 2011 23:27
Get timezone from long-lat
use strict;
use warnings;
use 5.010;
use Geo::ShapeFile::Point comp_includes_m => 0, comp_includes_z => 0;
use Geo::ShapeFile;
### Requires TZ shapefile from http://efele.net/maps/tz/world/tz_world_mp.zip
### Limitations: Dog slow & only works if long lat point is over land
### Pass long and lat as command line args
@fod
fod / index.html
Created July 5, 2011 20:34 — forked from mbostock/.block
Zoomable Icicle
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Partition - Icicle</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js"></script>
<style type="text/css">
rect {
@fod
fod / index.html
Created July 5, 2011 20:36 — forked from mbostock/.block
Hierarchical Edge Bundling (D3)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.22.0"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?1.22.0"></script>
<script type="text/javascript" src="readme.js"></script>
<style type="text/css">
.node {
@fod
fod / index.html
Created July 5, 2011 20:37 — forked from mbostock/.block
Dependency Chord Diagram (D3)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Chord Diagram</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.22.1"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?1.22.1"></script>
<style type="text/css">
body {
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="0" />
<title>Line Chart</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.10.0"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.time.js?1.10.0"></script>
<script type="text/javascript" src="http://omf.mytestbed.net/projects/omf/repository/revisions/master/raw/omf-common/ruby/omf-common/web/tab/graph3/js/line_chart3.js"></script>
@fod
fod / index.html
Created July 7, 2011 16:22 — forked from mbostock/.block
Marimekko Chart
<!DOCTYPE html>
<html>
<head>
<title>Marimekko Chart</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.19.1"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?1.19.1"></script>
<style type="text/css">
body {
font: 10px sans-serif;
@fod
fod / index.html
Created July 8, 2011 14:39 — forked from mbostock/.block
d3.geo.tiler
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://github.com/mbostock/d3/raw/v1.8.4/d3.js"></script>
<script type="text/javascript" src="https://github.com/mbostock/d3/raw/v1.8.4/d3.geo.js"></script>
<script type="text/javascript" src="https://github.com/simplegeo/polymaps/raw/v2.4.0/polymaps.js"></script>
<script type="text/javascript" src="tiler.js"></script>
<style type="text/css">
@import url("http://github.com/simplegeo/polymaps/raw/v2.4.0/examples/example.css");
@fod
fod / README.mkd
Created July 10, 2011 22:25 — forked from RandomEtc/README.mkd
smooth panning and zooming for polymaps
@fod
fod / drag.js
Created July 11, 2011 15:53 — forked from g2010a/drag.js
Behaviors for D3 Visualization library
d3.behavior.drag = function() {
var x = 0,
y = 0,
listeners = [],
dragit
function drag() {
var container = this
.on("mousedown", mousedown)
@fod
fod / README.mkd
Created July 11, 2011 19:12 — forked from mbostock/.block
Fancy Markers

The default display for GeoJSON points in Polymaps is a 4.5px-radius circle. In this example, I show how to create more traditional pin-style markers for points. This is implemented using a “load” event handler which replaces the default circles with custom path elements.

The marker outline is courtesy of Dmitry Baranovskiy; he has graciously provided over 100 free vector icons to choose from. Of course, there’s no requirement to use vector icons. You could replace the circles with image elements instead, if you prefer raster. But the nice thing about vectors is that we can color them dynamically based on the data, as we do here by generating three categorical color gradients.