Skip to content

Instantly share code, notes, and snippets.

View onewland's full-sized avatar

Oliver Newland onewland

  • San Francisco, CA
View GitHub Profile
# Never Again.
def link_tree(location, options=nil)
return "" unless location
options ||= {}
max_depth = options[:max_depth] || 5
partial = options[:partial] || "shared/location_subtree"
loc_tree = []
max_depth.times do
loc_tree << {}
@onewland
onewland / .vimrc
Created September 25, 2010 17:05
au FileType c set ts=4
au FileType c set shiftwidth=4
au FileType ruby set expandtab
au FileType ruby set shiftwidth=2
require 'rubygems'
require File.join( File.dirname(__FILE__), '..', 'lib', 'carmen_sandiego.rb' )
detective = CarmenSandiego::Detective.new('GeoAPI API Key')
results = detective.search do |q|
q.radius 500
q.radius_unit :m
q.lat 27.93547
q.lng -82.50429
if condition
result
end
# result can be any type, condition can be any type; anything that's not false or nil is considered true
#!/usr/bin/ruby
latest_migration = Dir.entries('db/migrate/').select{ |fname| fname =~ /^\d{14}/ }.sort.last
exec "$EDITOR db/migrate/#{latest_migration}"
@onewland
onewland / cron-test.js
Created November 18, 2009 21:35 — forked from fwg/cron-test.js
corrected cron.js
// Sample for http://oliveriskindoffunny.tumblr.com/post/247975858/implementing-a-user-friendly-cron-module-with-node-js
var cron = require('./cron'), sys = require('sys');
cron.Every((2).seconds(), function() { sys.puts('Working!'); });
@onewland
onewland / cron-test.js
Created November 18, 2009 03:19
simple cron API for node.js
var cron = require('./cron'), sys = require('sys');
cron.Every((2).seconds(), function() { sys.puts('Working!'); });
function TimeInterval() {
this.seconds = 0;
this.addTo = function(ti) {
this.seconds += ti.seconds;
return this;
}
}