Skip to content

Instantly share code, notes, and snippets.

View WCS - SQL 05 - JOINS
SELECT w.firstname, w.lastname, p.role, t.name FROM wizard w
LEFT JOIN player p ON p.wizard_id=w.id
LEFT JOIN team t ON p.team_id=t.id
ORDER BY t.name;
+-------------+-----------------+--------+------------+
| firstname | lastname | role | name |
+-------------+-----------------+--------+------------+
| Remus | Lupin | NULL | NULL |
| Horace | Slughorn | NULL | NULL |
| Padma | Patil | NULL | NULL |
View WCS - Express 4 - DELETE method
const connection = require('./config');
const express = require("express");
const port = 3000;
const app = express();
connection.connect(err => {
if(err){
console.log('error connecting: ' + err.stack);
return;
View WCS - Express 3 - PUT method
const connection = require('./config');
const express = require("express");
const port = 3000;
const app = express();
connection.connect(err => {
if(err){
console.log('error connecting: ' + err.stack);
return;
View WCS - Express 3 - POST data
const connection = require('./config');
const express = require("express");
const port = 3000;
const app = express();
connection.connect(err => {
if(err){
console.log('error connecting: ' + err.stack);
return;
View WCS - Express 2 - Read from the database
const connection = require('./config');
const express = require("express");
const port = 3000;
const app = express();
connection.connect(err => {
if(err){
console.log('error connecting: ' + err.stack);
return;
View WCS - Node.js - Creating an http server
const http = require('http');
const port = 8000;
const url = require('url');
const requestHandler = (request, response) => {
const parsedUrl = url.parse(request.url, true);
if(parsedUrl.query.name && parsedUrl.query.city){
response.end(`Hello, ${parsedUrl.query.name} from ${parsedUrl.query.city}`);
}else{
response.end("Please provide name AND city parameters");
View WCS - Mysql quest 3
mysql> INSERT INTO school (name, country, capacity)
VALUES ('Beauxbatons Academy of Magic', 'France', 550),
('Castelobruxo', 'Brazil', 380),
('Durmstrang Institute', 'Norway', 570),
('Hogwarts School of Witchcraft and Wizardry', 'United Kingdom', 450),
('Ilvermorny School of Witchcraft and Wizardry','USA', 300),
('Koldovstoretz', 'Russia', 125),
('Mahoutokoro School of Magic', 'Japan', 800),
('Uagadou School of Magic', 'Uganda', 350);
Query OK, 8 rows affected (0.00 sec)
View WCS -Mysql quest 2
mysql> SELECT * FROM wizard
-> ;
+----+-----------+------------+------------+-------------+-------------------------------------------------------------+-----------+
| id | firstname | lastname | birthday | birth_place | biography | is_muggle |
+----+-----------+------------+------------+-------------+-------------------------------------------------------------+-----------+
| 1 | harry | potter | 1980-07-31 | london | | 0 |
| 2 | hermione | granger | 1979-09-19 | | Friend of Harry Potter | 0 |
| 3 | lily | potter | 1960-01-30 | | mother of Harry Potter | 0 |
| 4 | ron | weasley | 1980-03-01 | | Best friend of Harry | 0 |
| 5 | ginny | weasley | 1981-08-11 |
View WCS - 09-Bootstrap
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<title>Bootstrap Quest</title>
</head>
<body>
@barthflo
barthflo / favourite.movie.js
Created Sep 28, 2020
WCS - Basics of JS - Discover the language
View favourite.movie.js
const movieName = "The Grand Budapest Hotel";
const movieDirector = "Wes Anderson";
const releaseDate = 2014;
alert(`${movieName} directed by ${movieDirector}, was released in ${releaseDate.toString()}.`);