Skip to content

Instantly share code, notes, and snippets.

### Installing rack or rails was failinf when running 1.8.7-p249 via RVM
### /Users/enricoant/.rvm/rubies/ruby-1.8.7-p248/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:254: warning: getc is obsolete; use STDIN.getc instead
### So i switched to 1.8.7-p248 via RVM
carbon:cos enricoant$ gem install rack -v 1.0.1
/Users/enricoant/.rvm/rubies/ruby-1.8.7-p248/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:254: warning: getc is obsolete; use STDIN.getc instead
^CERROR: Interrupted
carbon:cos enricoant$ gem install rails
/Users/enricoant/.rvm/rubies/ruby-1.8.7-p248/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:254: warning: getc is obsolete; use STDIN.getc instead
arbon:cos enricoant$ gem install rack -v 1.0.1
/Users/enricoant/.rvm/rubies/ruby-1.8.7-p248/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:254: warning: getc is obsolete; use STDIN.getc instead
^CERROR: Interrupted
carbon:cos enricoant$ history | grep rack
135 gem list rack
139 gem install rack -v 1.0.1
145 gem install rack
146 history | grep rack
147 gem install rack -v 1.0.1
149 gem install rack -v 1.0.1
@agenteo
agenteo / gist:400879
Created May 14, 2010 06:27
helpers for capybara
module VerboseExpectationsHelpers
def expect_page_has(path, options={})
@path, @options = path, options
raise Capybara::ElementNotFound, text_found_instead if !page.has_css?(@path, @options)
end
def expect_page_count(path, options={})
@path, @options = path, options
raise Capybara::ElementNotFound, total_found_instead if !page.has_css?(@path, @options)
require 'rubygems'
gem 'soap4r'
require 'soap/wsdlDriver'
wsdl_url = "http://YOU-URL-HERE?wsdl"
driver = SOAP::WSDLDriverFactory.new(wsdl_url).create_rpc_driver
driver.options["protocol.http.basic_auth"] << [wsdl_url, "USER", "PASS"]
response = driver.functionHere(1, 2, 3)
@agenteo
agenteo / rails_snippets.rb
Created October 1, 2009 00:34
rails snippets
Recipe.all.each(&:save)
YAML::load( File.open( 'README' ) )
self.class.helpers.link_to(
include ActionController::UrlWriter
@agenteo
agenteo / restore_db.sh
Created March 20, 2009 03:59
restore db from a sql file
#!/bin/bash
db_name=$1
db_dump_file=$2
echo "Dropping the database ${db_name}..."
mysqladmin5 drop ${db_name} --user=root
echo "Creating the database ${db_name}..."
mysqladmin5 create ${db_name} --user=root
echo "Restore structure and data from ${db_dump_file}"
@agenteo
agenteo / backup_db.sh
Created March 20, 2009 03:58
mysql database timestamped backup
#!/bin/bash
db_name=$1
date_time=`date +%Y%m%d_%H%M_%S`
file_name=${db_name}_${date_time}.sql
echo "Dumping the database ${db_name} in ${file_name}..."
mysqldump5 ${db_name} --user=root > ${file_name}
echo "Sayonara"
#!/bin/bash
db_name=$1
date_time=`date +%Y%m%d_%H%M_%S_`
file_name=${date_time}${db_name}.sql
echo "Dumping the database ${db_name} in ${file_name}..."
mysqldump5 pregnancy_directory_development --user=root > ${file_name}
echo "Sayonara"
@agenteo
agenteo / gist:33692
Created December 8, 2008 23:50
YAML count
require 'yaml'
class Company
attr_accessor :name, :street, :town, :state, :postcode, :phone, :website, :fax, :categories
end
y = File.open( "companies.yaml" )
counter = 0
yp = YAML::load_documents( y ) { |doc|
@agenteo
agenteo / how_to_report_flaky_test
Created February 13, 2015 23:07
How to report flaky tests
## Determine if it's a flaky test
If the test *consistently* fails locally it's not a flaky test and you should not commit to master. Period.
If the test *consistently* fails only on our CI build, you must ssh on the CI box:
```
ssh yourCIserver
```
then: