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 'sinatra' | |
get '/' do | |
<<-HTML | |
<ul> | |
<li><a href="/301.html">301</a></li> | |
<li><a href="/302.html">302</a></li> | |
<li><a href="/303.html">303</a></li> | |
</ul> | |
HTML |
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
# Will prompt the first time | |
`security find-internet-password -gs smtp.gmail.com 2>&1 | grep password`. | |
split(' ').last.gsub('"', '').strip |
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
# I'm not sure why but sometimes Syck is used for 'yaml' even under 1.9.2. This forces the issue. | |
Y = | |
if RUBY_VERSION =~ /1.9/ | |
require 'psych' | |
Psych | |
else | |
require 'yaml' | |
YAML | |
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
# encoding: UTF-8 | |
def test(env) | |
fn = 'foo' | |
File.open(fn, 'w:UTF-8') { |f| f.write '☃' } | |
begin | |
puts "Read from #{env} file: #{File.read(fn, :encoding => 'UTF-8')}" | |
rescue => e |
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
source :rubygems | |
gem 'activerecord', ENV['AR_VERSION'] || '3.1.0' | |
gem 'sqlite3', '~> 1.3.4' |
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
source :rubygems | |
gem 'activerecord', '~> 3.1.0' | |
gem 'sqlite3' |
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
source :rubygems | |
gem 'rake' | |
gem 'rspec', '~> 2.7.0' | |
gem 'rcov' |
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 'A' do | |
describe '#foo' do | |
it 'is generally okay' do; end | |
describe 'subconcern' do | |
it 'has common behavior' do; end | |
describe 'case 1' do | |
it 'does the right thing' do; 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
source :rubygems | |
gem 'i18n', '~> 0.4' | |
gem 'activesupport', '~> 3.0' | |
gem 'activerecord', '~> 3.0' | |
gem 'builder', '~> 2.1.2' |
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
puts "rspec-core #{RSpec::Core::Version::STRING}" | |
class InstantiationCounter | |
def initialize(k) | |
$count ||= { } | |
$count[k] ||= 0 | |
$count[k] += 1 | |
@k = k | |
end |