Skip to content

Instantly share code, notes, and snippets.

module CustomColumnTypes
def double(*args)
if !args.last.is_a? Hash
args.push({})
end
args.last[:limit] = 53
float *args
end
// https://gist.github.com/Yaffle/1287361
var crc32table = null;
crc32 = function(s) {
s = String(s);
var polynomial = 0x04C11DB7,
initialValue = 0xFFFFFFFF,
finalXORValue = 0xFFFFFFFF,
crc = initialValue,
i, j, c;
@esromneb
esromneb / gist:5651374
Created May 26, 2013 01:11
Quick intro on how to do ajax on rails. This was simplified from my autocomplete code. In this example the autocomplete is removed and just ajax is presented.
#routes.rb
get 'scraped_episodes_search' => 'scraped_episodes#search'
#scraped_episodes_controller.rb
# used for autocomplete search
def search
@esromneb
esromneb / convert.m
Created August 20, 2012 09:46
Convert MKMapRect to CLRegion aka convert visible region of mapview to CLRegion
- (CLLocationDistance)getDistanceFrom:(CLLocationCoordinate2D)start to:(CLLocationCoordinate2D)end
{
CLLocation *startLoc = [[CLLocation alloc] initWithLatitude:start.latitude longitude:start.longitude];
CLLocation *endLoc = [[CLLocation alloc] initWithLatitude:end.latitude longitude:end.longitude];
CLLocationDistance retVal = [startLoc distanceFromLocation:endLoc];
[startLoc release];
[endLoc release];
return retVal;
}
@esromneb
esromneb / .gitconfig
Created June 14, 2012 23:13 — forked from roolo/.gitconfig
git-merge with KDiff3 on Mac OS X Lion
# This is file ~/.gitconfig
[merge]
tool = extMerge
[mergetool "extMerge"]
cmd = ~/bin/extMerge.sh \"$BASE\" \"$LOCAL\" \"$REMOTE\" -o \"$MERGED\"