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
Processing SystemsController#delegate_data_key (for 173.12.191.149 at 2011-09-20 16:11:27) [POST] | |
Parameters: {"delegate_to"=>"5934", "id"=>"5481"} | |
Deadlock detected on retry 1, restarting transaction | |
Deadlock detected on retry 2, restarting transaction | |
Deadlock detected on retry 3, restarting transaction | |
Deadlock detected on retry 4, restarting transaction | |
Deadlock detected on retry 5, restarting transaction | |
Deadlock detected on retry 6, restarting transaction | |
Deadlock detected on retry 7, restarting transaction | |
Deadlock detected on retry 8, restarting transaction |
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
require "nokogiri" | |
xml = Nokogiri::XML(File.open("some_shit.xml")) | |
xml.at_css("xmldata") | |
# => nil | |
xml.xpath("//soap12:Envelope") | |
# => works, returns element and children |
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
Given /^I have entered a valid drink order$/ | |
When I fill in the following: | |
| field1 | value1 | | |
| field2 | value2 | | |
| etc | etc | |
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
# Permalink matching | |
match "/users/:username" => "users#show", as: "user" |
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
# 1 | |
(1...1000).select {|i| i % 3 == 0 || i % 5 == 0 }.inject(:+) | |
# 2 | |
fib1,fib2,sum = 1,1,0 | |
until fib2 > 4000000 | |
fib1,fib2 = fib2,(fib1 + fib2) | |
sum += fib2 if fib2 % 2 == 0 | |
end |
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
module Engine | |
mattr_accessor :user_class, :redis, :redis_host, :redis_port | |
class << self | |
def user_class | |
@@user_class.constantize | |
end | |
def redis | |
@@redis ||= Redis.new(@@redis_host, @@redis_port) |
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
★ Hated it | |
★★ Didn't like it | |
★★★ Liked it | |
★★★★ Really liked it! | |
★★★★★ Loved it! |
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
class BeersController < ApplicationController | |
def like | |
@beer = Beer.find(params[:id]) | |
respond_to do |format| | |
if current_user.like @beer | |
# respond to HTML with a redirect, render ajax js, etc. | |
else | |
# flash[:error], if you wish | |
end |
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
class Post < ActiveRecord::Base | |
has_many :tag_links | |
has_many :tags, :through => :tag_links | |
# ... | |
end |
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
describe Model do | |
describe "#method" do | |
it "should return the expected value" do | |
obj = Factory(:model) | |
obj.method.should == __ | |
end | |
end | |
describe "#some_other_method" do | |
it "should not raise an exception" do |