Skip to content

Instantly share code, notes, and snippets.

@vicapow
vicapow / README.md
Last active August 29, 2015 13:57
Responsive visualizations using Angular directives
@yaph
yaph / README.md
Last active August 29, 2015 13:57 — forked from mbostock/.block
Fork of mbostock's coastal counties map

This map shows the graph distance of each county from the Pacific or Atlantic coast; it is a recreation of a map posted to /r/dataisbeautiful using TopoJSON. Coastal counties are dark blue, while counties nine or more counties away from the coast are light yellow. (I opted not to reuse the original’s cycling color scale.)

See also the underlying graph.

@hanbzu
hanbzu / README.md
Last active August 29, 2015 13:57
Exponential water tank

This example aims to demonstrate our inability to fully grasp [exponential functions][wikg]. As [Albert Bartlett][barl] once said, "The greatest shortcoming of the human race is our inability to understand the exponential function." This little D3 animation is based on a paper by Dr Bartlett.

Our action hero, a pixelated version of [Chris Martenson][chrs], stands on a platform inside an empty 4000 litre water tank. At the very bottom of the tank lies a magic drop of water. Invisible to the eye now, it doubles in size every 10 seconds.

Although the growth rate is constant, for a long time we see no change. But there's a well known limit, the capacity of the tank. Once he realises that water is rising exponentially, poor pixellated Chris has no time left to react.

Our brains are wired to predict future behaviour based on past behaviour (see [here][psyc]). But what happens when something growths exponentially? For a long time, the numbers are so little in relation to the scale that we hardly see the ch

anonymous
anonymous / gist:3330773
Created August 12, 2012 09:13
d3.geo.greatArc() wrapping around map boundaries
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h2>
</h2>
<script type="text/javascript" src="d3.v2.min.js"></script>
<script type="text/javascript">
@endolith
endolith / anscombe.py
Created August 9, 2012 00:28
Demo of Anscombe's quartet in Python
# -*- coding: utf-8 -*-
"""
Demo of Anscombe's quartet in Python
Prints the return values from linregress to show that they're all identical
https://en.wikipedia.org/wiki/Anscombe's_quartet
"""
from matplotlib.pyplot import subplot, scatter, plot, axis
@swarminglogic
swarminglogic / subtlemark.sh
Last active December 1, 2015 21:53
Subtlemark: Tool for adding subtle watermarks to images. Parameter customization: position (TL,TC,TR,BL,BC,BR), font, font-size, caption, textcolor, bgcolor. Also supports predefined styles.
#!/bin/bash
version=0.1.4
versionDate="2014-09-02"
function showHelp() {
echo "subtlemark - add subtle watermarks to images
Usage:
----------------------------------------
@bmander
bmander / dotmap.pde
Created December 27, 2012 04:26
Generate dotmap tiles
/* I, Brandon Martin-Anderson, release this into the public domain or whatever. */
BufferedReader reader;
double ll, bb, rr, tt;
float A = 1000.0;
GlobalMercator proj = new GlobalMercator();
@yaph
yaph / pgsql_commands.sh
Last active December 11, 2015 20:49
Frequently used commands when working with postgresql databases on Ubuntu, like creating and deleting databases and users. https://help.ubuntu.com/community/PostgreSQL
# create user and database with user as admin
sudo -u postgres createuser -D -A -P uname
sudo -u postgres createdb -O uname dbname
# delete database and user
sudo -u postgres dropdb dbname
sudo -u postgres dropuser uname
# dump and import data
pg_dump --clean -U uname dbname > dump.sql
@yaph
yaph / favicon.sh
Created February 7, 2013 21:08
Create a favicon from a PNG file using the command line tool icotool, see http://www.nongnu.org/icoutils/ for documentation.
icotool -o favicon.ico -c favicon.png
@rveciana
rveciana / README.md
Last active December 20, 2015 20:48
Flag map with D3js

This example belongs to the GeoExamples blog entry Flag map with D3js.

Basically, gets the flag images from the Wikipedia by using Mike Bostock's queue.js library and adds them to the map.

The zone represented in the map

The region represented in the map is marked in red.

In this case, everything is drawn using the Canvas element.