Skip to content

Instantly share code, notes, and snippets.

View igorescobar's full-sized avatar
🐕

Igor Escobar igorescobar

🐕
View GitHub Profile
@igorescobar
igorescobar / ssh-copy-id.sh
Created April 24, 2013 13:28
Alias to add your ~/.id_rsa.pub to ~/.ssh/authorized_keys on a remote server.
# ssh-copy-id user@host
alias ssh-copy-id='_(){ ssh $1 -p 5022 "mkdir -m 700 ~/.ssh; echo " $(< ~/.ssh/id_rsa.pub) " >> ~/.ssh/authorized_keys ; chmod 600 ~/.ssh/authorized_keys"; }; _'
@igorescobar
igorescobar / sp-celphones-no-anatel-validated.js
Last active December 15, 2015 21:39
Telefones de São Paulo sem as validações da Anatel
// using: https://github.com/igorescobar/jQuery-Mask-Plugin
// version with Anatel validation: https://gist.github.com/3724610/5003f97804ea1e62a3182e21c3b0d3ae3b657dd9
// version: v1.3.0+
$(".sp_celphones").mask("(00) 00009-0000");

#Vendo MacBook White (Unibody) - R$ 1.900,00

  • OS X Mountain Lion (10.8)
  • 2.4GHz Core 2 Duo (3MB L2 cache)
  • 8GB 1066 MHz DDR3 SDRAM
  • HD 250 GB Serial ATA (5400 RPM)
  • NVIDIA GeForce 9400M 256 MB of DDR3 SDRAM
  • AirPort Extreme (802.11a/b/g/n), Bluetooth 2.1+EDR standard and USB 2.0.
@igorescobar
igorescobar / git-aliases.sh
Last active December 12, 2015 06:39
Aliases You Can't Live Without
co = checkout
# ds: it is always best practice to review the changes you're going to commit before making the actual commit. This allows you to catch typos, accidental inclusion of sensitive data and grouping code into logical groups. Stage your changes and then use git ds to see the diff of those changes.
ds = diff --staged
#st: you should be pretty familiar with the verbose output of git status. At some point you'll want to skip all the formality and get down to business. This alias shows the short form of status and includes the branch details.
st = status -sb
#amend: did you forget to include a file with your last commit, or maybe you had one tweak you needed to make? Amend the staged changes to your last commit.
amend = commit --amend -C HEAD
@igorescobar
igorescobar / Git Branches Sorted by Last Commit.sh
Created February 7, 2013 12:44
Git Branches Sorted by Last Commit
So you've got the cluttered branch list that we talked about before; some of those you've cleaned up with the --merged flag. But what about all those other branches? How do you know which ones are useful or entirely out of date? The for-each-ref command will output a list for each branch and show the reference information for the last commit. We can customize the output to include some useful information, but, more importantly, we can sort the list by date. This command will give us a list of branches with the last commit message and committer, sorted in descending date order. (via Rein Henrichs)
git for-each-ref --sort=-committerdate --format='%(committerdate:short) %(refname:short) [%(committername)]'
While you could type this command each time, I highly recommend making it an alias and save yourself some serious headaches.
git config --global alias.latest "for-each-ref --sort=-committerdate --format='%(c
@igorescobar
igorescobar / gist:4730668
Created February 7, 2013 12:42
Grab a File from Another Branch without Switching Branches
git checkout <BRANCH> -- path/to/file.rb
@igorescobar
igorescobar / Show Which Branches are Merged (or not).sh
Created February 7, 2013 12:42
Show Which Branches are Merged (or not)
When working with feature branches, you can quickly create so many that clutter up the output of git branch --list. Every now and again you want to get rid of the branches that have made it into master. But you probably have a quick pause before you git branch -d <BRANCH>, but with the below commands you can confidently delete them without a second thought. (via Zach Holman)
If you want to see which local branches you have that are merged into the branch you are currently on, then all you need is:
git branch --merged
The reverse is also available. Show which branches haven't been merged into the currently selected branch with:
git branch --no-merged
Mash this up with a couple easy UNIX tools and you can quickly delete everything that has already been merged:
git branch --merged | xargs git branch -d
@igorescobar
igorescobar / .gitconfig
Last active April 21, 2020 07:59
A simple way to make pair programming possible with git and doesn't loose track of who's pair programming with you.
[alias]
pair = !git config user.name \"Igor & $1\"
unpair = config --unset-all user.name
@igorescobar
igorescobar / git-spush.bash
Last active April 10, 2019 14:19
Git alias to run your maven tests before push your changes to remote
git config alias.spush='!sh -c "mvn clean test && git push \$1 \$2 \$3"'
@igorescobar
igorescobar / aliases.sh
Created January 8, 2013 15:58
My personal Bash's Aliases
alias ls="ls -Gi"
alias up="script/start_local_server"
alias update_hosts="cd /Users/igorescobar/Projects/alexandria-hosts/ && ./alx-hosts update"
alias rclear="bundle exec rake tmp:clear && bundle exec rake log:clear"
alias pair-with='_(){ git config user.name "Igor e $1"; }; _'
alias unpair='git config --unset-all user.name'