Skip to content

Instantly share code, notes, and snippets.

Avatar

Gustavo Saiani gusaiani

View GitHub Profile
@gusaiani
gusaiani / cga.js
Created Nov 18, 2020
Randomize and open url for simulated preparation exercises for CGA certification. Run with `node ./cga.js`
View cga.js
const { exec } = require("child_process")
const romans = [null, 'i', 'ii', 'iii', 'iv', 'v', 'vi', 'vii', 'viii', 'ix', 'x', 'xi']
const totalNumberOfQuestions = 60
const numberOfQuestions = 15
const moduleNumber = Math.round(Math.random()) + 1
const maxTests = moduleNumber === 1 ? 11 : 9
View gist:acfe30e5f1e726832d28095433b9c74c
#393939,#2D2D2D,#66ACAC,#FFFFFF,#515151,#E3E0D8,#99CC99,#fb4934
@gusaiani
gusaiani / linksFromTDsInTables.js
Created Jul 17, 2018
Vanilla JS to open tabs with urls from every first tb of every row except the first in the first table of an html page
View linksFromTDsInTables.js
// This gist assumes that in a table, every first tr of every td
// will have text that is a valid url.
// It will open blank tabs with each
// Beware huge tables.
// Also it will prompt pop-up protection on Chrome, so check that off
// after running it once for a new source page.
const tables = document.getElementsByTagName('table')
@gusaiani
gusaiani / flattenArbitrarilyDeepArray.js
Last active Jul 4, 2018
The ES6 function below flattens an arbitrarily deep array.
View flattenArbitrarilyDeepArray.js
function flattenArbitrarilyDeepArray(arr, cache = []) {
return arr.reduce((acc, item) => {
if (Array.isArray(item)) {
acc.concat(flattenArbitrarilyDeepArray(item, acc))
}
else acc.push(item)
return acc
}, cache)
}
@gusaiani
gusaiani / .gitignore_global
Last active Jul 20, 2018
My gitignore_global
View .gitignore_global
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@gusaiani
gusaiani / vimium-options.json
Last active Oct 21, 2018
Vimium setup for Colemak keyboard
View vimium-options.json
{
"settingsVersion": "1.64",
"exclusionRules": [
{
"pattern": "https?://mail.google.com/*",
"passKeys": ""
},
{
"pattern": "https?://toggl.com/*",
"passKeys": "n"
View keybase.md

Keybase proof

I hereby claim:

  • I am gusaiani on github.
  • I am gusaiani (https://keybase.io/gusaiani) on keybase.
  • I have a public key ASC2AHkmg49Tv28OjDfSoxAthD-O7nd2RmFHmmluxB6VEwo

To claim this, I am signing this object:

View gusaiani.plugin.zsh
mkcd() {
dir="$*"
mkdir -p "$dir" && cd "$dir"
}
cpwd() {
pwd | pbcopy
}
notify_done() {
@gusaiani
gusaiani / .vimrc
Last active Nov 4, 2020
My .vimrc
View .vimrc
call plug#begin('~/.vim/plugged')
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
You can’t perform that action at this time.