Skip to content

Instantly share code, notes, and snippets.

View matt-in-a-hat's full-sized avatar

Matt Lang matt-in-a-hat

  • Christchurch, New Zealand
View GitHub Profile
@matt-in-a-hat
matt-in-a-hat / nztadetour-api-example.json
Created September 9, 2020 04:50
NZTA detour API example
[
{
"activeTrafficManagement": null,
"activeTrafficManagementFlag": "Unknown",
"detourName": "State Highway 39!",
"startLocation": "Te Tahi Road",
"endLocation": "State Highway 39",
"journeyTime": 14.44,
"journeyLength": 8.65,
"extraJourneyTime": "0-10 mins",
[
{
"id": 131,
"title": "Roadworks",
"location_description": "Test incident about burst water mains on Somerfield st.",
"route_affected_impact": "Expect delays",
"starts_at": "2018-10-26T00:49:00.000Z",
"status": "Official",
"location": {
"type": "Feature",
@matt-in-a-hat
matt-in-a-hat / Default (OSX).sublime-keymap
Created November 1, 2017 03:00
Sublime custom settings and key mapping
[
// Selects all instances of current selection. This already exists under ctrl+super+g but is hard to press/remember, whereas this is just an extension of super+a (select all), add shift to select duplicates.
{ "keys": ["super+shift+a"], "command": "find_all_under" },
// Converts all tabs to spaces and sets indentation for the file to spaces.
{ "keys": ["super+shift+i"], "command": "expand_tabs", "args": { "set_translate_tabs": true } },
// Unbinds Quit so that I don't accidentally close everything when trying to close 1 file (super+w). If the whole window closes I also lose undo history, which can be annoying.
{ "keys": ["super+q"], "command": "unbound" },
// Toggles word-wrap on/off. You can also force it to default on/off in settings.
{ "keys": ["alt+w"], "command": "toggle_setting", "args": { "setting": "word_wrap" } },
// Opens Goto with @ which targets function names.
@matt-in-a-hat
matt-in-a-hat / night-rider.js
Last active August 29, 2015 14:17
Night Rider theme for Johnny Five Piezo
// The notes for Night Rider theme we used with
// https://github.com/rwaldron/johnny-five/#piezo on a node bot http://nodebots.io/
// Loop bar1, bar1, bar2, bar2
// And over top (after the intro) play the main riff.
var bar1 = {
song: [
['C#4', 2 / 4],
[null, 1 / 16],
@matt-in-a-hat
matt-in-a-hat / gist:52abaf1d213bc4506ddc
Created February 27, 2015 01:13
A very crude Darude - Sandstorm for Substack's http://studio.substack.net
// Darude - Sandstorm
// For http://studio.substack.net/
return function (t) {
function sin (x) { return Math.sin(2 * Math.PI * t * x) }
var b = 0.25;
var beatFn = t % 1 < b*3 ? fastBeep : sustainedBeep
var pitch