Skip to content

Instantly share code, notes, and snippets.

Avatar

Martin Chorley martinjc

View GitHub Profile
@martinjc
martinjc / .block
Last active May 11, 2022
D3 barchart with axes, scales and transitions (Data: randomly generated)
View .block
license: mit
border: no
@martinjc
martinjc / simpson.py
Created May 7, 2014
Simpson Diversity Index
View simpson.py
#!/usr/bin/env python
# Simpson Diversity Index
# http://en.wikipedia.org/wiki/Diversity_index
# modified from Shannon Diversity Index implementation by audy
# https://gist.github.com/audy/783125
# https://gist.github.com/audy
def simpson_di(data):
@martinjc
martinjc / .block
Last active Jan 19, 2022
D3 - Donut chart with labels and connectors (Data: random teaching evaluation survey results)
View .block
license: MIT
border: no
@martinjc
martinjc / .block
Last active May 14, 2021
Simple bar chart (Data: randomly generated)
View .block
license: mit
border: no
@martinjc
martinjc / .block
Last active Mar 18, 2021
D3 force simulation, curved edges and hover interaction (Data: Twitter mentions between members of the Welsh Assembly)
View .block
license: mit
border: no
height: 1000
@martinjc
martinjc / .block
Last active Oct 18, 2019
D3 force simulation with hover (Data: Twitter connections in Welsh Assembly)
View .block
license: mit
border: no
height: 1000
@martinjc
martinjc / .block
Last active Sep 25, 2019
D3 force network with curved edges (Data: Twitter relationships in the Welsh Assembly)
View .block
license: mit
border: no
height: 1000
@martinjc
martinjc / rk.py
Created May 29, 2019
Code to pull activity data out of Runkeeper API
View rk.py
import os
import json
import time
import requests
from urllib.parse import urlencode, quote
from _credentials import client_id, client_secret, access_token
DATA_DIR = os.path.join(os.getcwd(), "data")
View tags_time.csv
tag day start end
Admin 0 9.0 11.0
Email 0 9.0 11.0
Admin 0 11.0 12.0
Email 0 11.0 12.0
Admin 0 12.0 13.0
Email 0 12.0 13.0
Preparation 0 13.0 14.0
Discussion 0 14.0 15.0
Meeting 0 14.0 15.0
@martinjc
martinjc / .block
Last active Dec 10, 2018
D3 - Bar chart, multiple datasets, using slider (Data: Number of roadside breath tests in UK per month)
View .block
border: no
license: MIT