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. There are 5 objects on the table, 3 are relatively tall and 2 are relatively short | |
2. Of the 2 short objects, 1 is shiny and narrow. That is a knife. | |
3. The other short object is a plate. | |
4. Of the 3 taller objects, 2 are hard and 1 is soft. The soft taller object we will call bread. The other two taller objects will be called jars. | |
5. Grab 1/10 of the bread and put it on the plate | |
6. Repeat step 5 | |
7. Grab a jar and twist the top in circles until it comes off. If it is not turning then switch directions. | |
8. Take the knife and dip it into the open jar until it is covered with the contents of the jar | |
9. Take the knife and wipe it on to the bread until the knife is clean. | |
10. Repeat steps 7-9 with the other jar |
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
Your Name: Adam Waxman | |
Github Username: awaxman11 | |
Blog Url: https://medium.com/@ajwaxman | |
Tagline: Build. Break. Learn. | |
Profile Picture | |
Treehouse Account: http://teamtreehouse.com/adamjwaxman | |
CoderWall Account: https://coderwall.com/awaxman | |
CodeSchool Account: http://www.codeschool.com/users/awaxman11 | |
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
# assignment.rb | |
# write an expression that returns true by using == | |
1 == 1 | |
# write an expression that returns false using == | |
1 == 2 | |
# write an expression that returns true using != | |
1 != 2 |
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..50).each do |num| | |
if num % 3 == 0 && num % 5 == 0 | |
puts "FizzBuzz" | |
elsif num % 5 == 0 | |
puts "Buzz" | |
elsif num % 3 == 0 | |
puts "Fizz" | |
else | |
puts num | |
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
# Construct an array with your favorite foods. | |
# It should have at least 5 element | |
fav_food = ["ice cream", "pizza", "chipotle", "bagels", "cereal"] | |
#Write a puts which returns your most favorite food out of the array | |
puts = fav_food[0] | |
# Construct an array with the colors of the rainbow (ROYGBIV) | |
colors_of_rainbow = [ | |
"red", |
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
# Create hashes for the following use-cases: | |
# A movie collection that organizes by genres | |
movie_collection = { | |
:comedy => ["Happy Gilmore", "The Hangover"], | |
:kids => ["Up", "Finding Nemo"] | |
} | |
# Recipes with ingredients |
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
puts "si eman ym ,iH".reverse.concat(" Adam").upcase.downcase.capitalize | |
puts "si eman ym ,iH".reverse | |
#=> Hi, my name is | |
puts "si eman ym ,iH".reverse.concat(" Adam") | |
#=> Hi, my name is Adam | |
puts "si eman ym ,iH".reverse.concat(" Adam").upcase | |
#=> HI, MY NAME IS ADAM |
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
#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) | |
case temp | |
when 18..21 | |
"I like this temperature" | |
else |
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 = { | |
# Cleveland Cavs | |
:team_1 => { | |
:name => "Cleveland Cavs", | |
:colors => ["Maroon", "Gold"], | |
:players => { | |
# Cleveland Cavs Players |
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
require "sqlite3" | |
require 'open-uri' | |
require 'nokogiri' | |
############### | |
# # Open a database | |
db = SQLite3::Database.new "test.db" | |
rows = db.execute <<-SQL |
OlderNewer