Skip to content

Instantly share code, notes, and snippets.

View seeflanigan's full-sized avatar

Cory Flanigan seeflanigan

View GitHub Profile
class Order < ActiveRecord::Base
Rake::FileList["lib/import_layout_*.rb"].each { |f|
require f
}
set_table_name 'ap_order_upload'
belongs_to :distributor
belongs_to :school
# Join syntax to get Authorizations, UMC, Issues, etc.
module SimpleGemDependecyChecker
class << self
def initialize
require_libraries
system_gems = get_installed_gems
required_gems = get_required_gems
verify_gems(required_gems, system_gems)
end
def require_libraries
/home/c/.rvm/gems/ruby-1.8.7-p248/gems/factory_girl-1.2.3/lib/factory_girl/factory.rb:320:in `factory_by_name': No such factory: prize_list (ArgumentError)
from /home/c/.rvm/gems/ruby-1.8.7-p248/gems/factory_girl-1.2.3/lib/factory_girl/factory.rb:260:in `create'
from /home/c/Sites/ppsb_platform/spec/factories/prize_list_line_item.rb:2
from /home/c/.rvm/gems/ruby-1.8.7-p248/gems/factory_girl-1.2.3/lib/factory_girl/factory.rb:50:in `define'
from /home/c/Sites/ppsb_platform/spec/factories/prize_list_line_item.rb:1
from /home/c/.rvm/rubies/ruby-1.8.7-p248/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /home/c/.rvm/rubies/ruby-1.8.7-p248/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /home/c/Sites/ppsb_platform/vendor/rails/activesupport/lib/active_support/dependencies.rb:158:in `require'
from /home/c/Sites/ppsb_platform/spec/spec_helper.rb:89
from /home/c/Sites/ppsb_platform/spec/spec_helper.rb:89:in `each'
@seeflanigan
seeflanigan / should_include_module_macro.rb
Created July 7, 2010 19:47
RSpec matcher/macro to detect if a module is included in another module or class.
module CustomMacros
def it_should_include_module(expected)
it "should include #{expected}" do
should include_module(expected)
end
end
def it_should_not_include_module(expected)
it "should not include #{expected}" do
should_not include_module(expected)
<P> </P> <P><STRONG><SPAN style="FONT-SIZE: 16pt">Contact Foo Company</SPAN></STRONG></P> <P><EM><STRONG><U><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Customer Service Support</SPAN></U></STRONG></EM></P> <P><FONT size=2>For your convenience, you may contact Foo Company by phone, by email, or by mail. </FONT><SPAN><FONT size=2> Our customer service representatives will gladly respond to your inquiries.</FONT> </SPAN></P> <P> <BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"> <P><STRONG><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Customer Service Phone Support:</SPAN></STRONG><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"><SKYPE:SPAN onmouseup="javascript:skype_tb_imgOnOff(this,1,'0',true,16,'');return skype_tb_stopEvents();" class=skype_tb_injection onmousedown="javascript:skype_tb_imgOnOff(this,2,'0',true,16,'');return skype_tb_stopEvents();" id=softomate_highlight_0 onmouseover="javascript:skype_tb_imgOnOff(this,1,'0',true,16,'');" title="Call this p

Results

Of different approaches to sorting a .gitignore file

Initial .gitignore

.ackrc
*.log
coverage/*
*flymake*
public/system/*

config/database.yml

def [your_conventional_method_name_here]
@foo ||= Factory(:foo)
@foo.authorize!
end
@seeflanigan
seeflanigan / public_controller.rb
Created December 14, 2010 17:43
PublicController
class PublicController < ApplicationController
assume(:search) { Game.search(params[:search]) }
assume(:results) { search.current_scope }
assume(:user_games) { current_user.games }
def index
end
end
context "POST edit_subscriptions" do
setup do
fake_login
@user.subscriptions << Factory(:subscription)
@preference = Factory(:reminder_preference)
@user.reminder_preferences << @preference
post :edit_subscriptions, :id => @user.id, "#{@preferences.id}_email" => "on"
end
should "empty the users reminder preferences" do
@user.reload
@seeflanigan
seeflanigan / deprecation_helpers.rb
Created January 1, 2011 04:12
A helper method to simplify deprecations.
module DeprecationHelpers
def deprecated_in_favor_of(new_method_name)
warning = "[DEPRECATION] '##{deprecated_method_name}' "
warning << "has been deprecated.\n"
warning << "Please use '##{new_method_name.to_s}' instead."
logger.warn(warning)
end
protected
def deprecated_method_name