Skip to content

Instantly share code, notes, and snippets.

View trengrj's full-sized avatar

John Trengrove trengrj

  • Brisbane, Australia
  • 03:11 (UTC +10:00)
View GitHub Profile
@trengrj
trengrj / notes.rb
Created January 18, 2015 09:44
smarter ls for a directory of text files
#!/usr/bin/ruby
require 'smart_colored/extend'
filter = nil
def usage
puts "usage: 'notes [filter]'"
end
# add some more command line options like -d for different directory

Roads, Nodes and Automobiles

or 'How a sat-nav could use a graph database'


@trengrj
trengrj / DrawPane.m
Created March 25, 2014 13:55
objective-c example of detecting way points
//
// A sample from DrawPane.m/h
// Created by John Trengrove
//
#import <UIKit/UIKit.h>
@class Letter;
@class Dot;
@class AppDelegate;
@trengrj
trengrj / hamming.c
Created March 25, 2014 13:23
compute first 1000 hamming numbers
/*
* Program to compute the first 1000 Hamming numbers.
* i.e. numbers of the form 3**i4**j5**k.
* Challenge from programming Praxis:
* http://programmingpraxis.com/2011/08/30/hamming-numbers/
*/
#include <stdio.h>
#include <stdlib.h>
@trengrj
trengrj / autofocus.js
Created March 25, 2014 13:16
really simple task manager internals
var autofocus = autofocus || {};
autofocus.tasks = [];
autofocus.colours = {};
autofocus.save = function() {
localStorage.tasks = JSON.stringify(autofocus.tasks);
}
autofocus.load = function() {
@trengrj
trengrj / turing.io
Created March 25, 2014 13:04
a turing machine simulator in the io language
// Simple representation of a turing machine
Machine := Object clone
Machine tape := list()
Machine rule := Map clone
Machine pos := 0
Machine state := nil
Machine moveLeft := method (