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
Name: Trevor McKendrick | |
Github: http://github.com/TrevMcKendrick | |
Blog: http://trevormckendrick.com | |
Tagline: Gets to the point | |
Profile Picture: http://www.trevormckendrick.com/headshot.jpg | |
Treehouse Account: http://teamtreehouse.com/trevormckendrick | |
CoderWall Account: https://coderwall.com/trevmckendrick | |
CodeSchool Account: http://www.codeschool.com/users/trevmckendrick | |
Favorite Websites: |
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
def remove_bread(slices) | |
Place alien hand in bag | |
Grab slices | |
Remove alien hand from bag with slices in hand | |
Place_slices(prepare) | |
end | |
def place_slices(stage_of_meal) | |
if stage_of_meal == prepare | |
slices should be centered, next to each other. NOT on top of each other |
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
[23:35:51] code | |
-> mkdir artists | |
[23:35:55] code | |
-> cd artists/ | |
[23:35:58] artists | |
-> sqlite3 artists.db | |
SQLite version 3.7.12 2012-04-03 19:43:07 | |
Enter ".help" for instructions | |
Enter SQL statements terminated with a ";" | |
sqlite> CREATE TABLE artists( |
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
#1 Define a fizzbuzz method to do the following: | |
def fizzbuzz_it(number) | |
if number % 3 == 0 && number % 5 == 0 | |
return "FizzBuzz" | |
elsif number % 3 == 0 | |
return "Fizz" | |
elsif number % 5 == 0 | |
return "Buzz" | |
end |
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
#From [rubeque](http://rubeque.com/problems/temperature-robot) | |
#Temperature bot is comfortable when it's room temperature (18-21C). Help him out by completing the method below: | |
#Temperature bot is American but takes Celsius temperatures. | |
def temperature_bot(temp) | |
if temp >= 18 && temp <= 21 | |
puts "I like this temperature" |
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
def my_each(array) | |
i = 0 | |
while i < array.length do | |
yield(array[i]) | |
i += 1 | |
end | |
end | |
my_each(["boy",7,true,"awesome_sauce","YES"]) { |x| puts x} |
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
# Let's go back to the exercise where we determined what is and isn't a vowel. | |
# With ruby, there's always more than one way to do something and get the same | |
# result. | |
# Assuming vowels `a,e,i,o,u`: | |
# 1. Write a method that returns whether a given letter is a vowel, using `if` | |
# and `elsif` | |
def is_vowel_one?(letter) |
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
# You're hosting a conference and need to print badges for the speakers. Each | |
# badge should say: "Hello, my name is _____." | |
# **Write a method that will create and return this message, given a person's | |
# **name.** | |
def badge(name) | |
"Hello my name is #{name}" | |
end | |
#badge("Trevor") |
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
def normalize_phone_number(str) | |
parsed_str = str.gsub(/[^0-9]/, "") | |
return str if parsed_str.length != 10 | |
parsed_str.insert(0, "(") | |
parsed_str.insert(4, ") ") | |
parsed_str.insert(9, "-") | |
return parsed_str |
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
game = { | |
:the_lakers => { | |
:name => "The Lakers", | |
:colors => ["purple","gold"], | |
:players => { | |
:daniel_mckendrick => { | |
:stats => { | |
:points => 25, | |
:rebounds => 5, | |
:assists => 3, |
OlderNewer