Skip to content

Instantly share code, notes, and snippets.

View ashmckenzie's full-sized avatar

Ash McKenzie ashmckenzie

View GitHub Profile
@dapi
dapi / 20101219150921_add_typus_attributes_to_users.rb
Created December 19, 2010 18:20
Use Devise authentication for Typus 3.0
class AddTypusAttributesToUsers < ActiveRecord::Migration
def self.up
add_column :users, :role, :string
add_column :users, :status, :boolean, :null=>false, :default=>true
User.find(1).update_attribute(:role,'admin')
end
def self.down
remove_column :users, :role
remove_column :users, :status
anonymous
anonymous / rgeo-center.rb
Created December 11, 2012 23:13
Use RGeo to get the centre-point of a bounding box
require 'rgeo'
g = RGeo::Geographic.simple_mercator_factory
n, e, s, w = 50, 40, 10, 20
box = RGeo::Geographic::ProjectedWindow.bounding_points([g.point(w,s), g.point(e,n)])