Skip to content

Instantly share code, notes, and snippets.

MOZILLA:
NoMethodError in Home#index
Showing /home/pankoholic/code/rehearsals/app/views/layouts/header.html.erb where line #17 raised:
undefined method `is_musician?' for nil:NilClass
Extracted source (around line #17):
14: <%= link_to "Sign in", "/sign_in" %>
@pankoholic
pankoholic / rec_numbers.rb
Created July 3, 2012 12:58
Recycled Numbers (google code challange; qualification round 2012)
def pair(a, b)
total = 0
(a...b).each do |n|
((n+1)..b).each do |m|
(0...n.to_s.length).each do |i|
temp = n.to_s[i, n.to_s.length] + n.to_s[0, i]
if temp == m.to_s
total += 1
end
end
@pankoholic
pankoholic / googlerese.rb
Created July 2, 2012 23:19
Speaking in Tongues (google code challange; qualification round 2012)
(1..gets.to_i).each do |i|
(0...(str = gets.to_s.downcase).length).each do |j|
if str[j] == 'a'
str[j] = 'y'
elsif str[j] == 'b'
str[j] = 'h'
elsif str[j] == 'c'
str[j] = 'e'
elsif str[j] == 'd'
str[j] = 's'
@pankoholic
pankoholic / dog_@.rb
Created July 1, 2012 21:05
dog with @
class Dog
attr_reader :age
def initialize(age)
@age = age
end
end
d = Dog.new(8)
puts d.age
@pankoholic
pankoholic / dog_self.rb
Created July 1, 2012 21:04
dog with self
class Dog
attr_accessor :age
def initialize(age)
self.age = age
end
end
d = Dog.new(8)
puts d.age