Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am lukewilkins on github.
* I am lukewilkins (https://keybase.io/lukewilkins) on keybase.
* I have a public key whose fingerprint is D485 640F 3D6B 35DE 17DF 9FA4 DDC3 2819 37F3 7CF2
To claim this, I am signing this object:
@lukewilkins
lukewilkins / git_gc_configs
Created February 26, 2013 14:51
Git configs to prevent "git gc" from running out of memory
git config pack.threads 1
git config pack.deltaCacheSize 1
git config core.packedGitWindowSize 16m
git config core.packedGitLimit 128m
git config pack.windowMemory 512m
@lukewilkins
lukewilkins / gist:3655943
Created September 6, 2012 12:51
Geolocation radius example
public static function geo_events($d = 25, $location = null)
{
if (is_null($location)) $location = Locate::get();
$r = 3959;
$lat_n = rad2deg(asin(sin(deg2rad($location['lat'])) * cos($d / $r) + cos(deg2rad($location['lat'])) * sin($d / $r) * cos(deg2rad(0))));
$lat_s = rad2deg(asin(sin(deg2rad($location['lat'])) * cos($d / $r) + cos(deg2rad($location['lat'])) * sin($d / $r) * cos(deg2rad(180))));
$lng_e = rad2deg(deg2rad($location['lng']) + atan2(sin(deg2rad(90)) * sin($d / $r) * cos(deg2rad($location['lat'])), cos($d / $r) - sin(deg2rad($location['lat'])) * sin(deg2rad($lat_n))));
$lng_w = rad2deg(deg2rad($location['lng']) + atan2(sin(deg2rad(270)) * sin($d / $r) * cos(deg2rad($location['lat'])), cos($d / $r) - sin(deg2rad($location['lat'])) * sin(deg2rad($lat_n))));