The git-rebase option no-one knows that will shock your coworkers!

A few weeks ago, a moment before pushing upstream a glorious bug-fix, I ran the test suite locally, just to discover that I broke it!

Having lost all confidence in the commit history, I was out for blood, looking for the piece of code that ruined the whole PR!

With more than a hundred git aliases I consider myself quite a git nerd, so I reached out for a tool I knew: git rebase.

My plan was:

  1. mark each commit with edit
  2. run the test suite with bin/rake at each stop
  3. identify the offending commit and fix whatever bugs I encountered
  4. amend the commit and call it a day

That didn't feel right tho, it was too clunky, I had a hunch that I could have done better than this! So, after reading once again the git rebase documentation, this little option popped out: git rebase --exec!

What --exec does to git rebase

The magic of --exec is that it will execute a command after each commit in your interactive rebase. If the command fails, it will stop the rebase, allow you to fix whatever needs to be fixed, and move along with git rebase --continue.

This means that I was able to swiftly run this command after each commit and ensure that I had a green suite at every step of the PR.

bash git rebase --interactive --exec "bin/rake" origin/master

Don't forget that this neat trick can be used for all kinds of problems, like, for example, running a linter for every commit of a PR.

Nov 4, 2013 opal · ruby · euruko · lightning · talk · 2013

Euruko 2013 Opal lightining talk

For those who missed it here's the lightning talk I gave in Athens at Euruko 2013 (at minute 17:00):

Downlaod it here

(beware: the slides in the video have the wrong aspect raito)

Oct 10, 2013 opal · ruby · browser · meh · tabs · spaces

Reading meh's code


I don't always read meh's code
but when I do it, I convert tabs to spaces.

The bookmarklet: ↦ meh` (drag it to your bookmark bar)

UPDATE: Now works with GitHub expanding tabs to non-breaking-spaces (history here)

Aug 21, 2013 opal · ruby · browser · talk · slides · video · rails · javascript · italian

Opal Talk at RubyDay 2013 video availble!

Hey, the talk I gave at this year's (2013) RubyDay is now on youtube!
I'll update the post with the slides soon :)

(LANGUAGE: Italian).

Jul 3, 2013 ruby · rails · rails3 · railsapi · sdoc · documentation · docs · ruby2 · github · api

Past and Future of Ruby and Rails

As a sad orphan of I’m proud to present you valuable links to ruby and rails documentation in SDoc format:

Searchable Ruby 2.0 API documentation

Searchable Rails 3.2 API documentation

Mar 4, 2013 git · autocomplete · shorthand · shortcuts · bash

Autocomplete "git" as "g"

For all you lazy Git bums, here’s how you can type “g” got “git” and still have autocompletion (paste into your ~/.bash_profile or .dotfiles system):

alias g='git'
complete -o bashdefault -o default -o nospace -F _git g 2>/dev/null \
    || complete -o default -o nospace -F _git g
Feb 12, 2013 pow · jruby · hack · sockets · support

Let jRuby and Pow!™ be happy together

Turns out that Pow! won’t support jRuby anytime soon but the trick described in josh/nack#32 actually works, so rollup your shirt’s sleeves!

Go open node_modules/nack/lib/nack/server.rb inside ~/Library/Application Support/Pow/Current and replace sock.close_read on line 132 with:

# WAS: sock.close_read
rescue IOError
  raise unless RUBY_ENGINE == 'jruby'

Happy hacking!

Nov 29, 2012

rvm install opal

Sep 29, 2012 safari · backtrace · rails

Get back Rails backtrace links on Safari 6

If you’re back to Safari and want your clickable Rails backtraces here’s the solution: Download RailsnStacktracenlinks.safariextz

Thanks to that made supereasy transform a userscript into a Safari extension.

Links again!

Aug 13, 2012 rubyday · 2012 · slides · rails · views · oop · instance variables · monkey island

[slides] Rails views for the OO-savvy Rubyist

Rails OO views from Elia Schito

note: transitions and music are lost with slideshare, but you can get an idea of them in this video: