Skip to content

Instantly share code, notes, and snippets.

View valo's full-sized avatar

Valentin Mihov valo

View GitHub Profile
View digitalocean
$ ab -c 10 -n 100
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd,
Licensed to The Apache Software Foundation,
Benchmarking (be patient).....done
Server Software: nginx/1.4.6
valo /
Last active August 29, 2015 14:07

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.


Keybase proof

I hereby claim:

  • I am valo on github.
  • I am 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
require 'rubygems'
require 'mechanize'
require 'tidied_html_page.rb'
a = do |agent|
agent.user_agent_alias = 'Mac Safari'
agent.log ='parser.log', 'w+'))
agent.pluggable_parser.html = TidiedHTMLPage
agent.pluggable_parser.xhtml = TidiedHTMLPage
valo / env.rb
Created October 20, 2009 17:19
View env.rb
require 'spec/expectations'
require 'webrat'
Webrat.configure do |config|
config.mode = :mechanize
class MechanizeWorld < Webrat::MechanizeAdapter
View gist:578777
curl > wsj.html
curl --data-binary @wsj.html > wsj.pdf
View snippet.rb
module AttributeBuilder
def initialize(attrs = {})
attrs ||= {}
attrs.each do |key, value|
self.send("#{key}=", value)
module MemberBuilder
View gist:744760
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() {
valo / ideas.txt
Created May 12, 2011 12:41
Blog post topics
View ideas.txt
Namespaces in Ruby: what is the difference between
class A::B
module A
class B
View snippet.rb
@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)