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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
content=$(curl -s http://feeds.feedburner.com/PornstarBirthdays | 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:]') \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Bootstrap " | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" disable for pathogen | |
filetype plugin off | |
" call pathogen | |
call plug#begin('~/.vim/plugged') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// code for Custom Javascript for Websites 2 | |
// External library needed: https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.min.js | |
// and jQuery 3 | |
function delay(t, v) { | |
return new Promise(function(resolve) { | |
setTimeout(resolve.bind(null, v), t); | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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. | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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. |