Skip to content

Instantly share code, notes, and snippets.

View LuisSevillano's full-sized avatar

Luis Sevillano LuisSevillano

View GitHub Profile
library(SmarterPoland)
library(riverplot)
library(RColorBrewer)
library(graphics)
library(reshape2)
library(plyr)
library(stringr)
library(countrycode)
# DOWNLOAD THE DATA
@nitaku
nitaku / README.md
Last active December 2, 2015 00:27
Tape chart (interactive)
@pramsey
pramsey / pgsql-parallel-postgis.md
Last active December 6, 2015 21:04
Parallel Sequence Scan and PostGIS
@patriciogonzalezvivo
patriciogonzalezvivo / tripMaker.py
Last active May 13, 2016 15:11
Make a GeoJson line from point A to point B using mapzen's Valhalla routing engine
#!/usr/bin/env python
import requests, json, sys
import geojson
#six degrees of precision in valhalla
inv = 1.0 / 1e6;
#decode an encoded string
def decode(encoded):
@benib
benib / orakel.js
Created May 18, 2016 15:41
NZZ Euro 2016 Orakel Algorithmus
/*
NZZ Euro 2016 Orakel
http://nzz.ch/-ld.17757
The algorithm
this works like this:
@armollica
armollica / README.md
Last active August 15, 2016 14:58
Convert SVG to Image

Convert SVG to an image on-the-fly.

This article from MDN explains the process of rendering a DOM object on a canvas element: Drawing DOM object into a canvas. Rendering to an <img> element is very similar. This works for any DOM object, not just SVG. Not sure if this is well supported by older browsers. Works on Chrome, Firefox and IE 10 for me. The bar chart is a fork of this block by Mike Bostock: Canvas Bar Chart.

@milkbread
milkbread / d3.v3.min.js
Last active September 2, 2016 00:45
Test point in triangle
!function(){function n(n,t){return t>n?-1:n>t?1:n>=t?0:0/0}function t(n){return null!=n&&!isNaN(n)}function e(n){return{left:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)<0?r=i+1:u=i}return r},right:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)>0?u=i:r=i+1}return r}}}function r(n){return n.length}function u(n){for(var t=1;n*t%1;)t*=10;return t}function i(n,t){try{for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}catch(r){n.prototype=t}}function o(){}function a(n){return ha+n in this}function c(n){return n=ha+n,n in this&&delete this[n]}function s(){var n=[];return this.forEach(function(t){n.push(t)}),n}function l(){var n=0;for(var t in this)t.charCodeAt(0)===ga&&++n;return n}function f(){for(var n in this)if(n.charCodeAt(0)===ga)return!1;return!0}function h(){}function g(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function p(n,
@milkbread
milkbread / d3.v3.min.js
Last active September 2, 2016 00:46
Testing quadtrees
!function(){function n(n,t){return t>n?-1:n>t?1:n>=t?0:0/0}function t(n){return null!=n&&!isNaN(n)}function e(n){return{left:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)<0?r=i+1:u=i}return r},right:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)>0?u=i:r=i+1}return r}}}function r(n){return n.length}function u(n){for(var t=1;n*t%1;)t*=10;return t}function i(n,t){try{for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}catch(r){n.prototype=t}}function o(){}function a(n){return ha+n in this}function c(n){return n=ha+n,n in this&&delete this[n]}function s(){var n=[];return this.forEach(function(t){n.push(t)}),n}function l(){var n=0;for(var t in this)t.charCodeAt(0)===ga&&++n;return n}function f(){for(var n in this)if(n.charCodeAt(0)===ga)return!1;return!0}function h(){}function g(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function p(n,
@milkbread
milkbread / d3.v3.min.js
Last active September 2, 2016 00:47
Find intersections of a line segment and a circle
!function(){function n(n){return null!=n&&!isNaN(n)}function t(n){return n.length}function e(n){for(var t=1;n*t%1;)t*=10;return t}function r(n,t){try{for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}catch(r){n.prototype=t}}function u(){}function i(n){return aa+n in this}function o(n){return n=aa+n,n in this&&delete this[n]}function a(){var n=[];return this.forEach(function(t){n.push(t)}),n}function c(){var n=0;for(var t in this)t.charCodeAt(0)===ca&&++n;return n}function s(){for(var n in this)if(n.charCodeAt(0)===ca)return!1;return!0}function l(){}function f(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function h(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.substring(1);for(var e=0,r=sa.length;r>e;++e){var u=sa[e]+t;if(u in n)return u}}function g(){}function p(){}function v(n){function t(){for(var t,r=e,u=-1,i=r.length;++u<i;)(t=r[u].on)&&t.apply(this,arguments);return n}var e=[],r=new u;return t.on=function(t,u){var i,o=r.get(t);return arguments
@lucguillemot
lucguillemot / README.md
Last active September 18, 2016 17:43
Scatterplot using two ordinal scales

This is a scatterplot using two ordinal scales and the RangePoints() function, with data showing the country of origin of films in competition at the Cannes film festival since 2006.