Skip to content

Instantly share code, notes, and snippets.

@vlandham
vlandham / README.md
Created March 19, 2012 19:25 — forked from mbostock/.block
Force Layout with Multiple Foci

Click to perturb or drag the nodes!

This example demonstrates the flexibility of D3's force layout. By using position Verlet integration, it is easy to add custom forces to a layout. In this example, the nodes are clustered around four foci using additional forces: the odd nodes are pushed down, the even nodes are pushed up, and a similar bisecting force is applied laterally. These custom forces are based purely on the index of the node, but they could just as easily be derived from properties of data!

@vlandham
vlandham / index.html
Created March 7, 2012 14:33 — forked from jasondavies/README.md
Zoom/pan map example: integrates d3.geo with d3.behavior with the aim of producing a map that can be panned and zoomed.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<!--
Zoom/pan map example: integrates d3.geo with d3.behavior with the aim of
producing a map that can be panned and zoomed.
Iain Dillingham, http://dillingham.me.uk/
-->
<title>Zoom/pan map example</title>
<script type="text/javascript" src="https://raw.github.com/mbostock/d3/master/d3.v2.min.js"></script>
@vlandham
vlandham / gist:1214151
Created September 13, 2011 15:41 — forked from caged/gist:1173725
d3.js experiment - Donuts, Bars and Crime.
#
# CoffeeScript for http://dealloc.me/demos/crime/2011.html
# Copyright (c) 2011 Justin Palmer <http://github.com/Caged>
# LICENSE: http://www.opensource.org/licenses/mit-license.php
$ ->
hash = document.location.hash
year = if hash then hash.replace('#', '') else 2011
[pt,pl,pb,pr] = [35, 20, 20, 20]
w = (900 - (pl + pr)) / 2
h = w
@vlandham
vlandham / install_homebrew.rb
Created June 2, 2011 15:16 — forked from mxcl/install_homebrew.markdown
Installs Homebrew to /usr/local so you don't need sudo to `brew install`
#!/usr/bin/ruby
#
# This script installs to /usr/local only. To install elsewhere you can just
# untar https://github.com/mxcl/homebrew/tarball/master anywhere you like.
#
#
# 30th March 2010:
# Added a check to make sure user is in the staff group. This was a problem
# for me, and I think it was due to me migrating my account over several
# versions of OS X. I cannot verify that for sure, and it was tested on
@vlandham
vlandham / gist:fc91ee2170af1fe759f8
Created June 7, 2014 04:16 — forked from anonymous/gist:831fdfa042057b85ebf0
processing for animated gif
void setup() {
size(500, 500);
smooth(8);
noStroke();
}
float t, tt, ht, x, y;
int N = 11;
float l = 24;
float sp = l*1.5;
@vlandham
vlandham / 0_reuse_code.js
Created June 2, 2014 13:46
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

A short code excerpt from this visualization I created for the longform article “Iouri Podladtchikov – You only fly once” by the Neue Zürcher Zeitung.

It's a very simple way to create an interactive animation based on video material. Hover over the image to go through the animation.

I used Final Cut Pro to export the frames of a short video sequence, which I then stitched together into a single film strip using ImageMagick: convert folder-of-stills/* +append filmstrip.jpg

@vlandham
vlandham / index.html
Last active August 27, 2015 16:31 — forked from tafsiri/index.html
2D Picking with canvas
<html lang="en">
<head>
<meta charset="utf-8">
<title>2D Picking with canvas</title>
<meta name="description" content="">
<meta name="author" content="Yannick Assogba">
<script src="//rawgit.com/mrdoob/stats.js/master/build/stats.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.5/dat.gui.js"></script>