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 [...]
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 [...]
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, [...]
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 [...]
Monday, December 29, 2008
19 Comments