Skip to content

Instantly share code, notes, and snippets.

View santiagocodes's full-sized avatar

santiagocodes

View GitHub Profile
@santiagocodes
santiagocodes / SignUp010.js
Created July 1, 2019 14:45
Odyssey-d-Homer Quest 010
import React from 'react';
class SignUp extends React.Component {
constructor(props) {
super(props);
this.state= {
email: ""
};
this.handleChange = this.handleChange.bind(this);
@santiagocodes
santiagocodes / index.html
Created June 25, 2019 11:41
A counter using Redux and Vanilla Javascript
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Counter Redux</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Redux CDN -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux/4.0.1/redux.min.js"></script>
</head>
@santiagocodes
santiagocodes / express_02.js
Created June 5, 2019 10:25
Express 2 - Express, SQL-MySQL, Postman. Creating an API for movies (https://gist.github.com/AlexLoWCD/bd426b7416d3afde85e65fbe7821acfc)
const mysql = require('mysql');
var express = require('express');
const connection = mysql.createConnection({
host : 'localhost', // address of the server
user : 'blablabla', // username
password : 'blablabla',
database : 'express_2',
});
const app = express();
const port = 3000
@santiagocodes
santiagocodes / advancedSqlWorkshop.txt
Last active June 4, 2019 15:18
Advanced SQL Workshop
Create a DB from the following script:
https://gist.github.com/sblondeau/5cdc304b160960bb20c1cd0ba314cf3e
Once the tables are created, write the queries to display:
1. The first name, name and age of the characters
mysql> SELECT firstname, lastname, age FROM Person;
2. The first name, name of the characters and their kingdom, only for those connected to a kingdom
mysql> SELECT ch.firstname, ch.lastname, ki.name
@santiagocodes
santiagocodes / sql03.txt
Created May 23, 2019 14:21
SQL03- Data handling
## Wizardry schools
Insert in the school table the following data...
mysql> INSERT INTO school (name, country, capacity) VALUES
-> ('Beauxbatons Academy of Magic', 'France', 550),
-> ('Castelobruxo', 'France', 380),
-> ('Durmstrang Institute', 'Norway', 570),
-> ('Hogwarts School of Witchcraft and Wizardry', 'United Kindom', 450),
-> ('Ilvermorny School of Witchcraft and Wizardry', 'USA', 300),
-> ('Koldovstoretz', 'Russia', 125),
@santiagocodes
santiagocodes / express_01.js
Created May 22, 2019 15:21
Express Quest 1- Express Discovery
const express = require('express');
const app = express();
const port = 3000;
//Quest- You will create some GET routes on your server:
//1.1 A route answering the url /api/movies which
//sends as information a string containing "All films"
app.get(`/api/movies`, (req, res) => {
@santiagocodes
santiagocodes / sql02.txt
Created May 21, 2019 08:33
SQL02- Retriving information with SELECT
Retrieving wizards Challenge from https://images.innoveduc.fr/bdd/data2.sql
Retrieve all the fields for wizards born between 1975 and 1985...
mysql> SELECT * FROM wizard WHERE birthday BETWEEN '1975-01-01' AND '1985-12-31';
INSERT INTO `wild_db_quest`.`wizard` (`firstname`, `lastname`, `birthday`, `birth_place`, `biography`, `is_muggle`) VALUES
('harry', 'potter', '1980-07-31', 'london', '', '0');
INSERT INTO `wild_db_quest`.`wizard` (`firstname`, `lastname`, `birthday`, `birth_place`, `biography`, `is_muggle`) VALUES
('hermione', 'granger', '1979-09-19', '', 'Friend of Harry Potter', '0');
INSERT INTO `wild_db_quest`.`wizard` (`firstname`, `lastname`, `birthday`, `birth_place`, `biography`, `is_muggle`) VALUES
('ron', 'weasley', '1980-03-01', '', 'Best friend of Harry', '0');
@santiagocodes
santiagocodes / quest.js
Created April 4, 2019 09:22
Quest App How old are you?
process.stdin.resume()
process.stdin.setEncoding('utf8')
console.log('Computer: How old are you? ')
process.stdout.write('Me: ');
process.stdin.on('data', (age) => {
console.log('Computer: Tienes ' + age.trim()+ ' años.');
if (!Number(age)){
console.log('¿eh?')
} else if (age > 99) {