This example shows how to use the d3.hexbin plugin for hexagonal binning on GoogleMaps. It is an update of Mike Bostock's Google Maps + D3 block.
This file contains 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
#!/bin/bash | |
# USAGE: | |
# ./svn-export revision-from revision-to repository target-directory | |
# ./svn-export 20 25 svn://localhost/myrepository . | |
if [ ! $1 ] || [ ! $2 ] || [ ! $3 ] || [ ! $4 ]; then | |
echo "Please enter a revision from, revision to, SVN repository, and target directory" | |
exit | |
fi |
This file contains 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
// Creating sound waves with JavaScript | |
// from http://js.do/blog/sound-waves-with-javascript/ | |
var samples = [] | |
// | |
// | |
// | |
// Achord |
This file contains 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
javascript:(function(){ | |
// avoid the bookmarklet activating more than once | |
if (window.MyNamespace) { | |
return; | |
} | |
window.MyNamespace = { }; | |
var version = 1, | |
script = document.createElement('script'); |
This file contains 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
// vanilla JS window width and height | |
var w=window, | |
d=document, | |
e=d.documentElement, | |
g=d.getElementsByTagName('body')[0], | |
x=w.innerWidth||e.clientWidth||g.clientWidth, | |
y=w.innerHeight||e.clientHeight||g.clientHeight; |
This file contains 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
function groupBy( array , f ) { | |
var groups = {}; | |
array.forEach( function( o ) | |
{ | |
var group = JSON.stringify( f(o) ); | |
groups[group] = groups[group] || []; | |
groups[group].push( o ); | |
}); | |
return Object.keys(groups).map( function( group ) | |
{ |
This scatterplot is constructed from a TSV file storing the dimensions of sepals and petals of various iris flowers. The chart employs conventional margins and a number of D3 features:
- d3.tsv - load and parse data
- d3.scale.linear - x- and y-position encoding
- d3.scale.ordinal - color encoding
- d3.extent - compute domains
- d3.svg.axis - display axes
This file contains 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
license: gpl-3.0 | |
height: 760 | |
border: no |
This file contains 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
/* bling.js */ | |
window.$ = document.querySelectorAll.bind(document); | |
Node.prototype.on = window.on = function (name, fn) { | |
this.addEventListener(name, fn); | |
} | |
NodeList.prototype.__proto__ = Array.prototype; |
This file contains 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
// FROM http://stackoverflow.com/questions/728360/most-elegant-way-to-clone-a-javascript-object | |
// When I had to implement general deep copying I ended up compromising by | |
// assuming that I would only need to copy a plain Object, Array, Date, String, | |
// Number, or Boolean. The last 3 types are immutable, so I could perform a | |
// shallow copy and not worry about it changing. I further assumed that any | |
// elements contained in Object or Array would also be one of the 6 simple | |
// types in that list. This can be accomplished with code like the following: | |
function clone(obj) { |
NewerOlder