Skip to content

Instantly share code, notes, and snippets.

View trengrj's full-sized avatar

John Trengrove trengrj

  • Brisbane, Australia
  • 03:09 (UTC +10:00)
View GitHub Profile
d3.json('/data/bvg-graph.json', function(json){
var width = 740,
height = 600;
var svg = d3.select('svg')
.style("display", "block")
.attr('width', width)
.attr('height', height);
var chart = circularHeatChart()
.numSegments(24)
.radialLabels(["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"])
.segmentLabels(["Midnight", "1am", "2am", "3am", "4am", "5am", "6am", "7am", "8am", "9am", "10am", "11am", "Midday", "1pm", "2pm", "3pm", "4pm", "5pm", "6pm", "7pm", "8pm", "9pm", "10pm", "11pm"])
.margin({top: 20, right: 0, bottom: 20, left: 80})
.innerRadius(30)
.segmentHeight(20)
.range(["orange", "magenta"])
var data = [];
var colours = [0xCD853F, 0x191970, 0xDAA520];
var container;
var camera, scene, projector, renderer;
var particleMaterial;
var width = 740;
var height = 350;
var objects = [];
function init() {
container = $("#webgl");
var redElectron = {
theta: 0,
draw: function() {
if (redElectron.theta > Math.PI*2) {
redElectron.theta = 0;
}
if (redElectron.theta > Math.PI) {
var removed = d3.selectAll('.red-electron').remove();
d3.selectAll('.red-far').append(function() {
return removed.node();
var width = 740,
height = 550;
var projection = d3.geo.mercator()
.translate([375, 330])
.scale(160)
var color = d3.scale.linear()
.domain([0, 1500000])
.range(["#ffcc00", "red"])
var moment = require('moment');
var data = require('./one-week.json');
var t = {};
data.forEach(function(d) {
var segments = d.segments;
segments.forEach(function(s) {
var activities = s.activities;
activities.forEach(function(a) {
var calendar = new CalHeatMap();
calendar.init({
data: "/data/moves.json",
start: new Date(2014, 9, 9),
domain : "day",
subDomain : "hour",
itemName: ["step","steps"],
range : 7,
});
22 serialization::archive 12 0 3 0 1 0 0 0 0 0 0 7 0 0 0 5 1 0
0 0 1 1 0
1 0 0 1 1 0 1 10 1 5
2 0 0 117 1 0 1 0.00000000000000000e+00 6.33011834037708332e-02 0.00000000000000000e+00 6.33011834037708332e-02 0.00000000000000000e+00 6.33011834037708332e-02 0.00000000000000000e+00 6.33011834037708332e-02 4.32869311569750170e-03 6.75822492130261354e-02 8.65828485981845475e-03 7.18637643364932188e-02 1.29869779755159565e-02 7.61452794599602467e-02 1.73156710912134582e-02 8.04263452692156044e-02 2.16452628353344112e-02 8.47078603926826323e-02 2.59739559510319129e-02 8.89889262019379901e-02 3.03035476951528659e-02 1.01833022258127404e-01 3.46322408108504232e-02 1.27521214370506286e-01 3.89609339265479249e-02 1.66053502539074638e-01 4.76192187863663796e-02 2.21711401887299431e-01 5.62775036461848344e-02 2.77368851921312498e-01 6.49348898775798378e-02 3.15901140089880794e-01 7.35931747373982925e-02 3.75840554561572671e-01 8.22514595972167473e-02 4.57186196707964621e-01 9.52384375727327592e-02 5.17125161865444771e-01 1.
@trengrj
trengrj / todo.sh
Last active May 28, 2017 17:00
todo application using ed
#!/bin/bash
TODOFILE=~/.plan
case "$1" in
add)
printf '%s\n' a "$2 []" . w | ed -s $TODOFILE
;;
delete)
printf '%s\n' "$2d" w | ed -s $TODOFILE
;;
[trengrj@home ~]$ todo add "write this blog post"
[trengrj@home ~]$ todo add "add colours to todo"
[trengrj@home ~]$ todo
1 write this blog post []
2 add colours to todo []
[trengrj@home ~]$ todo complete 1
[trengrj@home ~]$ todo
1 write this blog post [x]
2 add colours to todo []
[trengrj@home ~]$ todo delete 1