First we will remove node and yarn
brew uninstall yarn
brew uninstall node
brew uninstall node@8
Turbolinks is a JavaScript library that intercepts all clicks on <a>
links and makes that request via AJAX.
It then merges the <head>
and replaces the current page <body>
with the new body from the AJAX HTML response.
The promise:
require_relative "../models/employee" | |
require 'sqlite3' | |
class EmployeesRepository | |
def initialize | |
@db = SQLite3::Database.new('./food_delivery.sqlite3') | |
@db.results_as_hash = true | |
@employees = [] | |
load_employees_from_db | |
end |
# we use the match method to extract the data from original string | |
# find the gender | |
# find the birth year | |
# find the birth month | |
# find the dept | |
# validate the number | |
require 'date' | |
DEPT = { | |
75 => "Paris", | |
76 => "Seine-Maritime" |
require "sqlite3" | |
require_relative "../models/employee" | |
class EmployeesRepository | |
def initialize | |
@db = SQLite3::Database.new('food_delivery.db') | |
@db.results_as_hash = true | |
@employees = [] | |
load_from_db | |
end |
require 'open-uri' # Open an url | |
require 'nokogiri' # HTML ==> Nokogiri Document | |
url = "http://www.imdb.com/chart/top" | |
html = open(url).read | |
html_doc = Nokogiri::HTML(html) | |
html_doc.search('.titleColumn a').each do |element| | |
title = element.text | |
link = element.attribute('href') |
require 'open-uri' | |
require 'nokogiri' | |
url = 'http://www.letscookfrench.com/recipes/find-recipe.aspx?aqt=chocolate' | |
html_file = open(url).read | |
html_doc = Nokogiri::HTML(html_file) | |
html_doc.search('.m_contenu_resultat').each do |element| | |
p element.search('.m_titre_resultat a').text |
require "date" | |
REG = /^(?<gender>[12])(?<year>\d{2})(?<month>\d{2})(?<dept>\d{2})\d{6}(?<key>\d{2})/ | |
DEPARTEMENT = { | |
"75" => "Paris", | |
"76" => "Seine Maritime" | |
} | |
def ssn_info(ssn) | |
# TODO => "a man, born in March, 1986 in Paris." | |
ssn = ssn.gsub(" ","") | |
result = ssn.match(REG) |