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, [...]
One reason many people don’t contribute to open source apps is because they find it daunting to look through somebody else’s code. Some might even think that it’s just simpler to write something from scratch than to study someone’s work. This isn’t true, and reading foreign code is something get used to and excel at [...]
I’ve recently taken a fancy to Mephisto, a blogging-platform written in Rails. I have nothing against Wordpress, but being in Ruby and using Liquid for themes, Mephisto is far easier (and more fun) to tweak and configure, especially when I want to migrate my sites away from the “blog look” and make them more dynamic. [...]
These are not in any specific order. Also, some might be available on other operating systems.
Tomboy
This is the best note taking app I’ve ever used. It sits in your taskbar, doesn’t annoy you and doesn’t hog your cpu cycles or memory. When you wanna jot down something, hit a global shortcut, type away, and [...]
Mac OS X is capable of intelligently detecting whether a cat5 cable is connected to a network device or to another PC. When connected to another PC, it will (digitally) flip the pins to “emulate” a cat5 crossover cable.
Here’s an example on how to share files between a Macbook and another box (XP, Linux etc). [...]
I was staring at the 30+ RapidShare tabs I have open, annoyed that I had to keep waiting for the countdown timer before starting each download. The problem was that I kept forgetting about the countdown and the downloads altogether (30 second timer + Geek-ADD… impossible). It literally took me 10+ hours to get one [...]
All of these extensions work on Firefox 3.x
Firebug
What can I say.. Firebug is indispensable. It’s quite possibly the greatest piece of software since Firefox itself. It’s a *must* have if you do any sort of XHTML/CSS/Javascript/AJAX/er.. anything!
You can edit code on any site, live. Hate the annoying background on a specific site? Get rid of [...]
There are plenty of ways to save pictures you find on Flickr. One way of doing so (in Firefox) is right-clicking the browser page and heading to View Page Info -> Media. This is too much work.
Flickr layers a transparent file named spaceball.gif – a 43 byte 1×1 px file – over some images, rendering [...]
Vim 7.2 beta was released last month, and 7.2 is now stable. First check to see if your distro offers a package, and if not, follow these simple instructions on how to install it from source, from the vim7.2 subversion branch.
cd /tmp/
svn co https://vim.svn.sourceforge.net/svnroot/vim/branches/vim7.2
cd vim7.2/
./configure --with-features=huge --enable-gui=gnome2 --enable-cscope --enable-pythoninterp
make
Now you can use sudo make install [...]
This falls under “Why Didn’t I Think of This Before?”
Not being able to remain focused and get things done while working on a computer is common. There’s a countless number of things to do even offline. You can, and probably do:
Organize folders/desktop/etc
Finally get around to actually opening up an ebook you’ve downloaded
Customize your desktop (and [...]
Sunday, December 7, 2008
0 Comments