Skip to content

Instantly share code, notes, and snippets.

View radiodario's full-sized avatar

Darío Villanueva radiodario

  • London
View GitHub Profile
@radiodario
radiodario / gist:943982
Created April 27, 2011 09:38
Updating things
Wish.find({}).sort('created_time', -1).execFind( function(err, data){
data.forEach( function (wish) {
console.log(wish.message);
geo.geocoder(geo.google, wish.location.name, false, function(formattedAddress, latitude, longitude) {
console.log('address: ' + wish.location.name + " resolved to " + formattedAddress + " (" + latitude + ', ' + longitude + ")" );
wish.location.lat = latitude;
wish.location.lng = longitude;
console.log('\t->' + wish.doc.location.lat + ', ' + wish.doc.location.lng);
wish.save(function(err) {
if (err)
@radiodario
radiodario / gist:944045
Created April 27, 2011 10:39
This jade template is outputting all of the children of head onto the body
!!! 5
html
head
title= title
script(type='text/javascript', src='/javascripts/jquery-1.5.2.min.js')
script
var wishes = !{JSON.stringify(wishes)};
script
// update birthday wishes
setInterval(function() {
@radiodario
radiodario / index.html
Created October 29, 2012 23:12 — forked from enjalot/index.html
d3 behavior.drag example
<!DOCTYPE html>
<html>
<head>
<title>Chernoff Smileys</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.5.0"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?2.5.0"></script>
<style type="text/css">
</style>
</head>
@radiodario
radiodario / index.html
Created November 10, 2012 16:05 — forked from zmaril/index.html
d3 bootstrap tooltips
<!doctype html>
<head>
<style>
body {
font: 10px sans-serif;
}
#main {
left: 25%;
position: absolute;
}
@radiodario
radiodario / index.html
Created December 9, 2012 21:25 — forked from enjalot/index.html
d3 behavior.drag example
<!DOCTYPE html>
<html>
<head>
<title>Chernoff Smileys</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.5.0"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?2.5.0"></script>
<style type="text/css">
</style>
</head>
@radiodario
radiodario / README.md
Last active December 8, 2016 08:04 — forked from dfm/LICENSE
Here's to a nice 2013

These are google searches for 'Old Lang Syne' since 2004. Seems to be popular around this time of the year.

@radiodario
radiodario / index.html
Last active December 10, 2015 22:18 — forked from huroh/index.html
Complex geoJson shape transformation
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
@import url("http://polymaps.org/style.css");
html, body {
height: 100%;
Backbone.sync = function(method, model, options) {
// we need to make sure we initialize a store, in this case
// we will just use a JS object.
var cache = {};
// The size will be primarily used to assign ids to newly
// created models. Each time a new model is created, the size
// will be incremented.
var size = 0;

Have you ever seen these scatterplots that report a significant correlation between X and Y, but it looks like it's just the one point to the upper-right driving the correlation? Thanks to this interactive tool, you too can do this at home. Click anywhere in the picture, and the red dot will move. The sliding bar displays the resulting correlation coefficient. The grey interval are non-significant values: place the red dot right to get a significant result.

Data are generated from two standard independent gaussian (N=15). Test values are from the asymptotic Fisher transformation test that's on Wikipedia (two-sided, alpha = 5%). Code: R and d3.js.

function img2table( img ){
var canvas = document.createElement('canvas')
, ctx = canvas.getContext('2d')
, table = document.createElement('table')
, width = canvas.width = img.width
, height = canvas.height = img.height
, pixels
, i, j, l1, l2
, tr, td, r, g, b