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 'scraper' | |
require "yaml" | |
# return all top 5 movie urls | |
# for each movie url, scrape the movie details | |
# for all the movie details, add to a yaml file | |
puts "Fetching URLs" | |
urls = fetch_movie_urls |
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
# loop over students & list with numbered bullets | |
# for loop | |
# students = ['harry', 'hermione', 'ron'] | |
# for student in students | |
# puts student | |
# end | |
# 1. harry |
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
# Write a method that return the acronym of a sentence | |
# define our method | |
# put in our test cases | |
# split our string sentence | |
# get the first letter of each word (upcase it) | |
# chuck upcased letter into our array | |
# join our array together & print it out | |
# GLOBAL_ARRAY = [] |
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. What's a relational database? | |
Set of tables linked through primary & foreign keys. This database type is based around relationships between tables. | |
# 2. What are the different table relationships you know? | |
1:1, 1:N (One to Many), N:N (Many to Many; needs a join table) | |
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 'pry' | |
# Pseudo-Code | |
# Build our Hero Class | |
# Create our initialize method | |
# As a user, I want to READ (ALL) heroes first | |
# As a user, I want to READ a specific hero (FIND) | |
# As a user, I want to CREATE a new hero (CREATE) | |
# As a user, I want to UPDATE an existing hero (UPDATE) | |
# As a user, I want to DESTROY an existing hero (DESTROY) |
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 "sqlite3" | |
require 'pry' | |
DB = SQLite3::Database.new("doctor.sqlite") | |
# RELATIONSHIPS | |
# 1:N (One-to-Many) | |
## table_one BELONGS TO one of table_two | |
## table_two HAS MANY of table_one |
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
### List all customers (name + email), ordered alphabetically (no extra information) | |
```sql | |
SELECT first_name, last_name, email FROM customers | |
ORDER BY last_name | |
# Should yield 59 results | |
``` | |
### List tracks (Name + Composer) of the Classical playlist |
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 'nokogiri' | |
require 'open-uri' | |
require 'csv' | |
require 'pry' | |
def list_items(list) | |
list.each_with_index do |item, index| | |
puts "#{index + 1}. [#{item[:bought] ? 'X' : ' '}] - #{item[:name]} - #{item[:price]}" | |
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
require 'nokogiri' | |
require 'open-uri' | |
def list_items(list) | |
list.each_with_index do |item, index| | |
puts "#{index + 1}. [#{item[:bought] ? 'X' : ' '}] - #{item[:name]} - #{item[:price]}" | |
end | |
end | |
def scraper(keyword) |
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 list_items(list) | |
list.each_with_index do |item, index| | |
puts "#{index + 1}. [#{item[:bought] ? 'X' : ' '}] - #{item[:name]} - #{item[:price]}" | |
end | |
end |
NewerOlder