Code In Design

Feb 10

Weekly #2

Weekly round-up of Ruby and Rails related news and articles.

Feb 03

Weekly #1

Weekly round-up of Ruby and Rails related news and articles.

Dec 09

One of Ruby's better-kept secrets: how to get temporary directory -

Here’s how

require 'tmpdir'
puts Dir.tmpdir

Dec 08

How to add working directory to $LOAD_PATH

Simply

$:.unshift File.dirname(__FILE__)

Nov 30

How to completely reset a remote repository

Delete the .git directory locally

Recreate the git repostory

git init
touch .gitignore
git add .gitignore
git commit -m 'Initial commit'

Push to remote server, overwriting

git remote add origin <url>
git push --force origin master

How to create a new empty branch

Create a new empty branch named “your-new-branch”, clean up, add .gitignore and commit.

git symbolic-ref HEAD refs/heads/your-new-branch
rm .git/index
git clean -fdx
touch .gitignore
git add .gitignore
git commit -m 'Initial commit'

Sep 15

How to install rmagick gem on Ubuntu 10.04? -

Why can’t I remember this?

$ sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev
$ gem install rmagick

Aug 16

How to merge branch back into trunk

$ cd /path/to/trunk
$ svn merge --reintegrate http://example.com/path/to/branch

Jun 21

How to install Firefox 4 on Kubuntu 10.10

I’m a Kubuntu 10.10 user who want to use Firefox 4. Here’s what I did

Add the Firefox Stable PPA to the system source

sudo add-apt-repository ppa:mozillateam/firefox-stable
sudo apt-get install firefox

Remove the Ubuntu modification add-on

sudo apt-get purge ubufox xul-ext-ubufox

Remove the old Firefox 3.6 language pack

sudo rm -rf /usr/lib/firefox-addons/extensions/langpack-en*

Done. Now you have Firefox 4 on your Kubuntu.

May 05

When you use after_sign_in_path_for, make sure your root controller is publicly accessible.