Skip to content

Instantly share code, notes, and snippets.

View leite08's full-sized avatar

Rafael Leite leite08

View GitHub Profile
@leite08
leite08 / compare-string-replace.ts
Created December 28, 2024 21:56
Compare different approaches to string replace all in JS for performance
/**
* As of 2024-12-28, Mac M1 Max
*
* replace took 592ms
* replaceAll took 641ms
* replace regex took 485ms
* replace NEW regex took 902ms
* replaceAll regex took 691ms
* replaceAll NEW regex took 1105ms
*/
@leite08
leite08 / update-aws-roles.md
Created May 3, 2025 12:29
Update roles on AWS Switch Role

AWS provides a way to switch accounts in the same browser using "Switch role": https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-console.html

Once you switch to another role/account, it will stay on that browser's "history" - it uses cookies to store the list of roles you switched to.

If you want to update that list, currently the only way is to update the cookie.

NOTE: you'll need to URL-encode the updated value before updating it in the browser's cookie.

In chrome, similar for other browsers:

@leite08
leite08 / aliases-to-create-prs.sh
Created November 10, 2025 21:28
Shell aliases to create PRs based on templates
# aliases to create PRs based on templates
alias open-feature='gh pr create --base develop --title "ENG-xxx ...WIP" -T "feature.md" -d'
alias open-release='gh pr create --base master --head develop --title "RELEASE ...WIP" -d -T "release.md"'
alias open-patch='gh pr create --base master --title "PATCH RELEASE ...WIP" -d -T patch.md'
alias open-backmerge='gh pr create --base develop --head master --title "Backmerge master into develop" --body "Backmerge master into develop" -d'