A A

Archive | December, 2008

Gentoo Sucks, Ubuntu Doesn’t.

Monday, December 29, 2008

19 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 new [...]

Quick BASH Script to Dump & Compress a MySQL Database

Saturday, December 27, 2008

1 Comment

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) #!/bin/sh # Isam (Biodegradablegeek.com) public domain 12/28/2008 # Basic BASH script to dump and compress a MySQL dump   out=sequel_`date +'%m%d%Y_%M%S'`.sql dest=/bx/   function e { echo -e "n** $1" }   e "Dumping SQL file ($out). May take awhile..." #echo "oh [...]

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, :edit, [...]

Using Javascript to Populate Forms During Development

Sunday, December 7, 2008

1 Comment

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 [...]