Skip to content

Instantly share code, notes, and snippets.

Alex Altair alexaltair

Block or report user

Report or block alexaltair

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@alexaltair
alexaltair / gem_update.md
Last active Dec 24, 2015
Steps to take when updating or creating a gem.
View gem_update.md
@alexaltair
alexaltair / unknown.md
Created Jul 29, 2013
Things I don't recognize
View unknown.md
@alexaltair
alexaltair / ruby_practice.rb
Created Jul 8, 2013
Weekend Ruby practice
View ruby_practice.rb
def fibonacci(n)
if (0..1) === n
n
else
fibonacci(n-1) + fibonacci(n-2)
end
end
def prime_list(highest)
list = Array.new(highest, true)
@alexaltair
alexaltair / attr_accessor.md
Last active Dec 18, 2015
Quick explanation of attribute accessors.
View attr_accessor.md

In class definitions,

attr_accessor :name, :email, :phone_number

is the same as

attr_reader :name, :email, :phone_number
@alexaltair
alexaltair / Today's Learning.md
Last active Dec 18, 2015
An exploration of infinite lists.
View Today's Learning.md

The first thing that really surprised me today was the flexibility of Ruby's shovel operator, <<. A student in the class had tried the following:

a = [0]
a << a

What do you think a is now? I was sure it would be [0, [0]]. But lo and behold, Ruby sparkles;

a = [0]
a << a
You can’t perform that action at this time.