Skip to content

Instantly share code, notes, and snippets.

View modsognir's full-sized avatar

Jared Fraser modsognir

View GitHub Profile
@modsognir
modsognir / gist:1005830
Created June 3, 2011 03:38
Speed up cucumber
class DeferredGarbageCollection
DEFERRED_GC_THRESHOLD = (ENV['DEFER_GC'] || 10.0).to_f
@@last_gc_run = Time.now
def self.start
GC.disable if DEFERRED_GC_THRESHOLD > 0
end
find app config db spec test -type f -name '*.rb' -or -name '*.coffee' -or -name '*.erb' -or -name '*.jbuilder' -or -name '*.js' | xargs sed -i '' -E "s/[[:space:]]*$//"
{
{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours. {It's|It is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as you did, the {internet|net|web} will be {much more|a lot more} useful than ever before.|
I {couldn't|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch} your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service. Do {you have|you've} any? {Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe. Thanks.|
{It is|It's} {appropriate|perfect|the best} time to make some plans for the future and {it is|i
config.after(:each) do
if Capybara.current_driver != :rack_test && page.driver.error_messages.present?
puts example.metadata[:description_args]
end
end
@modsognir
modsognir / error.rb
Last active December 18, 2015 23:09 — forked from chewmanfoo/error.rb
Completed 500 Internal Server Error in 1867ms
NoMethodError (undefined method `include?' for nil:NilClass):
app/models/user.rb:121:in `svn_password_must_be_acceptable'
def routes(engine_name)
require 'rails/application/route_inspector'
puts Rails::Application::RouteInspector.new.format("#{engine_name}::Engine".constantize.routes.routes, nil)
end
@modsognir
modsognir / gist:5070102
Created March 2, 2013 07:53
LOGO Game that I built in high school.
TO RANDOMBATTLE
MAKE "VARFIGHT RANDOM 4
IF :LEVELONE = 1 THEN LEVELONEDMG
IF :LEVELTWO = 1 THEN LEVELTWODMG
IF :LEVELTHREE = 1 THEN LEVELTHREEDMG
IF :LEVELFOUR = 1 THEN LEVELFOURDMG
IF :VARFIGHT = 0 THEN ELVENWARRIORS
IF :VARFIGHT = 1 THEN WEASEL
IF :VARFIGHT = 2 THEN TROGLODYTEADEPT
IF :VARFIGHT = 3 THEN ETTIN
def activated=(bool)
activate!
self[:activated] = true # if you want to persist this field
end
def activate!
# stuff you want done
end
You have joined the channel
Pseudomonkey: I ONLY DRINK THE BLOOD OF MY ENEMIES
AdamSeabrook: I am so rich I pay my peons to drink for me
Disconnected
@modsognir
modsognir / idea.rb
Created January 15, 2013 11:38 — forked from kalleth/idea.rb
field :name
accessible
validates :presence do
message "please provide a name"
end
end
field :email
accessible
validates :format do