Skip to content

Instantly share code, notes, and snippets.

View jm's full-sized avatar
💫
Livin' life. Or something.

Jeremy McAnally jm

💫
Livin' life. Or something.
View GitHub Profile
» 3.6GHz quad core Intel E2-1230
» IPMI/KVM: Included free of charge! Full remote control/reboot/OS reload.
» Hardware Firewall: No thanks
» Anti SPAM Device: No thanks
» Hard Drives: 2x 2TB Monthly Upgrade Fee (1 free, 1 additional) $30.00 USD
» SSD Drives: No SSD Drive (Allows 4 Hard Drives)
» IP Addresses: 5 Usable IPs $5.00 USD
» Bandwidth: 20,000GB (20TB) on 1 Gigabit Port $15.00 USD
» RAM: 16GB DDR-3 ECC
» Management: Unmanaged, no support
# Let's say I have two AR models...
class Cabinet < ActiveRecord::Base
has_many :files, :class_name => "CabinetFile"
end
class CabinetFile < ActiveRecord::Base
belongs_to :cabinet, :inverse_of => :files, :counter_cache => true
end
.grid_1 {
width: 80px;
}
.grid_2 {
width: 180px;
}
.grid_3 {
width: 280px;
# encoding: UTF-8
module UniTest
class <<self
attr_accessor :test_cases
end
def self.run_tests
tc_instances = (test_cases || []).map {|tc| tc.new}
@jm
jm / gist:1146838
Created August 15, 2011 14:15
Hoedown 2011 Schedule
RUBY HOEDOWN 2011
Day 1
-----
8:00 - Registration opens
9:00 - Kickoff with The Improv Effect
10:00 - TorqueBox: A True Application Server for Ruby
alloy:remix alloy$ rake db:create
dyld: lazy symbol binding failed: Symbol not found: _mysql_get_client_info
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle
Expected in: flat namespace
dyld: Symbol not found: _mysql_get_client_info
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle
Expected in: flat namespace
Trace/BPT trap
NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::Specification#default_executable= called from /Library/Ruby/Gems/1.8/specifications/rubygems-update-1.8.2.gemspec:11.
@jm
jm / gist:736484
Created December 10, 2010 17:11 — forked from gisikw/gist:736483
class Outlay < ActiveRecord::Base
def self.budget(scopes = {}, pivot_value = nil)
pivot_value ||= "top_10_competitors"
projection_value = {}.tap do |projection|
pvs = Outlay.pivot_values(pivot_value, scopes)
pvs.each do |pivot|
projection[pivot] = {}
pivot_scopes = ({(pivot_value=="top_10_competitors" ? "contractor" : pivot_value) => pivot}.merge(scopes))
#
# things.rb - a superfun time library
#
# Author: Jeremy McAnally 1998-2010
#
# Documentation: Mr. Jeremy McAnally
#
#--
# $Id: things.rb,v 2.22 2009-01-17 20:16:31+09 tadf Exp $
#++
page.insert_html(:top, :phaseslist , sortable_element('phaseslist', :url => sort_projects_path, :handle => 'handle'), :partial => "project_phase", :object => @project_phase)