This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config.cache_classes = ENV['RELOAD_CLASSES'].blank? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#frequency counter | |
#adds each character in ruby files to a hash incrementing a counter | |
#outputs list in reverse order. least frequent first | |
#Usage | |
#ruby frequency_counter.rb FILE1 [FILE2 FILE3... etc] | |
characters = Hash.new(0) | |
ARGV.each do |file| | |
content = File.read file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
twitter = Hateoas.site "api.twitter.com" | |
twitter.actions | |
# => [sign_in: {method: :get}] | |
twitter.sign_in user: "[email protected]", password: "password" | |
twitter.actions | |
# => [read_messages: {method: :get}, tweet: {method: :post}] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#encoding: utf-8 | |
あけまして = | |
class A | |
class << self | |
alias おめでとう instance_eval | |
def ございます e; puts e; end | |
end | |
self | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Failure/Error: Unable to find matching line from backtrace | |
NoMethodError: | |
undefined method `original_path_set' for nil:NilClass | |
# /Users/macmacmacmacmacmac/.rvm/gems/ruby-1.9.3-p0/gems/rspec-rails-2.8.1/lib/rspec/rails/view_rendering.rb:113:in `block (2 levels) in <module:ViewRendering>' | |
# /Users/mark/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:435:in `instance_eval' | |
# /Users/mark/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:435:in `instance_eval_with_rescue' | |
# /Users/mark/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/hooks.rb:45:in `run_in' | |
# /Users/mark/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/hooks.rb:80:in `block in run_all' | |
# /Users/mark/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/hooks.rb:80:in `each' | |
# /Users/mark/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/hooks.rb:80:in `run_all' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -d "mike=why-you-no-fix-your-jobs-page-yet&check-this-out=\"curl -i http://railslove.com/jobs.json -H \"Accepts:application/json\"&from-mark=kthxbai" http://join-railslove.herokuapp.com/join | |
curl: (52) Empty reply from server |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shop = Fabricate(:shop, business_hours: shop_hours) | |
shop_factory = Fabricate(:shop_factory) | |
def shop_factory.get id | |
Fabricate(:shop, id: id) | |
end | |
data_store = Fabricate(:data_store) do | |
shop_fetcher shop_factory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RacistException < StandardError; end | |
class BeingADickException < StandardError; end | |
def say thing | |
raise RacistException if thing =~ /^I'm not racist but/ | |
raise BeingADickException if thing =~ /^I don't mean to be a dick but/ | |
puts thing | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Array | |
alias_method :old_first, :first | |
def first &block | |
if block_given? | |
detect &block | |
else | |
old_first | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rbconfig' | |
HOST_OS = RbConfig::CONFIG['host_os'] | |
source 'http://rubygems.org' | |
gem 'split', :require => 'split/dashboard' | |
gem "rake" | |
gem 'mysql2', '~> 0.3' | |
gem 'rails', '3.2.2' | |
gem 'sqlite3' |