Skip to content

Instantly share code, notes, and snippets.

Avatar

John Goodall jgoodall

View GitHub Profile
View Makefile
-include .env
PROJECTNAME := $(shell basename "$(PWD)")
GO ?= go
GOBUILD := $(GO) build
GOARCH := amd64
BIN_DIR := ./bin
GOFILES := $(shell find . -name "*.go")
@jgoodall
jgoodall / README.md
Last active Mar 19, 2019
Download flag css and convert to 3 char country codes
View README.md

Download SVG country flags and css, then convert the codes from the iso 3166 two character codes to three character codes.

Usage

./get_flags.sh

Then copy the flag-icon.css file into public/css and the flags directory to public/.

View README.md

This stacked bar chart is constructed from a CSV file storing the populations of different states by age group. The chart employs conventional margins and a number of D3 features:

@jgoodall
jgoodall / README.md
Created Mar 7, 2014
This script will download web pages and spit out the title, url, and text in a separate file
View README.md

This script will download web pages and spit out the title, url, and text in a separate file.

Usage:

  1. Create a file articles with newline separated list of URLs to download
  2. Run python extract.py

Prerequisite: newspaper is used for text extraction. Install: pip install newspaper

@jgoodall
jgoodall / index.js
Last active Dec 27, 2015
[redis sorted sets](http://redis.io/commands#sorted_set) speed testing with [node-redis](https://github.com/mranney/node_redis). npm install -d node index.js
View index.js
/* globals require, console, process, setInterval */
'use strict';
var async = require('async')
, redis = require('redis')
, client = redis.createClient();
client.on('error', function(err) {
console.error(err);
});
@jgoodall
jgoodall / index.html
Created Sep 12, 2013
intro to d3: scatterplot with transitions
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.circle {
fill: steelblue;
stroke: '#fff';
}
.label {
fill: #777;
}
@jgoodall
jgoodall / index.html
Last active Dec 22, 2015
intro to d3: scatterplot using scales and axes
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.circle {
fill: steelblue;
stroke: '#fff';
}
.label {
fill: #777;
}
@jgoodall
jgoodall / index.html
Created Sep 12, 2013
intro to d3: basic scatterplot
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.circle {
fill: steelblue;
stroke: '#fff';
}
</style>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
@jgoodall
jgoodall / index.html
Last active Dec 22, 2015
intro to d3: dynamic properties
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
// 1. select all p elements (there are none)
// 2. then bind some data to the elements - data always expects an [array],
// d3's selectAll returns a placeholder since there are no p elements yet
// 3. do something with incoming data via the enter() method. since there are
@jgoodall
jgoodall / index.html
Last active Dec 22, 2015
intro to d3: skeleton
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
  
console.log('append the svg to the body of the page');
var svg = d3.select("body")
.append("svg")