Extracting the bar
calculation into a separate object, which doesn't know about Foo
, allows us to test this code in more isolation and to easily change it in the future, because of its reduced context.
View digitalocean
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
$ ab -c 10 -n 100 http://178.62.172.238/rankings_practice | |
This is ApacheBench, Version 2.3 <$Revision: 655654 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking 178.62.172.238 (be patient).....done | |
Server Software: nginx/1.4.6 |
View README.md
View keybase.md
Keybase proof
I hereby claim:
- I am valo on github.
- I am valo (https://keybase.io/valo) on keybase.
- I have a public key whose fingerprint is 2C5B D381 351D 02B7 E0EF 002D 0E81 39C9 3B22 1782
To claim this, I am signing this object:
View example.rb
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 'rubygems' | |
require 'mechanize' | |
require 'tidied_html_page.rb' | |
a = WWW::Mechanize.new do |agent| | |
agent.user_agent_alias = 'Mac Safari' | |
agent.log = Logger.new(File.open('parser.log', 'w+')) | |
agent.pluggable_parser.html = TidiedHTMLPage | |
agent.pluggable_parser.xhtml = TidiedHTMLPage | |
end |
View env.rb
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 'spec/expectations' | |
require 'webrat' | |
Webrat.configure do |config| | |
config.mode = :mechanize | |
end | |
class MechanizeWorld < Webrat::MechanizeAdapter | |
end |
View gist:578777
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
curl http://europe.wsj.com/home-page > wsj.html | |
curl --data-binary @wsj.html g.pdfgenapp.com > wsj.pdf |
View snippet.rb
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 AttributeBuilder | |
def initialize(attrs = {}) | |
attrs ||= {} | |
attrs.each do |key, value| | |
self.send("#{key}=", value) | |
end | |
end | |
end | |
module MemberBuilder |
View gist:744760
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
import java.util.ArrayList; | |
import java.util.List; | |
public class School { | |
private List<SchoolClass> m_classes = new ArrayList<SchoolClass>(); | |
private List<SchoolRoom> m_rooms = new ArrayList<SchoolRoom>(); | |
public School() { | |
} | |
View ideas.txt
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
Namespaces in Ruby: what is the difference between | |
class A::B | |
end | |
and | |
module A | |
class B | |
end |
View snippet.rb
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
@asp1 = Factory(:asp, :name => "ASP1", :school_name => "School 1", :school_district => "District 1", :region_id => regions(:us_co).id) | |
@asp2 = Factory(:asp, :name => "ASP2", :school_name => "School 2", :school_district => "District 2", :region_id => regions(:us_co).id) | |
@asp3 = Factory(:asp, :name => "ASP3", :school_name => "School 3", :school_district => "District 3", :region_id => regions(:us_co).id) | |
@asp4 = Factory(:asp, :name => "ASP4", :school_name => "School 4", :school_district => "District 3", :region_id => regions(:us_co).id) |
OlderNewer