This file contains hidden or 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
| individual_student_page = Nokogiri::HTML(open('http://students.flatironschool.com/students/vivianzhang.html')) | |
| ###get name | |
| student_name_partial = individual_student_page.css("body div h4") | |
| student_name = student_name_partial.text ###Final Student Name | |
| ###end get name |
This file contains hidden or 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. | |
| SELECT project.title, SUM(pledge.amount) AS 'total' | |
| FROM | |
| project | |
| INNER JOIN | |
| pledge | |
| ON | |
| project.id = pledge.project_id | |
| GROUP BY | |
| project.title; |
This file contains hidden or 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 './song_library.rb' | |
| def jukebox(command) | |
| if command.downcase == "list" | |
| list_library(full_library) | |
| else | |
| parse_command(command) | |
| end | |
| end | |
This file contains hidden or 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
| pigeon_data = { | |
| :color => { | |
| :purple => ["Theo", "Peter Jr.", "Lucky"], | |
| :grey => ["Theo", "Peter Jr.", "Ms .K"], | |
| :white => ["Queenie", "Andrew", "Ms .K", "Alex"], | |
| :brown => ["Queenie", "Alex"] | |
| }, | |
| :gender => { | |
| :male => ["Alex", "Theo", "Peter Jr.", "Andrew", "Lucky"], | |
| :female => ["Queenie", "Ms .K"] |
This file contains hidden or 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 'json' | |
| require 'rest_client' | |
| reddit_hash = JSON.parse(RestClient.get('http://reddit.com/.json')) | |
| over_18 = [] | |
| title = [] | |
| reddit_url = [] | |
| thumbnail = [] | |
| upvotes = [] |
This file contains hidden or 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
| #Tower of Hanoi | |
| #rules: | |
| # arrays will be the pegs | |
| # each array goes from top on left to bottom on right | |
| # win/stop when c = [1,2,3,4] | |
| #pieces cannot go to a space where a lower number is farther into the array. | |
| def move_disc | |
| a = [1,2,3,4] |
This file contains hidden or 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. holiday_supplies[:summer][:forth_of_july][1] | |
| 2. holiday_supplies[:winter][:christmas] << "Tree" | |
| 3. holiday_supplies[:spring][:memorial_day] << "Charcoal" | |
| 4. holiday_supplies[:summer].merge!(:august_second => ["cake", "booze"]) | |
| 5. |
This file contains hidden or 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
| # overall hash | |
| # 2 subhashes, team 1 and team 2 | |
| # each team has 3 subhashes name, colors, players | |
| # name = just pointer | |
| # colors = array | |
| # players = array | |
| # player has the following hashes in an array: name, number, shoe_size, points, rebounds, assists, steals, blocks, slam_dunks | |
| hashketball = |
This file contains hidden or 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
| #Jukebox Program | |
| #Greeting and setup for the program. | |
| puts "Hello and welcome to the jukebox." | |
| puts "Please let me know your name..." | |
| name = gets.chomp | |
| puts "" | |
| puts "Okay #{name.capitalize}, let me tell you how this works." | |
| puts "" | |
| puts "You can type any of the following commands..." |
This file contains hidden or 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(number) | |
| array = number.split("") | |
| finalnum = [] | |
| array.each do |var| | |
| if "1,2,3,4,5,6,7,8,9,0".include?(var) | |
| finalnum << var | |
| end | |
| end |