1. Git --porcelaind and Sed

    Git, the de-facto version control tool, has many, many commands and options. Most of possible combinations are never used / explored for most users. One of them is the --porcelain option.

    This option, present in some commands as by example git status, forces output to be well formatting for use as input for other programs. I'll explain you one possible use what helped me in some cases.

    Imagine you are branched to test or prove a crazy feature. Things didn't work as spected and you change yor mind. You didn't git added nor commited anything. You want to delete it all!

    Deleting branch with git branch -d just deletes the branch. The upper case -D don't aid in this case, due your branch has no commits.

    For modified files is as easy to git checkout . which restores your modified files to the latest commit. But for added files, you have to delete one by one with the rm operative system command. But, wait! Can I rm all? NOT! It will make a lot of changes prepared to stash in your directory!

    Imagine you have this git status


    if you type the --porcelain option is transmuted as

    ?? app/assets/stylesheets/scaffolds.scss
    ?? app/views/users/index.html.erb
    ?? app/views/users/index.json.jbuilder
    ?? app/views/users/show.json.jbuilder
    ?? db/migrate/20150214195644_create_users.rb

    Then comes to help us the sed command. This stands for stream editor

    Try this:

    $ git status --porcelain | sed s/\?\?/rm/ | bash

    And your files will be deleted. A no one file that is not in the list!

    If you wonder what it makes, here is the solution: the regular expression changes ?? by rm. And finally, the result is passed to bash to do the dirty work.

    Published on

  2. You live and learn or you don't live long

    Today, as a serendipity, I found this quote. It's from Robert A. Heinlein, an author I didn't know until today. I'm writing about him because this quote says the same I wrote in the about me of this blog. Now I see this is true as live: don't stop learning, my friend.

    Published on

  3. Ironhack. Week 03

    The teachers

    Another week here at Ironhack! This week was devoted to frontend. First two days with Rude Mortensen, who taught us CSS and Bootstrap. Next three days with Luis Rovirosa, JavaScript and JQuery

    The talks

    This week was plenty of talks and meetings.


    Gonzalo Manrique, co-founder of Ironhack, explained the company creation. Growth numbers are awesome in just two years. After Gonzalo's talk, we go to an informal meeting with the CEO of Evil Martians a Russian development company specialized in Ruby on Rails. Alexander Tishchenko was a very verbose guy, with a lot of interesting things to explain to us. We grab one beer and listened to him with interest, and made some questions.


    Bitcoins with Borja Rossell. This very young guy is the founder of BTCPoint, a company located in Barcelona and San Francisco who creates bitcoins cash machines, one of them located here, at MOB


    Scott Mackin, founder and CEO at Barcinno drove another beer talk about his company. He's specialized in help newcome entrepreneurs to Barcelona.

    The subjects

    Frontend for old-style developers as me is not easy. In my known world, you put a button inside a frame and some controls or widgets and your user interface is done. Everything is where is supposed to be. With CSS, with or without frameworks as Bootstrap, all is more complicated. Luckily are a lot of docs and resources to make easy the switch.

    The Friday evening

    beer driven development Beer driven development on Friday

    Published on

  4. Ironhack. Week 02

    The teacher

    This week we continue with Ruby, covering TDD and Sinatra The teacher is Albert Bellonch. A young entrepreneur, creator of the SaaS Quipu

    The talks

    We had two talks this week:

    On Tuesday Àlex Rodríguez Bacardit, (CMO at Marsbased and Organizer of Startup Grind) talked about his company Mars Based and "StartUp BCN Ecosystem" MarsBased works exclusively in Ruby on Rails. I got great insights and experiences from him. Alex, giving an interesting talk about how he created his startup Alex, giving an interesting talk about how he created his startup

    On Thursday Guillermo Marqueta (Inlea Foundation Director and Co-organizer at Barcelona Lean Startup Circle), talked to us about Lean Methodologies Guillermo talking about customer development Guillermo talking about customer development

    The subjects

    I enjoyed a lot with TDD. Most students never heard before about testing. I did testing with dUnit.pas before and was a sort of frustrating due in our Delphi + Database stack is almost impossible mocking and unbinding some parts. May be Ruby debugger tools are very primitives, the case is TDD in Ruby (done by rspec) is easy and productive.

    Sinatra and ActiveRecord where the other great characters in our week. Just scratched the power of boths in every day more complicated exercises.

    The Friday evening

    This is a tradition! Beer countdown Albert put this countdown to stimulate us to finish exercises and go to celebrate it.

    The Tank Battle

    This week had an extra. On Saturday evening, some of we joined to Xavier to play with Ruby Tanks. Using a gem named RTanque, you program the "brain" of your tank and send it to fight against other programmed tanks. It was funny, but mine didn't be a masterpiece :) RTanque gem in action RTanque gem in action

    Published on

  5. Ironhack. Week 01

    The day arrived

    At least, after two months of considering, deciding and making the prework (I speed almost 40 hours with it), the classes started. We met our teacher, Rafa de Castro.

    In Ironhack courses every week we have a different teacher, teaching different subject.

    Our cohort is formed by 13 people. There are from UK, Germany, Lithuania, Canada, Venezuela, Colombia and Spain.

    The welcome pack has to stickers to put on your laptop The welcome pack has to stickers to put on your laptop

    The teacher

    Rafa, an excellent Rubyst, and a twisted mind designing programming exercises, was a great and patient teacher.

    I was surprissed to see some students with no previous programming experience, fighting against very difficult exercises. Not only language was new for them, also the keyboard (regular users don't use brackets nor know anything about shortcuts), the code editor ... We use Sublime Text

    When finished first week, nobody abandoned. Great! Good news!

    Ironhack talks

    As part of our learning, Ironhack has programmed a series of talks done by interesting people.

    On Tuesday, Xavi Leal, Ironhack COO, talked to us about "How to get a job after IH"

    On Thursday, Elena Torró.

    Elena talk to us about UX (user experience), a concept beyond the UI (user interface). Elena talk to us about UX (user experience), a concept beyond the UI (user interface).

    Friday evening

    Friday evening is different. We say goodbye to the teacher and have some beers, here at MOB. It's a great moment. Friday evening is different. We say goodbye to the teacher and have some beers, here at MOB. It's a great moment.

    Published on

  6. Ironhack. The Prework

    How it works

    When you are enrolled, Ironhack sends to you a bunch of work to be done before the bootcamp starts. This include:

    • Configurating your machine. Your computer must be a Macbook or a Linux box. Sorry, no Windows allowed :)

      currently at the boocamp, we are 8 Macbooks and 5 Linux. I use Linux Mint, an excellent Ubuntu/Debian based distro.

    • Study a heavy lot of material: Ruby, HTML, CSS, Javascript, Git, Shell

      The recommended shell for both Mac and Linux is zsh. I like a lot this shell. You can forget Bash.

    • Make exercises based on these materials and send to your prework teacher.

    Cohort communication

    Ironhack uses Slack for group communication and file sharing. It's a great platform. Slack's web is superb and mobile app performs as well. I recommend to your team. It's a must.

    Also used Google hangouts to do meetings before the course started. In English, of course :)

    Published on

  7. From Delphi to Ruby

    What is Delphi?

    A thing what wondered me when started to learn Ruby was some similitudes with Delphi. As you may know, Delphi is no more than Object Pascal, an ancient language with a lot of improvements made by Embarcadero since they acquired Delphi to Imprise Tehcnologies, former Borland. Today Delphi can generate code for Windows, MacOS, iOS and Android with some caveats, but it's possible.


    At first glance, blocks not only are formed alla C with the curly brackets { ... }, in Ruby you can also use the do ... end syntax, similar to begin ... end of Pascal.

    Another similitude is you can separate sentences with semicolon ";", despite it's considered a bad practice, due it is only necessary when putting more than one sentence in a line. If you write a sentence for line, the line end is enough.

    And there are more:

    • sections of visibility inside class declaration use same words: private, protected, public ... and act as a sections separators, just as Object Pascal does.
    • the null value is named nil, exactly as Pascal.

    The mythical one line Fibonacci calculation

    Ruby is concise. Very concise. As a sample for my Pascalian readers, this is a function to calculate n Fibonnaci number:

    def fibonacci(n)
      (n < 2) ? 1 : fibonacci(n-2) + fibonacci(n-1)

    More to come

    I guess I'll discover more similarities. It's just a bet to myself :)

    Published on