Skip to content

Instantly share code, notes, and snippets.

View radiodario's full-sized avatar

Darío Villanueva radiodario

View GitHub Profile
@radiodario
radiodario / superagent.js
Last active May 18, 2016 15:45 — forked from pherris/superagent.js
Jest superagent mock
'use strict';
//mock for superagent - __mocks__/superagent.js
var mockDelay;
var mockError;
var mockResponse = {
status() {
return 200;
},
@radiodario
radiodario / README.md
Last active August 29, 2015 14:13 — forked from ndarville/README.md
body {
text-align: center;
}
.yay {
font-size: 70px;
}
@radiodario
radiodario / trimSouthEast.js
Last active December 24, 2015 14:09 — forked from mildfuzz/trimSouthEast.js
Helping fuzzy at #node.js work with imagemagick
var spawn = require('child_process').spawn;
var fs = require('fs');
var os = require('os');
exports.trimSouthEast = function(file, i){
/*
* Trims the bottom and right edges
*/
var origFile = process.cwd() + '/' + file;
// On index.js
//Configure Body Parser
app.configure(function() {
app.use(express.cookieParser())
app.use(express.session({
key: "QAWdefrAQ",
secret: 'asfyvhq987ertvyweiurytsdfgadekjr4yhtfsdfgt9jfwe3ht987234yh'
}))
app.use(express.bodyParser())

This examples demonstrates how to use D3's brush component to implement focus + context zooming. Click and drag in the small chart below to pan or zoom.

# Truly the most ridiculous thing I could think of.
doInstall <- TRUE # Change to FALSE if you don't want packages installed.
toInstall <- c("XML", "png", "devtools", "RCurl")
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
# Some helper functions, lineFinder and makeTable
source_gist("818983")
source_gist("818986")
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

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.