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
@jm
jm / attr.rb
Created June 19, 2010 18:49 — forked from danielwellman/attr.rb
class ClassWithAttr
def self.my_attr_accessor(attr_name)
define_method("#{attr_name}=") do |arg|
instance_variable_set("@#{attr_name}", arg)
end
define_method(attr_name) do
instance_variable_get("@#{attr_name}")
end
end
m = mail(:to => "[email protected]", :from => "[email protected]", :body => "fail", :subject => "yeah")
m['X-Custom-Thing'] = whatever
page.insert_html(:top, :phaseslist , sortable_element('phaseslist', :url => sort_projects_path, :handle => 'handle'), :partial => "project_phase", :object => @project_phase)
#
# 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 $
#++
@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))
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.
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
@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
# encoding: UTF-8
module UniTest
class <<self
attr_accessor :test_cases
end
def self.run_tests
tc_instances = (test_cases || []).map {|tc| tc.new}
.grid_1 {
width: 80px;
}
.grid_2 {
width: 180px;
}
.grid_3 {
width: 280px;