Skip to content

Instantly share code, notes, and snippets.

@1wheel
1wheel / README.md
Last active August 29, 2015 14:08 — forked from mbostock/.block

This choropleth encodes unemployment rates from 2008 with a quantize scale ranging from 0 to 15%. A threshold scale is a useful alternative for coloring arbitrary ranges.

@1wheel
1wheel / d3.scale.category20.js
Last active August 29, 2015 14:11
d3.scale.category20() randomizer
//paste in the console to swap out the d3.scale.category20() pallet
var oldColors = oldColors ? oldColors : d3.scale.category20().range()
var newColors = oldColors.map(function(){
return '#'+Math.floor(Math.random()*16777215).toString(16) })
oldColors.forEach(function(str, i){
//update inline color style
d3.selectAll('[style*="' + str + '"]')
.style('fill', newColors[i])
.style('background-color', newColors[i])
@1wheel
1wheel / README.md
Last active August 29, 2015 14:12
Ubuntu 14.04 on Clevo W230ST set up
@1wheel
1wheel / index.html
Last active August 29, 2015 14:22
Video Capture
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Photobooth</title>
<style>
.blur {
-webkit-filter: blur(3px);
}
@1wheel
1wheel / readme.md
Last active August 29, 2015 14:25
NYC-D3
@1wheel
1wheel / README.md
Last active August 29, 2015 14:25
Scatter I
@1wheel
1wheel / README.md
Last active September 1, 2015 16:58
Scatter II
@1wheel
1wheel / README.md
Last active September 1, 2015 16:58
Scatter III
@1wheel
1wheel / headTails.js
Last active September 2, 2015 15:54
Head Tails Breaks
function headTails(a, n){
var breaks = []
while(a.length){
var avg = mean(a)
breaks.push(avg)
a = a.filter(function(d){ return d > avg })
}
return breaks
}
@1wheel
1wheel / FetchTrackAndAnalysisData.js
Created April 15, 2012 04:36 — forked from plamere/FetchTrackAndAnalysisData.js
Syncing Echo Nest analysis to Spotify playback
function fetchSongInfo(track) {
info('Getting song info for ' + track.name + ' by ' + track.artists[0].name);
var url = 'http://developer.echonest.com/api/v4/track/profile?api_key=N6E4NIOVYMTHNDM8J&callback=?';
var track_id = fromSpotify(track.uri);
$.getJSON(url, { id: track_id, format:'jsonp', bucket : 'audio_summary'}, function(data) {
if (checkResponse(data)) {
info("");
showTrackInfo(data.response.track);
fetchAnalysis(data.response.track);