Skip to content

Instantly share code, notes, and snippets.

View kennyt's full-sized avatar

Kenny Tran kennyt

  • San Francisco, CA
View GitHub Profile
@kennyt
kennyt / gist:3963770
Created October 27, 2012 09:37
03_simon_says
def echo (word)
word
end
def shout (word)
word.upcase
end
def repeat (word, times = 2)
(word * times).gsub(word, " #{word}").strip
@kennyt
kennyt / gist:3963767
Created October 27, 2012 09:36
02_calculator
def add (num1, num2)
num1 + num2
end
def subtract (num1, num2)
num1 - num2
end
def sum (array)
answer = 0
@kennyt
kennyt / gist:3963766
Created October 27, 2012 09:35
01_temperature
def ftoc (fahrenheit)
(fahrenheit - 32) * 5/9.to_f
end
def ctof (celsius)
celsius * 9/5.to_f + 32
end
@kennyt
kennyt / gist:3963765
Created October 27, 2012 09:35
00_hello
def hello
"Hello!"
end
def greet(name)
"Hello, #{name}!"
end