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
expected #<Nokogiri::XML::Document:0x3ff1a047c080 name=\"document\" children=[#<Nokogiri::XML::Element:0x3ff1a047baf4 name=\"message\" children=[#<Nokogiri::XML::Element:0x3ff1a047b874 name=\"name\" children=[#<Nokogiri::XML::Text:0x3ff1a047b4dc \"bob\">]>]>]> to equal #<Nokogiri::XML::Document:0x3ff1a0c1051c name=\"document\" children=[#<Nokogiri::XML::Element:0x3ff1a0c17268 name=\"message\" children=[#<Nokogiri::XML::Element:0x3ff1a0c16de0 name=\"name\" children=[#<Nokogiri::XML::Text:0x3ff1a0c16570 \"jake\">]>]>]>" |
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
# Input | |
['a', 'a', 'a', 'b', 'b'] | |
# Output | |
=> ['a'] |
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 TallyBag | |
include Enumerable | |
def initialize | |
@tallys = Hash.new{0} | |
end | |
def each | |
if block_given? | |
@tallys.each(&Proc.new) |
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
expect{current_path}.to eventually_eql('/') | |
expect{current_path}.to eventually_match(%r{/boxes/PS\d+/shipping_information/new}) | |
expect{get_me_the_cookie('foo')[:value]}.to eventually_eql('bar') |
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
namespace :iteration do | |
desc "Runs the tasks for the current iteration" | |
task :current => 'iteration:migrate' | |
desc 'Runs the unrun iteration tasks' | |
task :migrate => :environment do | |
mig = ActiveRecord::Migrator.new(:up, File.join(Rails.root, 'db', 'iterations')) | |
mig.migrate | |
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
require 'page_rankr' | |
class PageRankr::Ranks::GoogleHk < PageRankr::Ranks::Google | |
def url | |
"http://toolbarqueries.google.com.hk/tbr" | |
end | |
end | |
tracker = PageRankr::Ranks::GoogleHk.new('www.google.com') | |
puts "Rank #{tracker.run}" | |
puts tracker.body |
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
tis = %w(SR123 SR234 SR5677) | |
MessageDispatcher.some_method(*tis) | |
class MessageDispatcher | |
def some_method(ti1, ti2, ti3, *other_tis) | |
#blah | |
end | |
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
# This is the method I am testing. | |
class Log | |
private | |
class Parse | |
@queue = :parse | |
# This is a resque job. perform will ultimately be called asynchronously. | |
# Therefore, must find the Log before performing the action because it | |
# may be dirty or have been deleted since. | |
def self.perform(log_id) | |
# ACM: I would change |
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
##### Aliases ##### | |
#Shortcuts | |
alias mysql="mysql -u root" | |
#Processes and Ports | |
alias fp="ps -ef | grep -i " | |
alias fpp="lsof -i -P | grep -i listen" | |
#Git |
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
##### Aliases ##### | |
#Shortcuts | |
alias mysql="mysql -u root" | |
#Processes and Ports | |
alias fp="ps -ef | grep -i " | |
alias fpp="lsof -i -P | grep -i listen" | |
#Git |