I’m in the middle of moving somesites over from a self hosting VPS to Heroku and had some problems with the text encodings. Everything worked fine on the old site and on my local machine, but after a heroku db:push (copying my local MySQL database to Heroku’s Postgres), all special UTF-8 characters were not displaying correctly.
After some googling and some testing I found this solution (that is, make sure Rails and MySQL is all UTF-8), but it wasn’t enough to properly import the old data. After more googling, this worked for me:
A few weeks ago we (me & Konst & Teknik) finally released the long taking new version of CopyPasteCharacter.com — a website to help people find and copy symbols and characters that are not very easily accessible from the keyboard.
The main new thing, featurewise, is that we included many more characters than the previous version had. More characters has been the top #1 feature request the past three years the site has been online. To make the site easy to use with all new characters, we have divided everything into different sets/collections such as “Numerals”, “Symbols” and “Graphic shapes”.
We also made it possible to create your own set with characters and some smaller things like sharing sets and decide what set that should be the start set on CopyPasteCharacter.com.
Just a quick note that RailsTerm, my AppleScript to automatically open the tabs (in OS X 10.5 Terminal) needed for Rails development), is bumped to version 0.3.
Since I use Passenger (mod_rails) and Passenger.prefpane for my local development the script will now auto detect the virtual hosts available on your system (in /etc/apache2/passenger_pane_vhosts/*.vhost.conf). I use the script daily and is a real time-saver for me.
I’m quite happy with my Terminal.app setup right now for the Rails projects I’m working on and wanted to share the bits and pieces I use.
First, I found a SIMB plugin for Terminal that’ll show the tab’s title in the tab instead of the running process. I use the plugin with a simple title helper in my .bash_profile to set the title simply.
function title () {
unset PROMPT_COMMAND # more on this later
echo -ne "\e]0;$1\a"
}
# Usage:
# title 'my title'
function set_window_and_tab_title {
local title="$1"
[[ -z "$title" ]] && title="root"
echo -ne "\e]0;${title}\a"
}
PROMPT_COMMAND='set_window_and_tab_title "${PWD##*/}"'
That’s why I unset PROMPT_COMMAND in my title function, so it won’t auto update when I choose to set it manually using the title function.
The last piece is an updated version of my old Rails Term-script for iTerm which has been updated (and improved) for the Terminal in Mac OS X Leopard instead of iTerm.
It will open the tabs I usually use when doing Rails development and set the title of each tab using the above mentioned functions. You need to enter you projects root directory and the projects you want to have easy access to. I’ve added some comments to the AS code to help you out.
This is the script I’m using when I start my local Rails development server. It will automatically detect the next available port starting at the default port 3000 so I can have multiple servers running without remembering what ports that are already busy.
Tired of see the the soooo 1999-ish font “Verdana” every time you get a local error page in Rails?
Now you don’t have to. With this plugin the error pages will use Arial or Helvetica instead—finally!
I never really liked iTerm because of slow redrawing, ugly text anti aliasing and not reflowing text when resizing the window.
After reading some interviews on a Rails site today and saw that a lot of people are using iTerm i wanted to give one more try (because I’d really like a tabbed terminal).
It has improved a lot the latest months and seems really usable now. To make Rails development easier, I hacked together a small AppleScript what will ask you for the path to the Rails directory you want to use and then open four new tabs with Server/Mongrel, Console, Autotest and the directory itself. I thought it could be useful for others as well so here you go:
Save as an .app and run from Quicksilver:
global rails_dir
tell application "iTerm"
activate
set rails_dir to the text returned of (display dialog ¬
"Please Enter the Path to Your Rails Directory" default answer ¬
"~/Projects/" as text)
if (count of terminal) = 0 then make new terminal
my open_tab("Server", "&& ./script/server")
my open_tab("Console", "&& ./script/console")
my open_tab("Autotest", "&& autotest")
my open_tab("Rails Directory", "")
end tell
on open_tab(title, command)
tell application "iTerm" to tell first terminal
launch session "Default"
tell last session
write text "cd " & rails_dir & command
set name to title
end tell
end tell
end run_command