Tuesday, January 22, 2013

VIM as an IDE? Bah.

Linux is the IDE.
Vim's just a ridiculous powertool inside of it.

Today I embarrassed myself by telling a windows guy "this is a powerful example of what linux is", and tried fgrepping into vim, forgetting the -l switch.

So I was running:
Moron> fgrep -r TODO | xargs vi

Which was opening up hundreds of files all at once, named fix, this, by, subclassing etc

Took a while. Guy thinks I'm a moron.

Wednesday, January 9, 2013

python dictionary interpolation - wow

I never knew this worked:

>>> fruits = { 'apple' : 1, 'orange':3, 'banana':4 }
>>> print 'I have %(apple)s apple, %(orange)s oranges, and %(banana)s bananas' % fruits
I have 1 apple, 3 oranges, and 4 bananas

Python will take your dictionary and allow you to interpolate it in a string formatting. This leads to some really nice readability.