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 :rails do | |
namespace :freeze do | |
desc 'Lock to the current Rails 2-3-stable' | |
task :rails23 do | |
rm_rf 'vendor/rails' | |
`git clone -b 2-3-stable --depth=1 git://github.com/rails/rails.git vendor/rails` | |
chdir 'vendor/rails' do | |
latest_revision = `git log -1 --pretty=format:%H` | |
%w(.git Rakefile cleanlogs.sh pushgems.rb release.rb activemodel).each do |goner| |
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
/opt/local/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:180:in `fetch_path': SocketError: getaddrinfo: | |
nodename nor servname provided, or not known (http://rubygems.org/gems/hoptoad_notifier-2.2.6.gem) (Gem::RemoteFetcher::FetchError) |
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
`touch some_file` | |
f = File.open("some_file",'w') | |
f.write "Stuff" | |
`rm some_file` | |
# Why is there no errors ? | |
puts f.flush.inspect | |
puts f.close.inspect | |
# via: @kirillrdy |
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
#!/usr/bin/env ruby | |
# taken from tolk | |
PLURALIZATION_KEYS = ['zero', 'one', 'two', 'few', 'many', 'other'] | |
def pluralization_data?(data) | |
keys = data.keys.map(&:to_s) | |
keys.all? {|k| PLURALIZATION_KEYS.include?(k) } | |
end | |
def flat_hash(data, prefix = '', result = {}) |
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
Error | |
Permission denied | |
/home/wiki/hiki/hiki/command.rb:93:in `dispatch' | |
/usr/lib/ruby/1.8/timeout.rb:62:in `timeout' | |
/home/wiki/hiki/hiki/command.rb:89:in `dispatch' | |
/home/wiki/hiki/hiki.cgi:38 | |
/home/wiki/hiki/hiki/storage.rb:14:in `open_db' | |
/home/wiki/hiki/hiki.cgi:36 | |
/home/wiki/html/rails/index.rb:5:in `load' | |
/home/wiki/html/rails/index.rb:5 |
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
% cat false.rb | |
if false | |
a = 1 | |
end | |
puts a | |
puts b | |
% ruby -v false.rb | |
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin10] | |
nil |
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
<?xml version="1.0"?> | |
<root> | |
<list> | |
<item> | |
<name>Handy Underscore</name> | |
<list> | |
<item> | |
<name>Command_R to Command_R</name> | |
<appendix>(+ When you type Command_R only, send Underscore)</appendix> | |
<identifier>remap.commandR2commandR_underscore</identifier> |
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
% rails -v | |
Rails 3.1.0.beta1 | |
% ls app/models | |
user.rb | |
% rails g scaffold user name:string -s | |
invoke active_record | |
create db/migrate/20110507060923_create_users.rb | |
skip app/models/user.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 'tempfile' | |
t1 = Tempfile.new 'foo.txt' | |
t2 = t1.dup | |
t1 = nil | |
GC.start | |
p File.exists?(t2.path) | |
p t2.read |
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
% rspec spec/models/user_spec.rb | |
.F.F. | |
Failures: | |
1) User | |
Failure/Error: it { should query :where => {:name => 'bar'} } | |
expected [:where] to query {:where=>{:name=>"bar"}} | |
# ./spec/models/user_spec.rb:6 |