This file contains 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
# http://stackoverflow.com/questions/95554/overriding-a-mime-type-in-rails | |
render :json => var_containing_my_json, :content_type => 'text/x-json' |
This file contains 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
irb(main):016:0> res = Net::HTTP.post_form(url, {:hello => "world"}) | |
=> #<Net::HTTPOK 200 OK readbody=true> | |
irb(main):024:0> pp (res.methods - Object.methods).sort | |
["[]", | |
"[]=", | |
"add_field", | |
"basic_auth", | |
"body", | |
"canonical_each", | |
"chunked?", |
This file contains 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
request.env['RAW_POST_DATA'] |
This file contains 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
awesomeville:~ soawesomeman$ irb | |
irb(main):001:0> require 'rubygems' | |
=> true | |
irb(main):002:0> require 'addressable/uri' | |
=> true | |
irb(main):003:0> require 'pp' | |
=> true | |
irb(main):004:0> beer = Addressable::URI.new | |
=> #<Addressable::URI:0xc37abc URI:> | |
irb(main):005:0> pp (beer.methods - Object.methods).sort |
This file contains 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
<% | |
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : "" | |
rerun_opts = rerun.to_s.strip.empty? ? "--format progress features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}" | |
std_opts = "#{rerun_opts} --format rerun --out rerun.txt --strict --tags ~@wip" | |
%> | |
# ORIGINAL: | |
#default: <%= std_opts %> | |
#wip: --tags @wip:3 --wip features | |
# PATCH: | |
default: <%= std_opts %> --color |
This file contains 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
# Ruby opposite of array intersection... or maybe the method is missing from my brain bc not enough coffee | |
# http://twitter.com/soawesomeman/status/8035087261 | |
def awesome(ar_1, ar_2) | |
(ar_1 + ar_2) - (ar_1 & ar_2) | |
end | |
awesome([1,2,3,4], [3,4,5,6]) # => [1, 2, 5, 6] | |
This file contains 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
ActionController::DoubleRenderError (Render and/or redirect were called multiple times in this action. Please note that you may only call render OR redirect, and at most once per action. Also note that neither redirect nor render terminate execution of the action, so if you want to exit an action after redirecting, you need to do something like "redirect_to(...) and return".): |
This file contains 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
# | |
# I heard you like patches in yo controller dawg... | |
# | |
# DIRTY PATCH for | |
# def get,post,put,delete | |
# http://github.com/brynary/webrat/blob/38535d1e0ec3dab91b4c516dfd4c14ac7f6f81e4/lib/webrat/rails.rb | |
# | |
# | |
# | |
before_filter :test_helper |