Insights on Ruby, Git, jQuery, Cappuccino, WordPress, Debian and OS X. Please subscribe if you find something useful!

Mini Book Review: Ruby Best Practices

Posted: August 1st, 2009 | Author: Jerod | Filed under: Ruby | Tags: , | View Comments

I just finished reading Gregory Brown’s “Ruby Best Practices” (RBP). I could probably write a book about this book, but I hate long book reviews so I’ll try to keep this short.

Read the rest of this entry »


Ad Hoc Rails Console Logging

Posted: July 18th, 2009 | Author: Jerod | Filed under: Ruby | View Comments

I recently found a couple of cool old tricks for logging Rails activity directly to the console, but these solutions are pretty static once you’re inside a console session. In my experience, sometimes logging to the console is cool and most of the time it isn’t.

If you want to be able to toggle your development log between the default Rails logger and the console, just add this method to your ~/.irbrc:
Read the rest of this entry »


Sass Never Forgets

Posted: July 9th, 2009 | Author: Jerod | Filed under: Ruby | Tags: , , | View Comments

Some CSS techniques require me to Google about like a chicken with its head cut off. One such technique is placing a div in the dead center of a page (vertically and horizontally). Since I’m using Sass pretty much exclusively these days, I decided to define this technique as a mixin so I don’t have to look it up anymore.

Hopefully this can be of use to others. YMMV:

The mixin definition:

=dead-center(!height,!width)
  :height= !height
  :margin-top= -(!height / 2)
  :top 50%
  :width= !width
  :margin-left= -(!width / 2)
  :left 50%
  :position absolute
  :text-align center

To use it on an element:

#centered
  +dead-center(200px,500px)

Now I’ll never forget how. Thanks Sass!


3 Reasons Why Heroku is a Game Changer

Posted: May 26th, 2009 | Author: Jerod | Filed under: Ruby | Tags: , | View Comments

For the uninitiated, Heroku is a “cloud” (hate that term) hosting service for Ruby applications. Their claim, which I believe they have substantiated, is to be an “instant ruby platform” and their success changes the game. Here is why.
Read the rest of this entry »


Create Arbitrarily Sized Files In Less Than 15 Lines of Ruby

Posted: May 22nd, 2009 | Author: Jerod | Filed under: Ruby | Tags: , | View Comments

Ok, so I’m having fun with this “in less than 15 lines of Ruby” idea, but this time I turn my attention away from Twitter (I know, that’s hard to do right now) and toward file generation.

Sometimes you just need a 1GB file. Or a 350MB file. Or a 1MB file. It doesn’t matter what is in that file, but size does matter (heh).

With this little Ruby script, you can arbitrarily generate files of any size (using 1MB increments).

The Script:
Read the rest of this entry »