Skip to content

Instantly share code, notes, and snippets.

View README.md

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 Aug 29, 2015
d3.scale.category20() randomizer
View d3.scale.category20.js
//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 Aug 29, 2015
Ubuntu 14.04 on Clevo W230ST set up
@1wheel
1wheel / index.html
Last active Aug 29, 2015
Video Capture
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Photobooth</title>
<style>
.blur {
-webkit-filter: blur(3px);
}
@1wheel
1wheel / headTails.js
Last active Sep 2, 2015
Head Tails Breaks
View headTails.js
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 Apr 15, 2012 — forked from plamere/FetchTrackAndAnalysisData.js
Syncing Echo Nest analysis to Spotify playback
View FetchTrackAndAnalysisData.js
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);