Skip to content

Instantly share code, notes, and snippets.

View modsognir's full-sized avatar

Jared Fraser modsognir

View GitHub Profile
class Animal
def self.noise=(sound)
@noise = sound
end
def self.noise
@noise
end
def speak
@modsognir
modsognir / money regex
Last active August 29, 2015 13:59
Regex the crap out of currency
http://www.evertype.com/standards/euro/formats.html
@modsognir
modsognir / gist:10646706
Created April 14, 2014 13:14
cloning a bunch of repos
#!/usr/bin/env ruby -w
require 'json'
repos = JSON.parse(File.read('repos')).map {|e| e['name']}
repos.each do |repo|
puts "=== #{repo}"
`git clone mas:#{repo} ex/#{repo}`
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