Skip to content

Instantly share code, notes, and snippets.

View joegiralt's full-sized avatar
💣
:p

Joseph Giralt joegiralt

💣
:p
View GitHub Profile
@joegiralt
joegiralt / scraper2.rb
Created June 13, 2013 16:30
scraper2.rb
require 'nokogiri'
require 'sqlite3'
require 'open-uri'
# def comb_page
# page = Nokogiri::HTML(open("http://students.flatironschool.com/students/chrisgonzales.html"))
# student_name = page.search("h4").first.text
# quote = page.search("h3").first.text
# scraped_database = SQLite3::Database.new ":scraped_data:"
require 'nokogiri'
require 'sqlite3'
require 'open-uri'
# def comb_page
# page = Nokogiri::HTML(open("http://students.flatironschool.com/students/chrisgonzales.html"))
# student_name = page.search("h4").first.text
# quote = page.search("h3").first.text
# scraped_database = SQLite3::Database.new ":scraped_data:"
@joegiralt
joegiralt / day6homework5.rb
Created June 11, 2013 00:44
hashkett ball
# Great news! You're going to an NBA game! The only catch is that you've been volunteered to keep stats at the game.
# Using Nested Hashes, define a game, with two teams, their players, and the players stats:
# The game has two teams.
# A team has:
# A name
# Two colors
# Each team should have at least 5 players
# Each player should have a:
@joegiralt
joegiralt / day6homework4.rb
Created June 10, 2013 22:13
tempaturebot
# Temperature bot is American but takes Celsius temperatures.
#
def temperature_bot(temp)
case temp
when temp <= 21 && 18 <= temp
"I like this temperature"
else
"This is uncomfortable for me"
end
end
@joegiralt
joegiralt / day6homework3.rb
Created June 10, 2013 22:08
method chaining
# Chain at least 5 method calls to an object. Reduce this operation one chain at a time.
# Don't just use the methods below, make up your own chain and try to see if you can do something fun with Ruby like in the example.
# Example:
# puts "start".reverse.slice(0,2).concat("uth").capitalize
# # => Truth
# Because:
# Create Hashes for the following use-cases.
# A movie collection that organizes by genres
movies = {
"horror" => ["night of the living dead", "exorcist"],
"adventure" => ["return of the jedi", "romancing the stone"],
"comedy" => ["dumb and dumber", "fargo"]
@joegiralt
joegiralt / day6homework1.rb
Last active December 18, 2015 08:09
homework
# Construct an array with your favorite foods. It should have at least 5 elements.
favorite_foods = ["Chicken tikka Masalla",
"Roasted Rabbit",
"Fried Ocra",
"Chanterelle Mushroom Soup",
"Pan Seared Skirt Steak"]
# Write a puts which returns your most favorite food out of the array.
@joegiralt
joegiralt / jukebox.rb
Created June 10, 2013 18:30
jukebox app
# jukebox.rb
songs = [
"The Phoenix - 1901",
"Tokyo Police Club - Wait Up",
"Sufjan Stevens - Too Much",
"The Naked and the Famous - Young Blood",
"(Far From) Home - Tiga",
"The Cults - Abducted",
songs = [
"The Phoenix - 1901",
`open http://www.youtube.com/watch?v=HL548cHH3OY`
"Tokyo Police Club - Wait Up",
`open http://www.youtube.com/watch?v=VARmJlPu6i4`
"Sufjan Stevens - Too Much",
`open http://www.youtube.com/watch?v=K0g7R3xqdcM`
@joegiralt
joegiralt / Homework 4.rb
Last active December 18, 2015 05:59
homework Fizz Buzz
def fizzbuzz(count_up_to)
number = 1
for number in 1..count_up_to
print "FizZ" if number%3 == 0
print "BuzZ" if number%5 == 0
puts "\n"
puts number unless (number%3 == 0) || (number%5 == 0)
puts "\n"
end
end