Skip to content

Instantly share code, notes, and snippets.

View AlexFBP's full-sized avatar

Alex Bustos AlexFBP

View GitHub Profile
@AlexFBP
AlexFBP / FizzBuzz.js
Last active August 27, 2023 21:45
Codigos random...
// For numbers 1-100
// If divisible by "3", print "Fizz"
// If divisible by "5", print "Buzz"
// Otherwise, print the number
for (let i = 1; i < 100; i++) {
let t = "";
if (!(i%3)) {
t = "Fizz";
}
@AlexFBP
AlexFBP / CleanBranches.md
Created January 22, 2023 19:04
Clean local branches that have been deleted in remote

TLDR

Add this alias (enter this once on your terminal)

git config --global alias.cb '!git fetch -p && for branch in $(git for-each-ref --format '\''%(refname) %(upstream:track)'\'' refs/heads | awk '\''$2 == "[gone]" {sub("refs/heads/", "", $1); print $1}'\''); do git branch -D $branch; done'

so whenever you need to clean your local branches without removing just need to

@AlexFBP
AlexFBP / trycatch.sh
Created July 3, 2020 05:02
Tiny try/catch bash functions
#!/bin/bash
# Refer https://stackoverflow.com/a/25180186/3180052 for usage and credits
function try()
{
[[ $- = *e* ]]; SAVED_OPT_E=$?
set +e
}