A A

Archive | December, 2008

Gentoo Sucks, Ubuntu Doesn’t.

Monday, December 29, 2008

25 Comments

I used Gentoo for a few years, and at first I loved it. Mainly because of portage, but the only distro I had experience with before Gentoo was Slackware, and I used to install packages and dependencies manually, so you can see why Gentoo would was so appealing to me. When I first began my [...]

Quick BASH Script to Dump & Compress a MySQL Database

Saturday, December 27, 2008

2 Comments

A quick script I whipped up to dump my MySQL database. Usage: sh backthatsqlup.sh (be warned that it dumps ALL databases. This can get huge uncompressed) download BackThatSqlUp.sh

Refactoring Tip: Eliminating Model.find(params[:id]) Duplication

Sunday, December 7, 2008

0 Comments

In a controller, you’ll commonly have a method that requires you have an instance variable containing the object you’re working with. An example would be the show, edit, update, and destroy methods (REST). To eliminate having find(params[:id]) in multiple methods, you can use before_filter, like this: class Admin::PostsController < Admin::ApplicationController before_filter :find_post, :only => [:show, [...]

Using Javascript to Populate Forms During Development

Sunday, December 7, 2008

2 Comments

During development, working with forms quickly gets annoying because you have to constantly fill in each field, sometimes with unique info. One way around this is to write a little Javascript code that just populates the fields. I use something like this on the bottom of the form. I had jQuery no-conflict mode on in [...]