Skip to content

Instantly share code, notes, and snippets.

@johnburnmurdoch
johnburnmurdoch / index.html
Last active Sep 24, 2015
Ceci n'est pas un dropdown
View index.html
<!DOCTYPE html>
<html>
<head>
<title>Ceci n'est pas un dropdown</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<style media="screen">
body{background-color:#fff1e0;font-size:16px;font-family:sans-serif;}
#container{width:100%;height:100%;min-height:500px;}
.ceci-nest-pas-un-dropdown{background-color:#e9decf;cursor:pointer;position:relative;font-size:14px;padding:1px 8px 3px 8px;border-radius:10px;border:1px solid #cec6b9;}
.ceci-nest-pas-un-dropdown:hover{background-color:#cec6b9;}
View migrants.R
library(SmarterPoland)
library(riverplot)
library(RColorBrewer)
library(graphics)
library(reshape2)
library(plyr)
library(stringr)
library(countrycode)
# DOWNLOAD THE DATA
@johnburnmurdoch
johnburnmurdoch / defaultData.csv
Last active May 28, 2020 — forked from phil-pedruco/defaultData.csv
3D Scatter Plot Using three.js
View defaultData.csv
x y z lp_x lp_y lp_z hp_x hp_y hp_z
0.235458 -0.597702 -0.724487 0.232433 -0.593757 -0.717156 0.003025 -0.003945 -0.007332
0.235458 -0.597702 -0.724487 0.232735 -0.594152 -0.717889 0.002723 -0.003550 -0.006598
0.217346 -0.597702 -0.724487 0.231197 -0.594507 -0.718549 -0.013850 -0.003195 -0.005939
0.217346 -0.579590 -0.724487 0.229812 -0.593015 -0.719143 -0.012465 0.013425 -0.005345
0.199234 -0.579590 -0.724487 0.226754 -0.591673 -0.719677 -0.027520 0.012083 -0.004810
0.199234 -0.597702 -0.760712 0.224002 -0.592276 -0.723781 -0.024768 -0.005426 -0.036931
0.163010 -0.579590 -0.706375 0.217903 -0.591007 -0.722040 -0.054893 0.011417 0.015665
0.108673 -0.597702 -0.724487 0.206980 -0.591676 -0.722285 -0.098307 -0.006026 -0.002203
0.090561 -0.615814 -0.724487 0.195338 -0.594090 -0.722505 -0.104777 -0.021724 -0.001982
View euPlayersCommented.R
# The packages we'll be using
packages <- c("rvest","dplyr","tidyr","pipeR","ggplot2","stringr","data.table")
# From those packages, which ones are not yet installed?
newPackages <- packages[!(packages %in% as.character(installed.packages()[,"Package"]))]
# If any weren't already installed, install them now
if(length(newPackages)) install.packages(newPackages)
# Now make sure all necessary packages are loaded
@johnburnmurdoch
johnburnmurdoch / data_.csv
Last active Mar 9, 2016
Share of minutes played broken down by nationality, across Premier League seasons
View data_.csv
seasonStart group total share barTops barBases
1 1992 Other EU 22536 0.024715160408366 0.024715160408366 0
2 1992 non-EU 41531 0.0455469172399649 0.070262077648331 0.024715160408366
3 1992 Ireland 63597 0.0697466301247273 0.140008707773058 0.070262077648331
4 1992 Rest of UK 146838 0.16103677334237 0.301045481115428 0.140008707773058
5 1992 England 637327 0.698954518884572 1 0.301045481115428
6 1993 Other EU 27526 0.0301765248869175 0.0301765248869175 0
7 1993 non-EU 62492 0.0685094599009391 0.0986859847878566 0.0301765248869175
8 1993 Ireland 54388 0.0596251120958247 0.158311096883681 0.0986859847878566
9 1993 Rest of UK 124047 0.135991694494204 0.294302791377885 0.158311096883681
@johnburnmurdoch
johnburnmurdoch / clubs_.csv
Last active Oct 27, 2019
Share of minutes played broken down by nationality, across Premier League clubs
View clubs_.csv
group total share clubName barTops barBases
1 England 14921 0.656474107967794 afc-bournemouth 0.656474107967794 0
2 Rest of UK 1896 0.0834176602578204 afc-bournemouth 0.739891768225615 0.656474107967794
3 Ireland 1591 0.0699986801003124 afc-bournemouth 0.809890448325927 0.739891768225615
4 non-EU 1035 0.045536539223019 afc-bournemouth 0.855426987548946 0.809890448325927
5 Other EU 3286 0.144573012451054 afc-bournemouth 1 0.855426987548946
6 England 2489 0.10993816254417 arsenal-fc 0.10993816254417 0
7 Rest of UK 1678 0.0741166077738516 arsenal-fc 0.184054770318021 0.10993816254417
8 non-EU 2611 0.115326855123675 arsenal-fc 0.299381625441696 0.184054770318021
9 Other EU 15862 0.700618374558304 arsenal-fc 1 0.299381625441696
View d3-jetpack-module.js
// https://github.com/1wheel/d3-jetpack-module Version 0.0.14. Copyright 2016 Adam Pearce.
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-selection'), require('d3-transition'), require('d3-axis'), require('d3-scale'), require('d3-collection'), require('d3-queue'), require('d3-request')) :
typeof define === 'function' && define.amd ? define(['exports', 'd3-selection', 'd3-transition', 'd3-axis', 'd3-scale', 'd3-collection', 'd3-queue', 'd3-request'], factory) :
(factory((global.d3 = global.d3 || {}),global.d3,global.d3,global.d3,global.d3,global.d3,global.d3,global.d3));
}(this, function (exports,d3Selection,d3Transition,d3Axis,d3Scale,d3Collection,d3Queue,d3Request) { 'use strict';
function translateSelection(xy) {
return this.attr('transform', function(d,i) {
return 'translate('+[typeof xy == 'function' ? xy.call(this, d,i) : xy]+')';
@johnburnmurdoch
johnburnmurdoch / .block
Last active Dec 21, 2020
Tool for creating virtual spray paint / masking tape art
View .block
height: 700
@johnburnmurdoch
johnburnmurdoch / .block
Last active Oct 15, 2017
Procedurally generated ribbons, using Bézier curve iterations
View .block
license: Apache-2.0
height: 900
border: no