Skip to content

Instantly share code, notes, and snippets.

View martinjc's full-sized avatar

Martin Chorley martinjc

View GitHub Profile
@martinjc
martinjc / .block
Last active February 2, 2024 06:49
D3 - Line chart, slider to choose year (Data: UK Unemployment rate)
license: MIT
border: no
@martinjc
martinjc / simpson.py
Created May 7, 2014 09:26
Simpson Diversity Index
#!/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 June 20, 2023 05:17
D3 force simulation, curved edges and hover interaction (Data: Twitter mentions between members of the Welsh Assembly)
license: mit
border: no
height: 1000
@martinjc
martinjc / .block
Last active December 22, 2022 17:37
D3 - Donut chart with labels and connectors (Data: random teaching evaluation survey results)
license: MIT
border: no
@martinjc
martinjc / .block
Last active May 11, 2022 14:21
D3 barchart with axes, scales and transitions (Data: randomly generated)
license: mit
border: no
@martinjc
martinjc / .block
Last active May 14, 2021 16:58
Simple bar chart (Data: randomly generated)
license: mit
border: no
@martinjc
martinjc / .block
Last active October 18, 2019 14:54
D3 force simulation with hover (Data: Twitter connections in Welsh Assembly)
license: mit
border: no
height: 1000
@martinjc
martinjc / .block
Last active September 25, 2019 15:20
D3 force network with curved edges (Data: Twitter relationships in the Welsh Assembly)
license: mit
border: no
height: 1000
@martinjc
martinjc / rk.py
Created May 29, 2019 21:08
Code to pull activity data out of Runkeeper API
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")
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