Skip to content

Instantly share code, notes, and snippets.


Guillaume "Vermeille" Sanchez Vermeille

View GitHub Profile

I hate props drilling (my background)

I hate props drilling. I despise it. Is spent the last years writing C++ and fighting hard with my code habits to have a code that is not just working, but also semantically correct. Having code that makes sense is hard, but has all the possible qualities good code can have: since the concerns are well delimited, each class / component / module tends to be independant, reusable, and easily testable. Your code just makes sense. It's also simpler, because the design is just good. The maintainability is greater. And all sorts of things.

content=$(curl -s | egrep 'title|link' | sed 's/<.*>\([^<]*\)<\/.*>/\1/' | tail -n+6)
idx=$(($RANDOM % ($(echo "$content" | wc -l) / 2) ))
renderer="./catimg/build/bin/catimg -r 1 -w 40"
echo "$content" | tail -n"$(($idx * 2 + 2))" | head -n2 | while read i ; do
case $i in
*http*) curl -s $(echo "$i" | tr -d '[:space:]') \
View .vimrc
" Bootstrap "
" disable for pathogen
filetype plugin off
" call pathogen
call plug#begin('~/.vim/plugged')
Vermeille / encrypt.js
Last active Feb 10, 2018
facebook messenger encryption
View encrypt.js
// configure with jQuery 3
async function aesGcmEncrypt(plaintext, password) {
const pwUtf8 = new TextEncoder().encode(password); // encode password as UTF-8
const pwHash = await crypto.subtle.digest('SHA-256', pwUtf8); // hash the password
const iv = crypto.getRandomValues(new Uint8Array(12)); // get 96-bit random iv
const alg = { name: 'AES-GCM', iv: iv }; // specify algorithm to use
Vermeille / main.js
Last active Feb 5, 2018
Facebook plugin: Screenshot this thread
View main.js
// code for Custom Javascript for Websites 2
// External library needed:
// and jQuery 3
function delay(t, v) {
return new Promise(function(resolve) {
setTimeout(resolve.bind(null, v), t);
Vermeille / structural_polymorphism.cpp
Created Nov 14, 2017
structural polymorphism in C++
View structural_polymorphism.cpp
#include <iostream>
#include <memory>
#include <vector>
* This snippet is demonstrating a powerful technique enabling local and
* concept-based polymorphism. Think of it as interfaces on steroids:
* They're local, non intrusive, which means you don't have to think of them
* ahead, they don't make virtual calls when you don't want to use them, etc.
Vermeille / split1.cpp
Created Dec 24, 2016
A Good, Idiomatic, STL-like split algorithm?
View split1.cpp
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <utility>
This split impl has a nice prototype and isn't callback / continuation
oriented. However, it has two major drawbacks
1) Iterating over it is a bit painful. See below.