clean repo on right origin
4
ML/udemy/.vscode/settings.json
vendored
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"python.pythonPath": "/home/chris/Projects/_LAB/training/ML/udemy/.env/bin/python3.7",
|
||||
"python.linting.enabled": true
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
Country,Age,Salary,Purchased
|
||||
France,44,72000,No
|
||||
Spain,27,48000,Yes
|
||||
Germany,30,54000,No
|
||||
Spain,38,61000,No
|
||||
Germany,40,,Yes
|
||||
France,35,58000,Yes
|
||||
Spain,,52000,No
|
||||
France,48,79000,Yes
|
||||
Germany,50,83000,No
|
||||
France,37,67000,Yes
|
|
|
@ -1,16 +0,0 @@
|
|||
# Data preprocessing
|
||||
import pandas as pd
|
||||
from sklearn.model_selection import train_test_split
|
||||
|
||||
# Importing the dataset
|
||||
dataset = pd.read_csv('Data.csv')
|
||||
X = dataset.iloc[:, :-1].values
|
||||
y = dataset.iloc[:, 3].values
|
||||
|
||||
X_train, X_test, y_train, y_test = train_test_split(
|
||||
X, y, test_size=0.2, random_state=0)
|
||||
|
||||
# feature scaling
|
||||
# sc_X = StandardScaler()
|
||||
# X_train = sc_X.fit_transform(X_train)
|
||||
# X_test = sc_X.fit_transform(X_test)
|
|
@ -1,19 +0,0 @@
|
|||
# Data preprocessing
|
||||
|
||||
# Import the dataset
|
||||
dataset = read.csv("Data.csv")
|
||||
|
||||
# Taking care of the missing data
|
||||
dataset$Age = ifelse(is.na(dataset$Age),
|
||||
ave(dataset$Age, FUN = function(x) mean(x, na.rm = TRUE)),
|
||||
dataset$Age)
|
||||
|
||||
dataset$Salary = ifelse(is.na(dataset$Salary),
|
||||
ave(dataset$Salary, FUN = function(x) mean(x, na.rm = TRUE)),
|
||||
dataset$Salary)
|
||||
|
||||
# Encoding categorical data
|
||||
# ! c is a vector
|
||||
dataset$Country = factor(dataset$Country, levels=c('France', 'Spain', 'Germany'), labels=c(1, 2, 3))
|
||||
|
||||
dataset$Purchased= factor(dataset$Purchased, levels=c('No', 'Yes'), labels=c(0, 1))
|
|
@ -1,44 +0,0 @@
|
|||
# Data preprocessing
|
||||
from sklearn.preprocessing import StandardScaler
|
||||
from sklearn.model_selection import train_test_split
|
||||
from sklearn.preprocessing import Imputer, LabelEncoder, OneHotEncoder
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
import pandas as pd
|
||||
|
||||
# Importing the dataset
|
||||
dataset = pd.read_csv('Data.csv')
|
||||
# Create the matrix of features (independant variables)
|
||||
# [:, = lines -- all of them
|
||||
# :-1] = colums -- all of them unless the last one
|
||||
# X = (Country, Age, Salary)
|
||||
X = dataset.iloc[:, :-1].values
|
||||
# Create vector of linked variables
|
||||
# [:, 3] = all values of the 3rd column
|
||||
# Y = (Purchased)
|
||||
y = dataset.iloc[:, 3].values
|
||||
|
||||
# Taking care of the missing data
|
||||
|
||||
imputer = Imputer(missing_values='NaN', strategy='mean', axis=0)
|
||||
imputer = imputer.fit(X[:, 1:3])
|
||||
X[:, 1:3] = imputer.transform(X[:, 1:3])
|
||||
|
||||
# Encoding categorical data
|
||||
labelencoder_X = LabelEncoder()
|
||||
X[:, 0] = labelencoder_X.fit_transform(X[:, 0])
|
||||
onehotencoder = OneHotEncoder()
|
||||
X = onehotencoder.fit_transform(X).toarray()
|
||||
labelencoder_y = LabelEncoder()
|
||||
y = labelencoder_y.fit_transform(y)
|
||||
|
||||
|
||||
# splitting into a training and a test set
|
||||
# test_size is the amount of data that we are going to send in the test set
|
||||
X_train, X_test, y_train, y_test = train_test_split(
|
||||
X, y, test_size=0.2, random_state=0)
|
||||
|
||||
# feature scaling
|
||||
sc_X = StandardScaler()
|
||||
X_train = sc_X.fit_transform(X_train)
|
||||
X_test = sc_X.fit_transform(X_test)
|
|
@ -1,31 +0,0 @@
|
|||
YearsExperience,Salary
|
||||
1.1,39343.00
|
||||
1.3,46205.00
|
||||
1.5,37731.00
|
||||
2.0,43525.00
|
||||
2.2,39891.00
|
||||
2.9,56642.00
|
||||
3.0,60150.00
|
||||
3.2,54445.00
|
||||
3.2,64445.00
|
||||
3.7,57189.00
|
||||
3.9,63218.00
|
||||
4.0,55794.00
|
||||
4.0,56957.00
|
||||
4.1,57081.00
|
||||
4.5,61111.00
|
||||
4.9,67938.00
|
||||
5.1,66029.00
|
||||
5.3,83088.00
|
||||
5.9,81363.00
|
||||
6.0,93940.00
|
||||
6.8,91738.00
|
||||
7.1,98273.00
|
||||
7.9,101302.00
|
||||
8.2,113812.00
|
||||
8.7,109431.00
|
||||
9.0,105582.00
|
||||
9.5,116969.00
|
||||
9.6,112635.00
|
||||
10.3,122391.00
|
||||
10.5,121872.00
|
|
|
@ -1,33 +0,0 @@
|
|||
# Data preprocessing
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
from sklearn.model_selection import train_test_split
|
||||
from sklearn.linear_model import LinearRegression
|
||||
|
||||
# Importing the dataset
|
||||
dataset = pd.read_csv('Salary_Data.csv')
|
||||
X = dataset.iloc[:, :-1].values
|
||||
y = dataset.iloc[:, 1].values
|
||||
|
||||
X_train, X_test, y_train, y_test = train_test_split(
|
||||
X, y, test_size=0.2, random_state=0)
|
||||
|
||||
# Fitting Simple Linear Regreesion to the Training set
|
||||
regressor = LinearRegression()
|
||||
regressor.fit(X_train, y_train)
|
||||
|
||||
# Prediction the Test set result
|
||||
# y_pred contains the predicted salary from the test sample, y_test is the actual salary.
|
||||
y_pred = regressor.predict(X_test)
|
||||
|
||||
# Visualize the data
|
||||
# data use to train the regression
|
||||
plt.scatter(X_train, y_train, color='red')
|
||||
# actual data we compared with our trained regression
|
||||
plt.scatter(X_test, y_test, color='green')
|
||||
plt.plot(X_train, regressor.predict(X_train), color='blue')
|
||||
plt.title('Salary vs experience (training set)')
|
||||
plt.xlabel('years of experience')
|
||||
plt.ylabel('salary')
|
||||
plt.show()
|
|
@ -1,15 +0,0 @@
|
|||
# SECTION 2
|
||||
* you need to split the training set and a test set to balance the machine learning (you train on the test set and test those assumptions on the test set)
|
||||
? what is categorical data, why whould you use it?
|
||||
|
||||
* feature scaling: put all values on the same scale so the larger number do not destroy other numbers => standardisation ou normalisation
|
||||
|
||||
# Linear regression
|
||||
|
||||
Formula: `y = b0 + b1*x1`
|
||||
|
||||
y is the dependent variable. What is the value that changes in our model, the part that we want to understand from the work. How is this value changing.
|
||||
|
||||
x is the independant variable, the one that has an implied association with y.
|
||||
|
||||
b1 is the coef for the independant variable, how a unit change in x1.
|
|
@ -1,17 +0,0 @@
|
|||
# Data preprocessing
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
from sklearn.model_selection import train_test_split
|
||||
|
||||
# Importing the dataset
|
||||
dataset = pd.read_csv('Data.csv')
|
||||
X = dataset.iloc[:, :-1].values
|
||||
y = dataset.iloc[:, 3].values
|
||||
|
||||
X_train, X_test, y_train, y_test = train_test_split(
|
||||
X, y, test_size=0.2, random_state=0)
|
||||
|
||||
# feature scaling
|
||||
# sc_X = StandardScaler()
|
||||
# X_train = sc_X.fit_transform(X_train)
|
||||
# X_test = sc_X.fit_transform(X_test)
|
79
api/races.go
Normal file
|
@ -0,0 +1,79 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// GetResultsFromErgast retrieves the results of the races from Ergast API.
|
||||
func GetResultsFromErgast(year string) {
|
||||
resp, err := http.Get("http://ergast.com/api/f1/results" + year + ".json")
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
var jsonData MRData
|
||||
err = json.Unmarshal(body, &jsonData)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
}
|
||||
fmt.Println(jsonData)
|
||||
}
|
||||
|
||||
/**
|
||||
MRDATA {
|
||||
RaceTable {
|
||||
Races [
|
||||
{
|
||||
season
|
||||
round
|
||||
url
|
||||
raceName
|
||||
date
|
||||
time
|
||||
|
||||
Circuit {
|
||||
|
||||
},
|
||||
Results " [
|
||||
number,
|
||||
position,
|
||||
points,
|
||||
Driver {}
|
||||
Constructor {}
|
||||
grid
|
||||
laps
|
||||
status
|
||||
Time {
|
||||
millis
|
||||
time
|
||||
}
|
||||
FastestLap {
|
||||
rank
|
||||
lap
|
||||
Time {
|
||||
time
|
||||
}
|
||||
AverageSpeed {
|
||||
units
|
||||
speed
|
||||
}
|
||||
}
|
||||
]"
|
||||
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
**/
|
|
@ -1,7 +0,0 @@
|
|||
iteration = 0
|
||||
count = 0
|
||||
while iteration < 5:
|
||||
for letter in "hello, world":
|
||||
count += 1
|
||||
print("Iteration " + str(iteration) + "; count is: " + str(count))
|
||||
iteration += 1
|
|
@ -1,6 +0,0 @@
|
|||
for iteration in range(5):
|
||||
count = 0
|
||||
while True:
|
||||
for letter in "hello, world":
|
||||
count += 1
|
||||
print("Iteration " + str(iteration) + "; count is: " + str(count))
|
|
@ -1,7 +0,0 @@
|
|||
for iteration in range(5):
|
||||
count = 0
|
||||
while True:
|
||||
for letter in "hello, world":
|
||||
count += 1
|
||||
print("Iteration " + str(iteration) + "; count is: " + str(count))
|
||||
break
|
|
@ -1,8 +0,0 @@
|
|||
count = 0
|
||||
phrase = "hello, world"
|
||||
for iteration in range(5):
|
||||
index = 0
|
||||
while index < len(phrase):
|
||||
count += 1
|
||||
index += 1
|
||||
print("Iteration " + str(iteration) + "; count is: " + str(count))
|
|
@ -1,7 +0,0 @@
|
|||
count = 0
|
||||
phrase = "hello, world"
|
||||
for iteration in range(5):
|
||||
while True:
|
||||
count += len(phrase)
|
||||
break
|
||||
print("Iteration " + str(iteration) + "; count is: " + str(count))
|
|
@ -1,5 +0,0 @@
|
|||
count = 0
|
||||
phrase = "hello, world"
|
||||
for iteration in range(5):
|
||||
count += len(phrase)
|
||||
print("Iteration " + str(iteration) + "; count is: " + str(count))
|
|
@ -1,16 +0,0 @@
|
|||
# Assume s is a string of lower case characters.
|
||||
|
||||
# Write a program that counts up the number of vowels contained in the string s. Valid vowels are: 'a', 'e', 'i', 'o', and 'u'. For example, if s = 'azcbobobegghakl', your program should print:
|
||||
|
||||
# Number of vowels: 5
|
||||
s = 'obbbobobkobobonboobldhbobboobybobbobob'
|
||||
|
||||
|
||||
bob = 'bob'
|
||||
count = 0
|
||||
|
||||
for i in range(len(s)):
|
||||
if s.startswith('bob', i):
|
||||
count += 1
|
||||
|
||||
print("Number of bobs:", count)
|
|
@ -1,11 +0,0 @@
|
|||
import string
|
||||
|
||||
alphabet = string.ascii_lowercase
|
||||
|
||||
s = 'azcbobobegghakl'
|
||||
count = 0
|
||||
print(alphabet)
|
||||
|
||||
for i in s:
|
||||
print i
|
||||
print index(i)
|
|
@ -1,15 +0,0 @@
|
|||
x = 23
|
||||
epsilon = 0.01
|
||||
step = 0.1
|
||||
guess = 0.0
|
||||
|
||||
while abs(guess**2-x) >= epsilon:
|
||||
if guess <= x:
|
||||
guess += step
|
||||
else:
|
||||
break
|
||||
|
||||
if abs(guess**2 - x) >= epsilon:
|
||||
print('failed')
|
||||
else:
|
||||
print('succeeded: ' + str(guess))
|
|
@ -1,38 +0,0 @@
|
|||
print("Please think of a number between 0 and 100!")
|
||||
guess = input()
|
||||
|
||||
computer_guess = 50
|
||||
user_input = ""
|
||||
correct_input = False
|
||||
|
||||
def checkUserInput(user_input):
|
||||
if user_input == 'l' or user_input == 'h' or user_input == 'c':
|
||||
return True
|
||||
else:
|
||||
print("Sorry, I did not understand your input.")
|
||||
return False
|
||||
|
||||
def checkValue(user_input, guess):
|
||||
if user_input == 'h':
|
||||
new_guess = guess//2
|
||||
return new_guess
|
||||
elif user_input == 'l':
|
||||
new_guess = guess + guess//2
|
||||
return new_guess
|
||||
elif user_input == 'c':
|
||||
return guess
|
||||
else:
|
||||
raise ValueError
|
||||
|
||||
while guess != computer_guess:
|
||||
print("Is your secret number", computer_guess, "?")
|
||||
print("Enter 'h' to indicate the guess is too high. Enter 'l' to indicate the guess is too low. Enter 'c' to indicate I guessed correctly.")
|
||||
user_input = input()
|
||||
if correct_input == False:
|
||||
correct_input = checkUserInput(user_input)
|
||||
computer_guess = checkValue(user_input, computer_guess)
|
||||
else:
|
||||
computer_guess = checkValue(user_input, computer_guess)
|
||||
|
||||
|
||||
print("Game over. Your secret number was:", computer_guess)
|
|
@ -1,13 +0,0 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
sum := 0
|
||||
for i := 0; i < 1000; i++ {
|
||||
if i%3 == 0 || i%5 == 0 {
|
||||
sum += i
|
||||
}
|
||||
}
|
||||
fmt.Print(sum)
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
const max = 4000000
|
||||
|
||||
func isEven(b int) bool {
|
||||
res := b % 2
|
||||
if res == 0 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func main() {
|
||||
a, c, sum := 1, 3, 0
|
||||
|
||||
for b := 1; b < max; b++ {
|
||||
if isEven(b) {
|
||||
sum += b
|
||||
c = (a + b)
|
||||
a, b = b, c
|
||||
fmt.Println(c, "=", a, "+", b)
|
||||
}
|
||||
}
|
||||
fmt.Println(sum)
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
const numToString = "731671765313306249192251196744265747423553491949349698352031277450632623957831801698480186947885184385861560789112949495459501737958331952853208805511254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450"
|
||||
|
||||
func multiply(n string) (res int, err error) {
|
||||
if len(n) <= 0 {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
for i := 0; i < len(n); i++ {
|
||||
m, err := strconv.Atoi(string([]rune(n)[i]))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
res = m * res
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
first13 := numToString[:13]
|
||||
res, err := multiply(first13)
|
||||
if err != nil {
|
||||
fmt.Print(err)
|
||||
}
|
||||
fmt.Print(res)
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
Resolution for projet euler in ruby
|
|
@ -1,5 +0,0 @@
|
|||
# Solution for the sum of all number multiple of 3 or 5 between 1 and 999
|
||||
|
||||
sum = (1..999).select {|n| n % 5 == 0 || n % 3 == 0}
|
||||
result = sum.inject(:+)
|
||||
print result
|
|
@ -1,16 +0,0 @@
|
|||
max = 4_000_000
|
||||
a, b = 1, 2
|
||||
c = 3
|
||||
sum = 0
|
||||
|
||||
while b < max do
|
||||
sum += b if b % 2 == 0
|
||||
c = (a + b)
|
||||
puts "#{c} = #{a} + #{b}"
|
||||
a, b = b, c
|
||||
|
||||
end
|
||||
|
||||
|
||||
puts sum
|
||||
# 4613732
|
|
@ -1,5 +0,0 @@
|
|||
# Prime numbers of a number
|
||||
|
||||
require 'prime'
|
||||
|
||||
puts 600851475143.prime_division
|
|
@ -1,24 +0,0 @@
|
|||
# A palindromic number reads the same both ways. The largest palindrome made from the
|
||||
# product of two 2-digit numbers is 9009 = 91 × 99.
|
||||
|
||||
# Find the largest palindrome made from the product of two 3-digit numbers.
|
||||
|
||||
x = 0
|
||||
b = 100
|
||||
y = []
|
||||
|
||||
while b < 1000
|
||||
a = 100
|
||||
while a < 1000
|
||||
x = a * b
|
||||
x = x.to_s
|
||||
if x == x.reverse
|
||||
y << x.to_i
|
||||
end
|
||||
a += 1
|
||||
end
|
||||
b += 1
|
||||
end
|
||||
|
||||
puts y.sort.max
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
# 2520 is the smallest number that can be divided by each
|
||||
# of the numbers from 1 to 10 without any remainder.
|
||||
|
||||
# What is the smallest positive number that is evenly
|
||||
# divisible by all of the numbers from 1 to 20?
|
||||
|
||||
x = 1
|
||||
n = 10
|
||||
a = (1..n)
|
||||
|
||||
class Integer
|
||||
def factors() (1..self).select { |n| (self % n).zero? } end
|
||||
end
|
||||
|
||||
puts x.factors
|
||||
|
||||
unless x.to_a.length == 10
|
||||
x +=1
|
||||
x.factors
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
require "pry"
|
||||
NUM = "7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450"
|
||||
NUM2 = NUM.split("")
|
||||
puts "starting... with #{NUM2.size}"
|
||||
return -1 if NUM.size != NUM2.size
|
||||
res = []
|
||||
puts "original size of num: #{NUM2.size}"
|
||||
until NUM2.size == 0
|
||||
puts "in the loop"
|
||||
itr = []
|
||||
NUM2.first(13).each { |n| itr << n.to_i }
|
||||
res << itr.inject(:*)
|
||||
NUM2.shift(1)
|
||||
puts "loop done #{NUM2.size} "
|
||||
end
|
||||
|
||||
puts res.max
|
3
go.sum
|
@ -10,6 +10,7 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF
|
|||
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/denisenkom/go-mssqldb v0.0.0-20190515213511-eb9f6a1743f3 h1:tkum0XDgfR0jcVVXuTsYv/erY2NnEDqwRojbxR1rBYA=
|
||||
github.com/denisenkom/go-mssqldb v0.0.0-20190515213511-eb9f6a1743f3/go.mod h1:zAg7JM8CkOJ43xKXIj7eRO9kmWm/TW578qo+oDO6tuM=
|
||||
|
@ -63,6 +64,7 @@ github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa
|
|||
github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
|
||||
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs=
|
||||
|
@ -75,6 +77,7 @@ github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqn
|
|||
github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
|
|
3
leetcode/.vscode/settings.json
vendored
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"go.formatTool": "goimports"
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package twoSums
|
||||
|
||||
func twoSums(nums []int, target int) []int {
|
||||
|
||||
}
|
8
main.go
|
@ -11,9 +11,11 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
year := time.Now().Year()
|
||||
year := strconv.Itoa(time.Now().Year())
|
||||
|
||||
fmt.Println("Hello there! It is", year)
|
||||
db.InitDB()
|
||||
api.GetSeasonFromErgast(strconv.Itoa(year))
|
||||
api.GetDriversFromErgast(strconv.Itoa(year))
|
||||
api.GetSeasonFromErgast(year)
|
||||
api.GetDriversFromErgast(year)
|
||||
api.GetResultsFromErgast(year)
|
||||
}
|
||||
|
|
25
react/.gitignore
vendored
|
@ -1,25 +0,0 @@
|
|||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
node_modules
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
.vscode/
|
23
react/11/videos/.gitignore
vendored
|
@ -1,23 +0,0 @@
|
|||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
|
@ -1,68 +0,0 @@
|
|||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
||||
|
||||
## Available Scripts
|
||||
|
||||
In the project directory, you can run:
|
||||
|
||||
### `yarn start`
|
||||
|
||||
Runs the app in the development mode.<br />
|
||||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
||||
|
||||
The page will reload if you make edits.<br />
|
||||
You will also see any lint errors in the console.
|
||||
|
||||
### `yarn test`
|
||||
|
||||
Launches the test runner in the interactive watch mode.<br />
|
||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
||||
|
||||
### `yarn build`
|
||||
|
||||
Builds the app for production to the `build` folder.<br />
|
||||
It correctly bundles React in production mode and optimizes the build for the best performance.
|
||||
|
||||
The build is minified and the filenames include the hashes.<br />
|
||||
Your app is ready to be deployed!
|
||||
|
||||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
||||
|
||||
### `yarn eject`
|
||||
|
||||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
||||
|
||||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
||||
|
||||
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
||||
|
||||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
||||
|
||||
## Learn More
|
||||
|
||||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
||||
|
||||
To learn React, check out the [React documentation](https://reactjs.org/).
|
||||
|
||||
### Code Splitting
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
|
||||
|
||||
### Analyzing the Bundle Size
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
|
||||
|
||||
### Making a Progressive Web App
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
|
||||
|
||||
### Advanced Configuration
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
|
||||
|
||||
### Deployment
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
|
||||
|
||||
### `yarn build` fails to minify
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
|
13190
react/11/videos/package-lock.json
generated
|
@ -1,33 +0,0 @@
|
|||
{
|
||||
"name": "videos",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"axios": "^0.18.1",
|
||||
"prettier": "^1.18.2",
|
||||
"react": "^16.10.2",
|
||||
"react-dom": "^16.10.2",
|
||||
"react-scripts": "3.2.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "react-app"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 22 KiB |
|
@ -1,44 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta name="description" content="Web site created using create-react-app" />
|
||||
<link rel="apple-touch-icon" href="logo192.png" />
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css">
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>React App</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
|
||||
</html>
|
Before Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 22 KiB |
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "logo192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "logo512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
|
@ -1,11 +0,0 @@
|
|||
import axios from 'axios'
|
||||
const KEY = 'AIzaSyBjzN0gXaIraNOj8XiuvANWlPe2jdTyBf4'
|
||||
|
||||
export default axios.create({
|
||||
baseURL: 'https://www.googleapis.com/youtube/v3',
|
||||
params: {
|
||||
part: 'snippet',
|
||||
maxResults: 5,
|
||||
key: KEY,
|
||||
}
|
||||
})
|
|
@ -1,54 +0,0 @@
|
|||
import React from "react";
|
||||
import SearchBar from "./SearchBar";
|
||||
import youtube from "../apis/youtube";
|
||||
import VideoList from "./VideoList";
|
||||
import VideoDetail from "./VideoDetail";
|
||||
|
||||
class App extends React.Component {
|
||||
state = { videos: [] };
|
||||
|
||||
componentDidMount() {
|
||||
this.onTermSubmit("buildings");
|
||||
}
|
||||
|
||||
onTermSubmit = async term => {
|
||||
const response = await youtube.get("/search", {
|
||||
params: {
|
||||
q: term
|
||||
}
|
||||
});
|
||||
|
||||
this.setState({
|
||||
videos: response.data.items,
|
||||
selectedVideo: response.data.items[0]
|
||||
});
|
||||
};
|
||||
|
||||
onVideoSelect = video => {
|
||||
this.setState({ selectedVideo: video });
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="ui container">
|
||||
<SearchBar onFormSubmit={this.onTermSubmit} />
|
||||
<div className="ui grid">
|
||||
<div className="ui row">
|
||||
<div className="eleven wide column">
|
||||
<VideoDetail video={this.state.selectedVideo} />
|
||||
</div>
|
||||
|
||||
<div className="five wide column">
|
||||
<VideoList
|
||||
onVideoSelect={this.onVideoSelect}
|
||||
videos={this.state.videos}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default App;
|
|
@ -1,28 +0,0 @@
|
|||
import React from 'react'
|
||||
|
||||
class SearchBar extends React.Component {
|
||||
state = { term: "" }
|
||||
|
||||
onInputChange = event => {
|
||||
this.setState({ term: event.target.value })
|
||||
}
|
||||
|
||||
onFormSubmit = event => {
|
||||
event.preventDefault()
|
||||
this.props.onFormSubmit(this.state.term)
|
||||
}
|
||||
|
||||
render() {
|
||||
return <div className="ui segment search-bar">
|
||||
<form action="" className="ui form" onSubmit={this.onFormSubmit}>
|
||||
<div className="field">
|
||||
<label htmlFor="">Search</label>
|
||||
<input type="text" value={this.state.term} onChange={this.onInputChange} />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default SearchBar
|
|
@ -1,22 +0,0 @@
|
|||
import React from "react";
|
||||
|
||||
const VideoDetail = ({ video }) => {
|
||||
if (!video) {
|
||||
return <div>Loading...</div>;
|
||||
}
|
||||
|
||||
const videoSrc = `https://youtube.com/embed/${video.id.videoId}`;
|
||||
return (
|
||||
<div>
|
||||
<div className="ui embed">
|
||||
<iframe title="unique" src={videoSrc} frameborder="0"></iframe>
|
||||
</div>
|
||||
<div className="ui segment">
|
||||
<h4 className="ui header">{video.snippet.title}</h4>
|
||||
<p>{video.snippet.description}</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default VideoDetail;
|
|
@ -1,9 +0,0 @@
|
|||
.video-item {
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.video-item.item img {
|
||||
max-width: 180px;
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
import "./VideoItem.css";
|
||||
import React from "react";
|
||||
|
||||
const VideoItem = ({ video, onVideoSelect }) => {
|
||||
return (
|
||||
<div className="video-item item" onClick={() => onVideoSelect(video)}>
|
||||
<img
|
||||
src={video.snippet.thumbnails.medium.url}
|
||||
className="ui image"
|
||||
alt=""
|
||||
/>
|
||||
<div className="content">
|
||||
<div className="header"> {video.snippet.title}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default VideoItem;
|
|
@ -1,18 +0,0 @@
|
|||
import React from "react";
|
||||
import VideoItem from "./VideoItem";
|
||||
|
||||
const VideoList = ({ videos, onVideoSelect }) => {
|
||||
const renderedList = videos.map(video => {
|
||||
return (
|
||||
<VideoItem
|
||||
key={video.id.videoId}
|
||||
onVideoSelect={onVideoSelect}
|
||||
video={video}
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
return <div className="ui relaxed divided list">{renderedList}</div>;
|
||||
};
|
||||
|
||||
export default VideoList;
|
|
@ -1,8 +0,0 @@
|
|||
import React from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import App from './components/App'
|
||||
|
||||
ReactDOM.render(
|
||||
<App />,
|
||||
document.querySelector('#root')
|
||||
)
|
23
react/13/songs/.gitignore
vendored
|
@ -1,23 +0,0 @@
|
|||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
|
@ -1,68 +0,0 @@
|
|||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
||||
|
||||
## Available Scripts
|
||||
|
||||
In the project directory, you can run:
|
||||
|
||||
### `yarn start`
|
||||
|
||||
Runs the app in the development mode.<br />
|
||||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
||||
|
||||
The page will reload if you make edits.<br />
|
||||
You will also see any lint errors in the console.
|
||||
|
||||
### `yarn test`
|
||||
|
||||
Launches the test runner in the interactive watch mode.<br />
|
||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
||||
|
||||
### `yarn build`
|
||||
|
||||
Builds the app for production to the `build` folder.<br />
|
||||
It correctly bundles React in production mode and optimizes the build for the best performance.
|
||||
|
||||
The build is minified and the filenames include the hashes.<br />
|
||||
Your app is ready to be deployed!
|
||||
|
||||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
||||
|
||||
### `yarn eject`
|
||||
|
||||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
||||
|
||||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
||||
|
||||
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
||||
|
||||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
||||
|
||||
## Learn More
|
||||
|
||||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
||||
|
||||
To learn React, check out the [React documentation](https://reactjs.org/).
|
||||
|
||||
### Code Splitting
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
|
||||
|
||||
### Analyzing the Bundle Size
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
|
||||
|
||||
### Making a Progressive Web App
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
|
||||
|
||||
### Advanced Configuration
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
|
||||
|
||||
### Deployment
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
|
||||
|
||||
### `yarn build` fails to minify
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
|
13368
react/13/songs/package-lock.json
generated
|
@ -1,34 +0,0 @@
|
|||
{
|
||||
"name": "songs",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"prettier": "^1.19.1",
|
||||
"react": "^16.12.0",
|
||||
"react-dom": "^16.12.0",
|
||||
"react-redux": "^7.1.3",
|
||||
"react-scripts": "3.2.0",
|
||||
"redux": "^4.0.4"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "react-app"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 22 KiB |
|
@ -1,46 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Web site created using create-react-app"
|
||||
/>
|
||||
<link rel="apple-touch-icon" href="logo192.png" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" wil /l
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<link rel="stylesheet"
|
||||
href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css"
|
||||
/>
|
||||
<title>React App</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 22 KiB |
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "logo192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "logo512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
|
@ -1,9 +0,0 @@
|
|||
// Action creator
|
||||
//
|
||||
export const selectSong = song => {
|
||||
return {
|
||||
// type is required
|
||||
type: "SONG_SELECTED",
|
||||
payload: song
|
||||
};
|
||||
};
|
|
@ -1,16 +0,0 @@
|
|||
import React from "react";
|
||||
import SongList from "./SongList";
|
||||
|
||||
const App = () => {
|
||||
return (
|
||||
<div className="ui container grid">
|
||||
<div className="ui row">
|
||||
<div className="column eight wide">
|
||||
<SongList />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default App;
|
|
@ -1,35 +0,0 @@
|
|||
import React, { Component } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { selectSong } from "../actions";
|
||||
|
||||
class SongList extends Component {
|
||||
renderList() {
|
||||
return this.props.songs.map(song => {
|
||||
return (
|
||||
<div className="item" key={song.title}>
|
||||
<div className="right floated content">
|
||||
<button
|
||||
className="ui button primary"
|
||||
onClick={() => {
|
||||
this.props.selectSong(song);
|
||||
}}
|
||||
>
|
||||
Select
|
||||
</button>
|
||||
</div>
|
||||
<div className="content">{song.title}</div>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
}
|
||||
render() {
|
||||
return <div className="ui divided list">{this.renderList()}</div>;
|
||||
}
|
||||
}
|
||||
|
||||
// named by convention
|
||||
const mapStateToProps = state => {
|
||||
return { songs: state.songs };
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, { selectSong })(SongList);
|
|
@ -1,14 +0,0 @@
|
|||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import { Provider } from "react-redux";
|
||||
import { createStore } from "redux";
|
||||
|
||||
import App from "./components/App.js";
|
||||
import reducers from "./reducers";
|
||||
|
||||
ReactDOM.render(
|
||||
<Provider store={createStore(reducers)}>
|
||||
<App />
|
||||
</Provider>,
|
||||
document.querySelector("#root")
|
||||
);
|
|
@ -1,35 +0,0 @@
|
|||
import { combineReducers } from "redux";
|
||||
|
||||
const songReducer = () => {
|
||||
return [
|
||||
{
|
||||
title: "No Scrubs",
|
||||
duration: "4:05"
|
||||
},
|
||||
{
|
||||
title: "Macarena",
|
||||
duration: "2:30"
|
||||
},
|
||||
{
|
||||
title: "All star",
|
||||
duration: "4:45"
|
||||
},
|
||||
{
|
||||
title: "I want it that way",
|
||||
duration: "2:10"
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
const selectedSongReducer = (selectedSong = null, action) => {
|
||||
if (action.type === "SONG_SELECTED") {
|
||||
return action.payload;
|
||||
}
|
||||
|
||||
return selectedSong;
|
||||
};
|
||||
|
||||
export default combineReducers({
|
||||
songs: songReducer,
|
||||
selectedSongReducer: selectedSongReducer
|
||||
});
|
10216
react/13/songs/yarn.lock
23
react/2/jsx/.gitignore
vendored
|
@ -1,23 +0,0 @@
|
|||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
|
@ -1,68 +0,0 @@
|
|||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
||||
|
||||
## Available Scripts
|
||||
|
||||
In the project directory, you can run:
|
||||
|
||||
### `npm start`
|
||||
|
||||
Runs the app in the development mode.<br>
|
||||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
||||
|
||||
The page will reload if you make edits.<br>
|
||||
You will also see any lint errors in the console.
|
||||
|
||||
### `npm test`
|
||||
|
||||
Launches the test runner in the interactive watch mode.<br>
|
||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
||||
|
||||
### `npm run build`
|
||||
|
||||
Builds the app for production to the `build` folder.<br>
|
||||
It correctly bundles React in production mode and optimizes the build for the best performance.
|
||||
|
||||
The build is minified and the filenames include the hashes.<br>
|
||||
Your app is ready to be deployed!
|
||||
|
||||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
||||
|
||||
### `npm run eject`
|
||||
|
||||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
||||
|
||||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
||||
|
||||
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
||||
|
||||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
||||
|
||||
## Learn More
|
||||
|
||||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
||||
|
||||
To learn React, check out the [React documentation](https://reactjs.org/).
|
||||
|
||||
### Code Splitting
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
|
||||
|
||||
### Analyzing the Bundle Size
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
|
||||
|
||||
### Making a Progressive Web App
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
|
||||
|
||||
### Advanced Configuration
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
|
||||
|
||||
### Deployment
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
|
||||
|
||||
### `npm run build` fails to minify
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
|
|
@ -1,31 +0,0 @@
|
|||
{
|
||||
"name": "jsx",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"react": "^16.8.6",
|
||||
"react-dom": "^16.8.6",
|
||||
"react-scripts": "3.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "react-app"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 3.8 KiB |
|
@ -1,38 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>React App</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
</html>
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
.App {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.App-logo {
|
||||
animation: App-logo-spin infinite 20s linear;
|
||||
height: 40vmin;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.App-header {
|
||||
background-color: #282c34;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: calc(10px + 2vmin);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.App-link {
|
||||
color: #61dafb;
|
||||
}
|
||||
|
||||
@keyframes App-logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
import React from 'react';
|
||||
import logo from './logo.svg';
|
||||
import './App.css';
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
<img src={logo} className="App-logo" alt="logo" />
|
||||
<p>
|
||||
Edit <code>src/App.js</code> and save to reload.
|
||||
</p>
|
||||
<a
|
||||
className="App-link"
|
||||
href="https://reactjs.org"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Learn React
|
||||
</a>
|
||||
</header>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
|
@ -1,9 +0,0 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import App from './App';
|
||||
|
||||
it('renders without crashing', () => {
|
||||
const div = document.createElement('div');
|
||||
ReactDOM.render(<App />, div);
|
||||
ReactDOM.unmountComponentAtNode(div);
|
||||
});
|
|
@ -1,13 +0,0 @@
|
|||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
|
||||
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
|
||||
sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
|
||||
monospace;
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
|
||||
function getButtonText() {
|
||||
return 'Click on me!';
|
||||
}
|
||||
|
||||
const App = () => {
|
||||
return (
|
||||
<div>
|
||||
<label class="label" for="name">Enter name:</label>
|
||||
<input type="text" id="name" />
|
||||
<button style={{ backgroundColor: 'blue', color: 'white' }}>{getButtonText()}</button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
ReactDOM.render(<App />, document.querySelector("#root"));
|
|
@ -1,7 +0,0 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3">
|
||||
<g fill="#61DAFB">
|
||||
<path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/>
|
||||
<circle cx="420.9" cy="296.5" r="45.7"/>
|
||||
<path d="M520.5 78.1z"/>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 2.6 KiB |
|
@ -1,135 +0,0 @@
|
|||
// This optional code is used to register a service worker.
|
||||
// register() is not called by default.
|
||||
|
||||
// This lets the app load faster on subsequent visits in production, and gives
|
||||
// it offline capabilities. However, it also means that developers (and users)
|
||||
// will only see deployed updates on subsequent visits to a page, after all the
|
||||
// existing tabs open on the page have been closed, since previously cached
|
||||
// resources are updated in the background.
|
||||
|
||||
// To learn more about the benefits of this model and instructions on how to
|
||||
// opt-in, read https://bit.ly/CRA-PWA
|
||||
|
||||
const isLocalhost = Boolean(
|
||||
window.location.hostname === 'localhost' ||
|
||||
// [::1] is the IPv6 localhost address.
|
||||
window.location.hostname === '[::1]' ||
|
||||
// 127.0.0.1/8 is considered localhost for IPv4.
|
||||
window.location.hostname.match(
|
||||
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
|
||||
)
|
||||
);
|
||||
|
||||
export function register(config) {
|
||||
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
|
||||
// The URL constructor is available in all browsers that support SW.
|
||||
const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
|
||||
if (publicUrl.origin !== window.location.origin) {
|
||||
// Our service worker won't work if PUBLIC_URL is on a different origin
|
||||
// from what our page is served on. This might happen if a CDN is used to
|
||||
// serve assets; see https://github.com/facebook/create-react-app/issues/2374
|
||||
return;
|
||||
}
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
|
||||
|
||||
if (isLocalhost) {
|
||||
// This is running on localhost. Let's check if a service worker still exists or not.
|
||||
checkValidServiceWorker(swUrl, config);
|
||||
|
||||
// Add some additional logging to localhost, pointing developers to the
|
||||
// service worker/PWA documentation.
|
||||
navigator.serviceWorker.ready.then(() => {
|
||||
console.log(
|
||||
'This web app is being served cache-first by a service ' +
|
||||
'worker. To learn more, visit https://bit.ly/CRA-PWA'
|
||||
);
|
||||
});
|
||||
} else {
|
||||
// Is not localhost. Just register service worker
|
||||
registerValidSW(swUrl, config);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function registerValidSW(swUrl, config) {
|
||||
navigator.serviceWorker
|
||||
.register(swUrl)
|
||||
.then(registration => {
|
||||
registration.onupdatefound = () => {
|
||||
const installingWorker = registration.installing;
|
||||
if (installingWorker == null) {
|
||||
return;
|
||||
}
|
||||
installingWorker.onstatechange = () => {
|
||||
if (installingWorker.state === 'installed') {
|
||||
if (navigator.serviceWorker.controller) {
|
||||
// At this point, the updated precached content has been fetched,
|
||||
// but the previous service worker will still serve the older
|
||||
// content until all client tabs are closed.
|
||||
console.log(
|
||||
'New content is available and will be used when all ' +
|
||||
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
|
||||
);
|
||||
|
||||
// Execute callback
|
||||
if (config && config.onUpdate) {
|
||||
config.onUpdate(registration);
|
||||
}
|
||||
} else {
|
||||
// At this point, everything has been precached.
|
||||
// It's the perfect time to display a
|
||||
// "Content is cached for offline use." message.
|
||||
console.log('Content is cached for offline use.');
|
||||
|
||||
// Execute callback
|
||||
if (config && config.onSuccess) {
|
||||
config.onSuccess(registration);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error during service worker registration:', error);
|
||||
});
|
||||
}
|
||||
|
||||
function checkValidServiceWorker(swUrl, config) {
|
||||
// Check if the service worker can be found. If it can't reload the page.
|
||||
fetch(swUrl)
|
||||
.then(response => {
|
||||
// Ensure service worker exists, and that we really are getting a JS file.
|
||||
const contentType = response.headers.get('content-type');
|
||||
if (
|
||||
response.status === 404 ||
|
||||
(contentType != null && contentType.indexOf('javascript') === -1)
|
||||
) {
|
||||
// No service worker found. Probably a different app. Reload the page.
|
||||
navigator.serviceWorker.ready.then(registration => {
|
||||
registration.unregister().then(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
// Service worker found. Proceed as normal.
|
||||
registerValidSW(swUrl, config);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
console.log(
|
||||
'No internet connection found. App is running in offline mode.'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
export function unregister() {
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.ready.then(registration => {
|
||||
registration.unregister();
|
||||
});
|
||||
}
|
||||
}
|
10011
react/2/jsx/yarn.lock
23
react/3/components/.gitignore
vendored
|
@ -1,23 +0,0 @@
|
|||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
|
@ -1,68 +0,0 @@
|
|||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
||||
|
||||
## Available Scripts
|
||||
|
||||
In the project directory, you can run:
|
||||
|
||||
### `npm start`
|
||||
|
||||
Runs the app in the development mode.<br>
|
||||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
||||
|
||||
The page will reload if you make edits.<br>
|
||||
You will also see any lint errors in the console.
|
||||
|
||||
### `npm test`
|
||||
|
||||
Launches the test runner in the interactive watch mode.<br>
|
||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
||||
|
||||
### `npm run build`
|
||||
|
||||
Builds the app for production to the `build` folder.<br>
|
||||
It correctly bundles React in production mode and optimizes the build for the best performance.
|
||||
|
||||
The build is minified and the filenames include the hashes.<br>
|
||||
Your app is ready to be deployed!
|
||||
|
||||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
||||
|
||||
### `npm run eject`
|
||||
|
||||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
||||
|
||||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
||||
|
||||
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
||||
|
||||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
||||
|
||||
## Learn More
|
||||
|
||||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
||||
|
||||
To learn React, check out the [React documentation](https://reactjs.org/).
|
||||
|
||||
### Code Splitting
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
|
||||
|
||||
### Analyzing the Bundle Size
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
|
||||
|
||||
### Making a Progressive Web App
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
|
||||
|
||||
### Advanced Configuration
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
|
||||
|
||||
### Deployment
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
|
||||
|
||||
### `npm run build` fails to minify
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
|
12720
react/3/components/package-lock.json
generated
|
@ -1,32 +0,0 @@
|
|||
{
|
||||
"name": "components",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"faker": "^4.1.0",
|
||||
"react": "^16.8.6",
|
||||
"react-dom": "^16.8.6",
|
||||
"react-scripts": "3.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "react-app"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 3.8 KiB |
|
@ -1,39 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css">
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>React App</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
</html>
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
import React from 'react';
|
||||
|
||||
|
||||
const ApprovalCard = (props) => {
|
||||
return (
|
||||
<div className="ui card">
|
||||
<div className="content">{props.children}</div>
|
||||
<div className="ui two buttons">
|
||||
<div className="ui basic green button">Approve</div>
|
||||
<div className="ui basic red button">Decline</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default ApprovalCard
|
|
@ -1,21 +0,0 @@
|
|||
import React from 'react';
|
||||
|
||||
const CommentDetail = (props) => {
|
||||
console.log(props)
|
||||
return (
|
||||
<div className="comment">
|
||||
<a href="/" className="avatar">
|
||||
<img src={props.avatar} alt="avatar" />
|
||||
</a>
|
||||
<div className="content">
|
||||
<a href="/" className="author">{props.author}</a>
|
||||
<div className="metadata">
|
||||
<span className="date">{props.timeAgo}</span>
|
||||
</div>
|
||||
<div className="text">{props.content}</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default CommentDetail
|
|
@ -1,23 +0,0 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import CommentDetail from './CommentDetails';
|
||||
import faker from 'faker';
|
||||
import ApprovalCard from './ApprovalCard';
|
||||
|
||||
const App = () => {
|
||||
return (
|
||||
<div className="ui container comments">
|
||||
<ApprovalCard >
|
||||
<CommentDetail author="Sam" timeAgo="Today at 5pm" avatar={faker.image.avatar()} content={faker.hacker.phrase()} />
|
||||
</ ApprovalCard>
|
||||
<ApprovalCard >
|
||||
<CommentDetail author="Alex" timeAgo="Today at 6pm" avatar={faker.image.avatar()} content={faker.hacker.phrase()} />
|
||||
</ ApprovalCard>
|
||||
<ApprovalCard >
|
||||
<CommentDetail author="Bob" timeAgo="Today at 7pm" avatar={faker.image.avatar()} content={faker.hacker.phrase()} />
|
||||
</ ApprovalCard>
|
||||
</div>
|
||||
)
|
||||
};
|
||||
|
||||
ReactDOM.render(<App />, document.querySelector('#root'));
|
23
react/4/seasons/.gitignore
vendored
|
@ -1,23 +0,0 @@
|
|||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
|
@ -1,68 +0,0 @@
|
|||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
||||
|
||||
## Available Scripts
|
||||
|
||||
In the project directory, you can run:
|
||||
|
||||
### `npm start`
|
||||
|
||||
Runs the app in the development mode.<br>
|
||||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
||||
|
||||
The page will reload if you make edits.<br>
|
||||
You will also see any lint errors in the console.
|
||||
|
||||
### `npm test`
|
||||
|
||||
Launches the test runner in the interactive watch mode.<br>
|
||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
||||
|
||||
### `npm run build`
|
||||
|
||||
Builds the app for production to the `build` folder.<br>
|
||||
It correctly bundles React in production mode and optimizes the build for the best performance.
|
||||
|
||||
The build is minified and the filenames include the hashes.<br>
|
||||
Your app is ready to be deployed!
|
||||
|
||||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
||||
|
||||
### `npm run eject`
|
||||
|
||||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
||||
|
||||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
||||
|
||||
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
||||
|
||||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
||||
|
||||
## Learn More
|
||||
|
||||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
||||
|
||||
To learn React, check out the [React documentation](https://reactjs.org/).
|
||||
|
||||
### Code Splitting
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
|
||||
|
||||
### Analyzing the Bundle Size
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
|
||||
|
||||
### Making a Progressive Web App
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
|
||||
|
||||
### Advanced Configuration
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
|
||||
|
||||
### Deployment
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
|
||||
|
||||
### `npm run build` fails to minify
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
|
12533
react/4/seasons/package-lock.json
generated
|
@ -1,31 +0,0 @@
|
|||
{
|
||||
"name": "seasons",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"react": "^16.8.6",
|
||||
"react-dom": "^16.8.6",
|
||||
"react-scripts": "3.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "react-app"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 3.8 KiB |