Skip to content

Instantly share code, notes, and snippets.

@jm
jm / test.rb
Created December 23, 2012 17:12
# Test File
class Test
def test() puts 'test'; nil
end
LOL = "Hello"
@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))
page.insert_html(:top, :phaseslist , sortable_element('phaseslist', :url => sort_projects_path, :handle => 'handle'), :partial => "project_phase", :object => @project_phase)
@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