Skip to content

Instantly share code, notes, and snippets.

View mikeando's full-sized avatar

Mike Anderson mikeando

  • DownUnder GeoSolutions
  • Perth
View GitHub Profile
@mikeando
mikeando / fiddle.css
Created June 2, 2011 03:51
Javascript data bindings via closures
We couldn’t find that file to show.
@mikeando
mikeando / fiddle.css
Created June 2, 2011 03:14
Javascript data bindings using closures
We couldn’t find that file to show.
@mikeando
mikeando / fast_sin.cpp
Created May 24, 2011 10:03
fast sine approximations
#include <math.h>
#include <stdio.h>
// P Found using maxima
//
// y(x) := 4 * x * (%pi-x) / (%pi^2) ;
// z(x) := (1-p)*y(x) + p * y(x)^2;
// e(x) := z(x) - sin(x);
// solve( diff( integrate( e(x)^2, x, 0, %pi/2 ), p ) = 0, p ),numer;
//
@mikeando
mikeando / prepare-commit-msg.py
Created May 18, 2011 04:15
Simple git prepare-commit-msg
import sys
import subprocess
import re
# A normal commit will just have two arguments, this filename and the filename
# of the commit message we want to change. Any other kind of commit we'll be
# cowardly about and just leave as is.
if len(sys.argv)!=2 :
sys.exit(0)
@mikeando
mikeando / include_grapher.py
Created September 24, 2010 04:24
Source code include visualiser for c++
#!/usr/bin/python
import sys
import os.path
import re
# Use this like this:
# cppfind . -l autogen | grep -v test | python include_grapher.py | neato -otest3.pdf -Tpdf -Goverlap=scale -Gstart=rand
# you can replace neato with dot or any of the other graphvis commands
# What the example does is finds all files using autogen in them anywhere, and graphs who includes what (directly)
#ifndef ma_concurrent_queue_h
#define ma_concurrent_queue_h
// Based on code from http://www.justsoftwaresolutions.co.uk/threading/implementing-a-thread-safe-queue-using-condition-variables.html
// Original version by Anthony Williams
// Modifications by Michael Anderson
#include "boost/thread.hpp"
#include <deque>