TextMate is a great all-purpose text editor, but it really isn't very good at advanced text manipulation or navigation. Having dabbled in emacs and its far superior text navigation commands, I found myself getting increasingly frustrated with TextMate's very basic commands. Having to use arrow keys and fully move my right hand away from home row is unacceptable.
I unsuccessfully tried to switch to emacs. I found it bloated and clunky with awkward configuration and poor defaults, and quickly switched back to TextMate. I finally decided to give vim a try, and was surprised at how decent it was despite the steep learning curve. It has an elegance that emacs seems to lack. After two days of using it on a rails project I made the decision to commit to vim and invest in learning its many motions and commands.
Here are some great resources I used to get started:
- MacVim - the popular graphical vim for mac
- PeepOpen - this is the main reason I chose to use MacVim over the terminal vim. If you're coming from TextMate, you'll definitely want the awesome CMD+T shortcut it provides (and if you don't know what I'm talking about, prepare to become addicted)
- rails.vim - an essential plugin for rails developers
- snipmate.vim - an excellent snippets plugin that will feel very familiar to TextMate users
- Color Sampler Pack - a massive collection of excellent themes for vim
- VI Cheat Sheet - an excellent cheat sheet designed by GoSquared for Smashing Magazine
The two main vim config files are ~/.vimrc and ~/.gvimrc. MacVim will read both, so you'll want to put generic options in .vimrc and options that only apply to a graphical vim (such as the themes linked above) in .gvimrc.
A few learning references I found especially helpful are:
After installing RVM, Ruby 1.9.1 and setting up a rails 3 Project, I wanted to setup compass.
Following some advice from http://blog.firsthand.ca/2010/03/getting-rails-30-running-with-stack-on.html I went ahead and added gem "compass", "0.10.0.pre9" to my Gemfile, ran bundle install, did the usual compass --rails . and encountered an unexpected error:
/Library/Ruby/Site/1.8/rubygems.rb:827:in `report_activate_error': Could not find RubyGem chriseppstein-compass (>= 0) (Gem::LoadError)
It seems RVM was somehow relying on my old compass gem I previously used with my system ruby. After trying a few things, I was able to get it working by opening a new terminal, rvm use system, and sudo gem uninstall chriseppstein-compass. Switching back to my rails project, compass then ran as expected.
Here's a simple way to manage authentication for SVN repos on OS X Server.
More complex groupings could be setup on a per-repo basis as well.
In need of a simple text-to-speech web service, I wrote this little script on
Sinatra to return an MP3 to the browser. The TTS is being handled by
Festival (which I absolutely would not recommend) and piped to
LAME (which is great) for MP3 encoding.
I ended up not using this script in production since Festival's TTS quality is horrible, but it was a fun exercise nonetheless.
Interesting new declarative, cloud-based web app platform: <angular/>. Super simple and easy to get up and running. Because all the magic happens in JavaScript, you can run your app bits locally (during development) or on someone else's server with zero config. Looks very useful for on-the-fly data persistence, on client sites in particular.
To avoid charset issues when pulling from a MySQL database using AMFPHP:
1. Find the line in your gateway.php where the setCharsetHandler is set.
2. Modify the default to:
$gateway->setCharsetHandler("mbstring","UTF-8","UTF-8");
In an attempt to save you hours of painful debugging and Adobe-hating: if you're wanting to use the excellent AS3 bulk-loader lib to load assets from S3, follow these steps. Especially step 2.
1. Put your normal crossdomain.xml in place in your S3 bucket
2. Use a loader context on every BulkLoader !
var context:LoaderContext = new LoaderContext(true, ApplicationDomain.currentDomain);
var loader:BulkLoader = new BulkLoader("loadmystuffplskthxbye");
loader.add( someS3Url, { context: context } ); // WIN