Skip to content

Instantly share code, notes, and snippets.

View sterrym's full-sized avatar

Tim Glen sterrym

  • Shopify Inc
  • Ontario, Canada
View GitHub Profile
define_builder(Country) do |klass, overrides|
# set up some presets
canada = { :iso => 'CA', :name => 'CANADA', :printable_name => 'Canada', :iso3 => 'CAN', :numcode => '124'}
usa = { :iso => 'US', :name => 'UNITED STATES', :printable_name => 'United States', :iso3 => 'USA', :numcode => '840' }
uk = { :iso => 'GB', :name => 'UNITED KINGDOM', :printable_name => 'United Kingdom', :iso3 => 'GBR', :numcode => '826' }
zimbabwe = { :iso => 'ZW', :name => 'ZIMBABWE', :printable_name => 'Zimbabwe', :iso3 => 'ZWE', :numcode => '716' }
# set up the default
country_attributes = canada
# check for a preset
overrides.process(:preset) do |preset|
document.observe("dom:loaded", function() {
tabs = new UpperTabs();
});
UpperTabs = Class.create({
sticky: new Array,
current: new Array,
menus: new Array,
submenus: new Array,
timer: null,
#!/bin/bash
# ec2-run-instances --key build --user-data-file ec2-userdata.sh --group default --group basic ami-ed46a784
set -e -x
export DEBIAN_FRONTEND=noninteractive
apt-get update && apt-get upgrade -y
# ruby
wget http://rubyforge.org/frs/download.php/58679/ruby-enterprise_1.8.6-20090610_i386.deb
class Charge < ActiveRecord::Base
CHARGE_TYPES = ["upload", "storage", "deposit"]
belongs_to :member
default_scope :order => "charges.updated_at DESC"
validates_presence_of :name, :unit_price, :quantity
validates_inclusion_of :charge_type, :in => CHARGE_TYPES
validates_inclusion_of :chargeable_type, :in => %w(Payment VideoUpload)
# Use Bundler (preferred)
begin
require File.expand_path('../../.bundle/environment', __FILE__)
rescue LoadError
require 'rubygems'
require 'bundler'
Bundler.setup
# To use 2.x style vendor/rails and RubyGems
#
# Edit this Gemfile to bundle your application's dependencies.
source 'http://rubygems.org'
gem "rails", "2.3.7"
#gem "mysql"
gem "sqlite3-ruby", :require => "sqlite3"
gem "authlogic", '2.1.4'
gem "aws-s3", "0.6.2", :require => "aws/s3"
# Don't change this file!
# Configure your app in config/environment.rb and config/environments/*.rb
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
module Rails
class << self
def boot!
unless booted?
preinitialize
class CreateRoles < ActiveRecord::Migration
def self.up
create_table :roles do |t|
t.string :name
t.string :role
t.timestamps
end
create_table :user_roles do |t|
t.references :user
class TheatresController < ApplicationController
def index
@theatre = Theatre.all
end
def new
@theatre = Theatre.new(params[:theatre])
end
def create
@sterrym
sterrym / _blog_post.html.erb
Created November 16, 2010 15:15
app/views/partials/_blog_post.html.erb
<%
# _counter is defined only if we pass :collection to the partial
if defined?(blog_post_counter)
showing_individual_post = false
else
showing_individual_post = true
blog_post_counter = 0
end
%>
<div id="blog_post_<%= blog_post.id %>" class="blog_post">