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. Look at the objects on the table. | |
2. Find the cylinder containing brown stuff. This is the jar of peanut-butter. | |
3. Wrap your left hand firmly around that jar and place your right hand over the top of the jar. | |
4. Your right hand is resting on the jar's lid. Squeeze your right hand around the lid and maintain that pressure to hold the lid firmly in place. | |
5. Curl your left hand so your palm turns toward your body, rotating the jar while the lid stays in place. | |
6. Try to lift the lid upwards off the jar with your right hand. | |
7. If the lid doesn't lift freely off the jar, stop trying to pull it off, open your left hand and bring it back to its in initial position wrapped around the jar (as in step 3), and repeat from step 4. | |
8. Lift the lid off the top of the jar with your right hand and put the lid down on the table, beside that jar. | |
9. Release both hands and find the other cylinder, which contains either red or purple stuff. This is the jar of jelly. | |
10. Repeat steps 3 through 8 with the jar of jel |
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: Ivan Brennan | |
Github: https://github.com/ivanbrennan | |
Blog Url: githubivanbrennan.github.io | |
Tagline: Tag! | |
Profile Picture: http://m.c.lnkd.licdn.com/mpr/mpr/shrink_200_200/p/8/000/1c4/3a6/23d8826.jpg | |
Treehouse Account: http://teamtreehouse.com/ivanbrennan | |
Coderwall Account: https://coderwall.com/ivanbrennan | |
Codeschool Account: http://www.codeschool.com/users/ivanbrennan | |
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 fizzbuzz(number) | |
if (number % 3 == 0) && (number % 5 == 0) | |
puts "FizzBuzz" | |
elsif number % 3 == 0 | |
puts "Fizz" | |
elsif number % 5 == 0 | |
puts "Buzz" | |
else | |
puts number | |
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
# Write a program that tells you the following: | |
# | |
# Hours in a year. How many hours are in a year? | |
# Minutes in a decade. How many minutes are in a decade? | |
# Your age in seconds. How many seconds old are you? | |
# | |
# Define at least the following methods to accomplish these tasks: | |
# | |
# seconds_in_minutes(1) | |
# minutes_in_hours(1) |
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
favorite_foods = ['chicken', 'rice', 'peach', 'nectarine', 'zuchini'] | |
most_fav_food = favorite_foods[2] | |
puts most_fav_food | |
colors_of_rainbow = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'] | |
red, orange, yellow = colors_of_rainbow[0..2] | |
empty_arr = [] | |
empty_arr[1] = "b" | |
empty_arr[5] = "f" |
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
# Given this List of Songs, Construct Arrays by Artist and Album | |
# Hint: Make use of the split() String Method | |
# http://www.ruby-doc.org/core-1.9.3/String.html#method-i-split | |
# Simple Example of Data Parsing | |
songs = [ | |
"The Magnetic Fields - 69 Love Songs - Parades Go By", | |
"The Magnetic Fields - Get Lost - Smoke and Mirrors", | |
"Neutral Milk Hotel - In An Aeroplane Over the Sea - Holland 1945", | |
"The Magnetic Fields - Get Lost - You, Me, and the Moon", |
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 get_badge(name) | |
"Hello, my name is #{name}." | |
end | |
def get_badges(names_arr) | |
badges_arr = [] | |
names_arr.each do |name| | |
badges_arr << get_badge(name) | |
end | |
badges_arr |
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 | |
def is_vowel_elsif?(letter) | |
if letter == "a" | |
true | |
elsif letter == "e" | |
true | |
elsif letter == "i" | |
true | |
elsif letter == "o" | |
true |
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
subs = {"to" => "2", "two" => "2", "too" => "2", | |
"for" => "4", "four" => "4", "be" => "b", | |
"you" => "u", "at" => "@", "and" => "&"} | |
def string_shortener(str, subs) | |
punks = [" ", ".", "?", "!", ","] | |
current_word = "" | |
shortened_str = "" | |
return str if str.length <= 140 |
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) | |
empty = (array.length == 0) | |
i = 0 | |
while (i < array.length) && !empty | |
yield array[i] | |
i += 1 | |
end | |
array | |
end |
OlderNewer