Skip to content

Instantly share code, notes, and snippets.

View scruti's full-sized avatar

Marc Sardón scruti

  • Bichito Software LTD
  • London
View GitHub Profile
@scruti
scruti / git-clean-branches.zsh
Created November 9, 2018 10:58
ZSH function to delete git local branches
git-clean-branches() {
if [ ! -d .git ]; then
echo "This is not a Git directory"
return 1
fi;
# Get list of local branches
branches=()
eval "$(git for-each-ref --shell --format='branches+=(%(refname))' refs/heads/)"

Keybase proof

I hereby claim:

  • I am scruti on github.
  • I am marcsardon (https://keybase.io/marcsardon) on keybase.
  • I have a public key ASAun5aUNcCQV6yLfUVDkzvaWWgZM3fS_FCl7Kt6eh6pXgo

To claim this, I am signing this object:

@scruti
scruti / find_instance_replace_let_rspec
Created December 23, 2013 07:59
Replace @variable for let(:variable) at Rspect tests with Sublime Text Regexp find&replace.
Find: \@(\w+)\s=\s\{
Replace: let\(\:$1\) \{
@scruti
scruti / ScopesAndLambdas.md
Last active December 25, 2015 04:19
Wrapping RoR scopes with lambdas and updating lambdas to new syntax. Done with Sublime Text find & replace.

Moving from lambda { |param| ... } to ->(param) { ... }

  • Find What: lambda\s*\{\s*\|(\w+,*\s*\w+)\|
  • Replace With: ->($1) {

Wrapping scopes with lambdas

  • Find What: scope\s:(\w+),\s(\w+.+)
  • Replace With: scope :$1, -> { $2 }