Skip to content

Instantly share code, notes, and snippets.

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()}.`);
View gist:ca4b210b9b6b4a4cda898e74ca64ff38
flo@kubuntu:~/Documents/Wild Code School/quests/Git/my-website-oops$ git log --oneline
5d2a82d (HEAD -> master) added some content
94ccae9 modified title
7e4878a created index.html
flo@kubuntu:~/Documents/Wild Code School/quests/Git/my-website-oops$ git revert HEAD
[master 3d41213] Revert "added some content"
1 file changed, 11 insertions(+), 13 deletions(-)
rewrite index.html (71%)
flo@kubuntu:~/Documents/Wild Code School/quests/Git/my-website-oops$ git log --oneline
3d41213 (HEAD -> master) Revert "added some content"
@barthflo
barthflo / gist:c7e010127b3f572a393be58502aa0b38
Created Sep 17, 2020
WCS - Git/GitHUB 5 - Merge & Conflicts
View gist:c7e010127b3f572a393be58502aa0b38
flo@kubuntu:~/Documents/Wild Code School/quests/Git/merge-conflicts$ git pull
Auto-merging README.md
CONFLICT (content): Merge conflict in README.md
Automatic merge failed; fix conflicts and then commit the result.
flo@kubuntu:~/Documents/Wild Code School/quests/Git/merge-conflicts$ git status
On branch master
Your branch and 'origin/master' have diverged,
and have 1 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
View WCS - Linux2 - Files and directories
// Find Command
flo@kubuntu:~/Documents/Wild Code School/quests/shell$ find planets
planets
planets/fictionnal
planets/fictionnal/coruscant.jpeg
planets/fictionnal/cybertron.jpeg
planets/fictionnal/arrakis.jpeg
planets/inhabited
planets/inhabited/coruscant.jpeg
You can’t perform that action at this time.