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
const authorization = "Bearer sk_9d181e5372e526fc69209f9e64dae0d0"; | |
// 1. Select our form to get our input | |
const form = document.querySelector('#clearbitForm'); | |
// store all other HTML elements (for enriched info) | |
const userName = document.querySelector('#userName'); | |
const userEmail = document.querySelector('#userEmail'); | |
const userBio = document.querySelector('#userBio'); | |
const userLocation = document.querySelector('#userLocation'); | |
const userInput = form.querySelector("#clearbitEmail"); |
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
console.log("Hello everyone!"); | |
let count = 1; | |
console.log(count) | |
count = count + 1; | |
console.log(count); |
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 'cookbook' # You need to create this file! | |
require_relative 'controller' # You need to create this file! | |
require_relative 'router' | |
csv_file = File.join(__dir__, 'recipes.csv') | |
cookbook = Cookbook.new(csv_file) | |
controller = Controller.new(cookbook) | |
router = Router.new(controller) |
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 Repository | |
def initialize | |
@tasks = [] | |
end | |
def add(task) | |
@tasks << task | |
end | |
def all |
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 Chef | |
attr_reader :name, :restaurant | |
def initialize(name, restaurant) | |
@name = name # String | |
@restaurant = restaurant # Instance of Restaurant (not a STRING !!!) | |
end | |
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
require "yaml" | |
require_relative "scraper" | |
# fetch array of urls | |
puts "Fetching URLs" | |
urls = fetch_movie_urls | |
# return an array of hashes of movie details | |
movies = urls.map do |url| | |
puts "Scraping #{url}" |
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 'json' | |
require 'open-uri' | |
puts "Give username:" | |
print "> " | |
username = gets.chomp | |
# TODO - Let's fetch name and bio from a given GitHub username | |
url = "https://api.github.com/users/#{username}" |
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 frequencies(text) | |
# intro downcase the string, and create an empty hash | |
frequency = {} | |
text = text.downcase | |
# 1. split the string into an array of words | |
words = text.split | |
# words => ["the", "lazy", ...] | |
# 2. iterate over the array | |
words.each do |word| |
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
cities = ["london", "paris", "berlin"] | |
# 0 1 2 | |
# CREATE | |
# cities.push("olso") | |
cities << "madrid" | |
# READ | |
# p cities.last | |
p cities[3] |
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 acronymize(string) | |
string.split(" ").map { |word| word[0].upcase }.join | |
end |
NewerOlder