{{ message }}

Instantly share code, notes, and snippets.

🦄

# Sia siakaramalegos

🦄
Created Oct 20, 2015
Activity app showing branches and methods
View activity.rb
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
 todays_temp = 80 weather_condition = "sunny" def activity(temp, condition="sunny") if temp == 80 && condition == "sunny" puts "That's the perfect temp! Let's still go hiking." elsif temp > 50 && condition == "sunny" puts "I'm going hiking!" else puts "Let's read a book."
Created Oct 21, 2015
Homework 1.1 Division problem
View division.rb
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 division puts "Give me an integer!" integer1 = gets.chomp.to_i puts "Give me another integer!" integer2 = gets.chomp.to_i if integer2 == 0 puts "Sorry, can't divide by zero!" # Instead of just ending the method, we can call it again from inside itself! This is known as recursion.
Created Oct 21, 2015
Loops in Ruby (and some arrays)
View loopy_birds.rb
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
 # All about loops in Ruby # For loop - not really used in Ruby! # for n in 1..100 # puts "#{n} birds on a wire - AH AH AH" # end # While and until loops - used when it's unclear how many times we need to loop # understands_loops = "no"
Created Oct 21, 2015
Ruby trivia app using each_with_index
View trivia.rb
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
 # Pop trivia app questions = [ "Who sang Material Girl?", "Which actor played Zoolander?", "Who is not Michael Jackson's lover?"] # store them in lowercase to make checking answers easier answers = [ "madonna",
Created Oct 22, 2015
Same trivia app but using a hash instead of 2 arrays
View trivia_hash.rb
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
 # Pop trivia app questions_answers = { "Who sang Material Girl?" => "madonna", "Which actor played Zoolander?" => "ben stiller", "Who is not Michael Jackson's lover?" => "billie jean" } puts "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" puts " Welcome to Sia's Really Cool Trivia App"
Created Oct 22, 2015
Class Cup
View cup.rb
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
 class Cup # use title case for classes and only classes # Have to call it "initialize" for it to work def initialize puts "I'm alive! **SPARKLE**" # This is an instance variable - all cups have independent drink_amounts # Pretend like these are percentages @drink_amount = 0 end
Created Oct 22, 2015
Class Mojo that inherits from class cup
View mojo.rb
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_relative "cup" class Mojo < Cup def initialize super puts "Welcome to Mojo Coffee" end end
Created Oct 28, 2015
Learning CSS and HTML with favorite restaurant page
View restaurant-index.html
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 Dives

My Favorite Dive Restaurants

Created Oct 28, 2015
Learning CSS with restaurant page
View restaurant-style.css
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
 body { /*color: blue;*/ font-family: Arial, Helvetica; background: url("burgers.jpeg") no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; }
Created Jan 20, 2016
Imperial to Metric program
View imperial_to_metric.rb
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
 # Defining my methods at the top so I can use them later # Ask user for their name def get_name puts "Hellooo there, what is your name?" gets.chomp end # Ask the user for their height in inches def get_height_inches(user_name)