Skip to content

Instantly share code, notes, and snippets.

~/code% gem install rails --pre
ERROR: While executing gem ... (NoMethodError)
undefined method `name' for "\\Aactivesupport\\Z":String
~/code% gem install rails --pre
ruby(81212,0xa08b2720) malloc: *** error for object 0x7ced40: Non-aligned pointer being freed (2)
*** set a breakpoint in malloc_error_break to debug
ERROR: While executing gem ... (NoMethodError)
undefined method `name' for ["=", #<Gem::Version "1.1.0.dev.20100209">]:Array
% cucumber features
/Users/rbates/.rvm/rubies/ruby-head/lib/ruby/1.9.1/rubygems.rb:761: [BUG] Segmentation fault
ruby 1.9.2dev (2010-02-24 trunk 26744) [x86_64-darwin10.0.0]
-- control frame ----------
c:0028 p:0205 s:0109 b:0109 l:000108 d:000108 METHOD /Users/rbates/.rvm/rubies/ruby-head/lib/ruby/1.9.1/rubygems.rb:761
c:0027 p:0203 s:0103 b:0103 l:000102 d:000102 METHOD /Users/rbates/.rvm/rubies/ruby-head/lib/ruby/1.9.1/rubygems.rb:212
c:0026 p:0090 s:0086 b:0086 l:000085 d:000085 METHOD /Users/rbates/.rvm/rubies/ruby-head/lib/ruby/1.9.1/rubygems.rb:1042
c:0025 p:0015 s:0080 b:0080 l:000079 d:000079 METHOD /Users/rbates/.rvm/gems/ruby-head/gems/cucumber-0.6.2/lib/cucumber/formatter/ansicolor.rb:102
c:0024 p:0180 s:0076 b:0076 l:002518 d:002518 CLASS /Users/rbates/.rvm/gems/ruby-head/gems/cucumber-0.6.2/lib/cucumber/formatter/ansicolor.rb:138
get "/about" => 'info#about', :as => 'about'
get "/privacy" => 'info#privacy', :as => 'privacy'
get "/license" => 'info#license', :as => 'license'
get "/mission" => 'info#mission', :as => 'mission'
get "/contact" => 'info#contact', :as => 'contact'
namespace :deploy do
desc "Make sure there are no changes that need to be pushed."
task :check_revision, :roles => :web do
unless `git rev-parse HEAD` == `git rev-parse origin/master`
puts "WARNING: HEAD is not the same as origin/master"
puts "Run `git push` to sync changes."
exit
end
end
end
Action Pack
* #concat is now deprecated in favor of using <%= %> helpers [YK]
* Block helpers now return Strings, so you can use <%= form_for @foo do |f| %>.
<% form_for do |f| %> still works with deprecation notices [YK]
* Add a new #mount method on the router that does not anchor the PATH_INFO
at the end [YK & CL]
def morse s;26.times{|i|s.gsub!(/#{(97+i).chr}/i,%w[.- -... -.-. -.. . ..-. --. .... .. .--- -.- .-.. -- -. --- .--. --.- .-. ... - ..- ...- .-- -..- -.-- --..][i])};s;end
require "test/unit"
class MaskTest < Test::Unit::TestCase
def test_morse
assert_equal ".-", morse("a")
assert_equal "-...", morse("b")
assert_equal "......-...-..--- .-----.-..-..-..", morse("Hello World")
end
end
def morse s;26.times{|i|s.gsub!(/#{(97+i).chr}/i,%w[.- -... -.-. -.. . ..-. --. .... .. .--- -.- .-.. -- -. --- .--. --.- .-. ... - ..- ...- .-- -..- -.-- --..][i])};s;end
def luhn? n;s=0;n.size.times{|i|x=n[-(i+1),1].to_i*(i%2+1);s+=x>9?x+1:x};s%10==0;end
@ryanb
ryanb / morse.rb
Created June 10, 2010 17:56 — forked from swhitt/morse.rb
def morse s;26.times{|i|s.gsub! /#{(97+i).chr}/i,("$be5 J8G#T6P'&9Sl/,!-H0cfk"[i]-31).to_s(3).tr("12",".-")};s;end