Skip to content

Instantly share code, notes, and snippets.

@iainmullan
iainmullan / geo_midpoint.php
Created July 17, 2014 09:42
Rough method for calculating a geographical midpoint, given a set of lat/lng pairs.
<?php
/**
* Rough method for calculating a geographical midpoint, given a set of lat/lng pairs.
* Assumes the earth is flat. This still gives a good approximation when deal with a small enough area.
* (eg. My use case is a handful of pubs in a particular part of town)
*/
function geo_midpoint($points) {
$lats = array();
$lngs = array();
@iainmullan
iainmullan / pitchfork200.json
Last active August 29, 2015 14:05
JSON data for Pitchfork's 200 best tracks of 2010-2014
[
{
"artist":"Father John Misty",
"title":"Hollywood Forever Cemetery Sings",
"pos":200,
"spotify_uri":"spotify:track:2as9DMML3RYe4uGiBpTvEm"
},
{
"artist":"Lindstr\u00f8m & Christabelle",
"title":"Lovesick",
@iainmullan
iainmullan / version_cmp.php
Created September 17, 2014 15:36
Compare version numbers of the format X.Y.Z (major.minor.patch)
<?php
/**
* Compare version numbers of the format X.Y.Z where X,Y,Z are non-negative integers
* Values with less than three parts will be padded out with zeros, eg. "1.1" becomes "1.1.0", "1" becomes "1.0.0"
*
* @return 1 if $a is greater (a later version) than $b, 0 if $a is equal to $b, -1 if $a is less (an earlier version) than $b
*
*/
function version_cmp($a, $b) {
@iainmullan
iainmullan / pitchfork-2014.json
Last active August 29, 2015 14:11
Pitchfork 100 Best Tracks of 2014
[
{
"artist":"Elisa Ambrogio",
"title":"Superstitious",
"pos":100
},
{
"artist":"Steve Gunn",
"title":"Milly's Garden",
"pos":99
### Keybase proof
I hereby claim:
* I am iainmullan on github.
* I am iainmullan (https://keybase.io/iainmullan) on keybase.
* I have a public key whose fingerprint is F6F1 22F1 7DE8 D09F E105 9792 65A0 B96A 6C65 8647
To claim this, I am signing this object: