Wednesday, May 30, 2012

Quickly checkout Git remote branch into a local branch


git checkout -b LOCAL_BRANCH origin/REMOTE_BRANCH

Friday, May 18, 2012

Codeblocks for Markdown

From Daring Fireball:
To produce a code block in Markdown, simply indent every line of the block by at least 4 spaces
At least 4 spaces... so that means 2 tabs if your tab is set to 2 spaces.

SQL dump for MySQL databases

backup:

mysqldump -u root DATABASE_NAME > sqldump.sql
restore:

mysql -u root DATABASE_NAME < sqldump.sql

Monday, May 7, 2012

Search and replace words in multiple files in Vim

Upgraded my project's factory girl and got some nasty warnings about Factory(:xxx) and Factory.create(:xxx) syntax being deprecated. I've been using the former for almost all of the specs so needed an easy way to search and replace words in multiple files in Vim.

:args app/models/*
:argdo %s/Factory(:/FactoryGirl.create(:/ge | update