Skip to content

Instantly share code, notes, and snippets.

View felipeplets's full-sized avatar
🚀
Creating a better world!

Felipe Plets felipeplets

🚀
Creating a better world!
View GitHub Profile
@felipeplets
felipeplets / jsBenchIt.json
Last active September 29, 2021 13:23
async static code
{"title":"async static code","initialization":"// runs once","setup":"// runs before each test","tests":[{"name":"run static code","code":"function test() {}\n(async () => test())() ","results":{"aborted":false,"count":6241345,"cycles":8,"hz":62890023.34591573,"stats":{"moe":3.6521637226948097e-10,"rme":2.2968466178338307,"sem":1.8633488381095968e-10,"deviation":1.3944025888498827e-9,"mean":1.590077323552056e-8,"variance":1.944358579791255e-18,"numSamples":56},"times":{"cycle":0.09924221152965007,"elapsed":6.205,"period":1.590077323552056e-8,"timeStamp":1632921699005}},"platforms":{"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36":{"aborted":false,"count":6241345,"cycles":8,"hz":62890023.34591573,"stats":{"moe":3.6521637226948097e-10,"rme":2.2968466178338307,"sem":1.8633488381095968e-10,"deviation":1.3944025888498827e-9,"mean":1.590077323552056e-8,"variance":1.944358579791255e-18,"numSamples":56},"times":{"cycle":0.09924221152965007,"ela
@felipeplets
felipeplets / jsBenchIt.json
Created August 29, 2021 02:17
Double-await effect
{"title":"Double-await effect","initialization":"async function sleep() {\n return new Promise(resolve => setTimeout(resolve, 1))\n}","setup":"// runs before each test","tests":[{"name":"Double-await","code":"async function test() {\n return await sleep()\n}\n(async () => await test())() ","results":{"aborted":false,"count":15251,"cycles":3,"hz":108334.57519549297,"stats":{"moe":9.613797293851013e-7,"rme":10.415066458449294,"sem":4.904998619311742e-7,"deviation":0.0000030631706559748736,"mean":0.000009230663416508259,"variance":9.383014467625536e-12,"numSamples":39},"times":{"cycle":0.14077684776516744,"elapsed":10.969,"period":0.000009230663416508259,"timeStamp":1630203291246}},"platforms":{"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36 Edg/92.0.902.78":{"aborted":false,"count":24400,"cycles":3,"hz":190763.63636363644,"stats":{"moe":1.1983958554675582e-7,"rme":2.2861035119210227,"sem":6.114264568712032e-8,"deviation":4.009391403064
@felipeplets
felipeplets / rename-branch.sh
Created July 17, 2020 00:31
Change master branch name to main
git branch -m master main
git push -u origin main
# Access your GitHub repo seetings and change the default branch to main
# Access the branch list and delete the branch master
# Remember to rename other files and CI/CD commands
# Install JQ
brew install jq
# Format JSON file
jq . input.json > output.json
@felipeplets
felipeplets / Script to clone multiple repositories and npm install
Created May 5, 2020 11:25
Shell script using GitHub CLI (gh) to download multiple repositories and run npm ci
USER=githubuser; PREFIX=secret-; REPOS=('proj1' 'proj2' 'proj3') && for REPO in ${REPOS}; do gh repo clone ${USER}/${PREFIX}${REPO} && cd ${PREFIX}${REPO} && npm ci && cd ..; done
https://blog.shanbhag.me/My-terminal-iTerm2-Oh-my-Zsh-with-PowerLevel10k/#Oh-My-Zsh
# zsh + oh-my-zsh
brew install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash
nvm install 14
brew install fzf
@felipeplets
felipeplets / promiseWillFail.js
Created August 28, 2019 19:59
Error handling in JS promises
// Assuming I just want to console.log the error message
await promiseWillFail().catch((err) => console.log(err.message));
@felipeplets
felipeplets / loader.bash
Last active July 3, 2019 15:29 — forked from JuggoPop/Git branch bash autocomplete *with aliases*
Git branch bash autocomplete *with aliases* (add to .bash_profile)
# To Setup:
# 1) Save the .git-completion.bash file found here:
# https://github.com/git/git/blob/master/contrib/completion/git-completion.bash
# 2) Add the following lines to your .bash_profile, be sure to reload (for example: source ~/.bash_profile) for the changes to take effect:
# Git branch bash completion
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
# Add git completion to aliases
git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d
@felipeplets
felipeplets / README.md
Last active November 16, 2022 15:28
Better setup for iTerm

iTerm2

Plist

The Plist file above is located at ~/Library/Preferences/com.googlecode.iterm2.plist but the file is binary and not XML. To edit and replace the XML I recommend using Visual Studio Code with the extension Binary Plist. VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=dnicolson.binary-plist

The steps bellow are not needed if the settings file is replaced.