Skip to content

Instantly share code, notes, and snippets.

@barthflo
barthflo / gist:0ccdf17aa1266c5a774528dee07e291a
Last active Aug 8, 2020
Created a pseudo-code algorithm
View gist:0ccdf17aa1266c5a774528dee07e291a
start maxBuy (real money, real price)
int maxBuy ← 0
IF money AND price > 0
As long as money >= price
money ← money - price
maxBuy ← maxBuy+1
End As long as
End IF
View gist:8263e455c790ec51873c88ac8c7ee3af
dpkg-mergechangelogs lesskey ps2pdf12 who
dpkg-name lesspipe ps2pdf13 whoami
dpkg-parsechangelog lexgrog ps2pdf14 whois
dpkg-query libnetcfg ps2pdfwr whoopsie
dpkg-scanpackages libreoffice ps2ps whoopsie-preferences
dpkg-scansources libwacom-list-local-devices ps2ps2 word-list-compress
dpkg-shlibdeps linguist ps2txt wordview
dpkg-source link psfaddtable wpa_passphrase
dpkg-split linkicc psfge
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
@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 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 / 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 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>
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 - 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 - 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");