Posts Tagged ‘Ruby’

Alan deLevie posted a useful bit of Sinatra code for documenting the tables in a database in Database documentation in 50 lines of Sinatra.
I built on his code, making it database-agnostic while also turning it into a tool for comparing database structures. In the process the line count nearly doubled, so now we have database documentation in (almost) 100 lines!

It has been tested against Mysql, Postgresql and Sqlite databases.


Read Full Post »

Easy grep for Rails projects

As a lazy programmer I wrote grepr to save a bit of time/thinking.
While working on my Rails projects I often use grep in a terminal while I work on my source in Gvim. This typically means running grep on all subfolders of the app and in the lib folder. I almost always use the colour, line numbers and case-insensitive flags.

The process tends to go like this:
Press F12 to drop down the Guake terminal.
Run grep. Refactor (fiddle with the dirs and other arguments in the command) and run some more.
Toggle focus between Gvim and Guake.
Thinking about the nuances of grep’s arguments scatters my focus more than I’d like, so I simplified things a bit.

grepr without arguments displays help:

grepr usage

grepr usage

The options are designed to be easy to remember (m=model, v=view, c=controller etc) and easy to ignore. (more…)

Read Full Post »