Skip to content

Instantly share code, notes, and snippets.

View bhubr's full-sized avatar

Benoît Hubert bhubr

View GitHub Profile
@bhubr
bhubr / gist:4e64af99412c102f95b2f53053292aa5
Last active February 10, 2017 09:07 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Maintenance du site</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
@bhubr
bhubr / flatuicolors.com.js
Last active February 14, 2017 08:52
Extract colors from flatuicolors.com
/*
I needed to get a quick flat color palette for a project of mine.
The one at https://flatuicolors.com/ is great.
Just go to the site, open your console and paste this.
It will generate a JSON array with each color and associated name.
*/
output = '[';
const $divs = $('.color');
const lastIndex = $divs.length - 1
$('.color').each((index, div) => {
@bhubr
bhubr / 404.html
Last active February 13, 2018 12:44
Mini serveur web Python
<h1>Not Found</h1>
<p>Cette page n'existe pas !</p>
@bhubr
bhubr / history.log
Created February 22, 2018 14:21
TCPD mystery solution
1 cd mystery/
2 grep CLUE crimescene
3 grep -q ATM interviews/*
4 grep -q Annabel interviews/*
5 grep -i Annabel interviews/*
6 grep -i Zealand interviews/*
7 grep -i shot interviews/
8 grep -i shot interviews/*
9 grep -i -A 5 shot interviews/interview-699607
10 grep -A 5 L337 vehicles
@bhubr
bhubr / profile.md
Last active September 2, 2018 13:57
markdown test

Benoît Hubert

  • Campus : Toulouse
  • Techno : JS/React

Après avoir été développeur pendant de nombreuses années, je suis désormais formateur à la Wild de Toulouse, depuis février 2018 !

Benoît Hubert - 2018 - Profil GitHub

@bhubr
bhubr / dojo.md
Created October 2, 2018 09:02
Dojo 2/10/2018

Dojo analyseMots

Enoncé

On veut écrire une fonction analyseMots qui, à partir d'un tableau de mots, va nous renvoyer un tableau d'objets contenant l'analyse d'un mot.

Exemple

const mots = ['lit']
@bhubr
bhubr / passLog.js
Created December 26, 2018 10:08
passLog
// Without label
const passLog = obj => { console.log(obj); return obj; };
// With label
const passLog = label => obj => { console.log(label, obj); return obj; };
@bhubr
bhubr / config.js
Last active March 13, 2024 15:45
Call Google Geocoding API to get latitude and longitude of a given address
module.exports = {
googleApiKey: 'INSERT_YOUR_KEY_HERE'
}
@bhubr
bhubr / exemple.js
Created January 15, 2019 13:16
Pagination Express SQL
const { page } = req.query;
let limit = '';
if (page) {
const skip = Number(page) * 10 // Si tu as 10 items par page
limit = `LIMIT ${skip},10`; // skip définit le nombre d'items à "passer" pour arriver à ceux qu'on veut obtenir
}
db.query(`SELECT * FROM user ORDER BY ID DESC ${limit}`), (err, res) => {
// ...
})
@bhubr
bhubr / nginx.conf.patch
Created January 21, 2019 22:25
Node.js + Nginx configuration on CentOS 7 (apply to /etc/nginx/nginx.conf)
--- /etc/nginx/nginx.conf.original 2019-01-21 19:39:10.556032081 +0100
+++ /etc/nginx/nginx.conf 2019-01-21 19:42:09.225622416 +0100
@@ -45,6 +45,12 @@
include /etc/nginx/default.d/*.conf;
location / {
+ proxy_pass http://localhost:8000;
+ proxy_http_version 1.1;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection 'upgrade';