Using Git with Subversion: Part I (Installation)

May 26th, 2008

You can use Git with a Subversion repository to get some of the Git goodness, local branches, stashes and much more, without having to persuade everyone else on your project to migrate to Git

Install Git

You need to install git-svn first, with MacPorts this is as easy as

sudo port install git-core +svn +bash_completion

And then to enable bash completion (thanks to Graham Ashton for this tip)

cp /opt/local/etc/bash_completion.d/git ~/.git-bash-completion.sh
echo '[ -f ~/.git-bash-completion.sh ] && . ~/.git-bash-completion.sh' >> ~/.profile
. ~/.profile

And for those without macports here are some installation instructions

TextMate integration

If you use TextMate then install the Git Bundle

And you can set TextMate as the editor for git commit messages by adding the following to ~/.profile

export GIT_EDITOR="mate -w"

Basic git configuration

You should tell git who you are.

git config --global user.name “your name”
git config --global user.email “your.email.address@foo.bar”

If you are on OS X, then tell git to ignore .DSStore files in all your projects.

git config --global core.excludesfile .gitexcludes

And create a file ~/.gitexcludes with ‘.DSStore’ in it.

This all you need to configure but there’s much more you can do with git config e.g. aliases for git commands if you want to save those typing fingers.

Coming soon

Using Git with Subversion - Part II (Practice)

‘SELECT IN’ in rails

March 13th, 2008

#find supports select in conditions in just the way you would expect, so

Model.find(:all, :conditions => ["attribute IN (?)", [1,2,3]])

generates

SELECT * FROM models WHERE (attribute IN (1,2,3))

for MySQL.

Web apps on your desktop

March 11th, 2008

Fluid is a site specific browser for OS X, that lets you can take the web apps that you use all the time out of your browser and on to the desktop.

I’ve been using it with Gmail to give it’s own application window, dock icon etc. on my desktop rather than it just being lost amongst the 101 other tabs I have open.

If you use it with Gmail I recommend you install Todd Ditchendorf’s user script to stop a gmail popping up a blank window when you click on an external link.

MoreMoney gem

February 29th, 2008

The Money gem is a great little utility for representing money in ruby.

However it’s formatting rules assume that the currency symbol will be a dollar ($) which is makes it far less useful for those of us who need to display other currencies, euros, pounds sterling (£) and yen (¥) to name a few.

Luckily Paolo Negri has come to the rescue with his More Money gem which has all the goodness of the original money gem (configurable currencies and exchange rates) with added support for international currencies.

Installing it is as easy as

gem install more_money

Select helper methods

February 22nd, 2008

Shining through has written an invaluable guide to the ruby on rails select helper methods.

Now if only someone would turn these into a documentation patch for rails.