Posts Tagged Vim
My Ruby on Rails photo site hosted on Heroku
Posted by Michael Okarimia in Cloud, Ruby On Rails on June 6, 2012
In a previous post that I wrote on the topic of deploying web applications on to Azure cloud I compared that to my experience of deploying Ruby on Rails web apps onto Heroku.
I realised that I’ve not mentioned my experiences with coding in Ruby. My motivation to learn Ruby On Rails was triggered by the fact that I was developing a rather large Asp.Net MVC web app in my day job, and according to one of the books on my reading list it was the inspiration for the Microsoft’s framework.
I’d returned from a holiday in Russia and I wanted to share the photos with my friends in a novel fashion. Why not create my own website to share them and learn Ruby On Rails in process? As a result, I created a few sites using RoR, this one being the public clone of my photos website The rest of this post covers how I launched these sites.
After a little googling, I decided I would do my Ruby development on a Linux based OS as opposed to Windows, since I would be able to keep up my Linux knowledge. Vim was to be my text editor of choice.
To get a grasp on the Ruby language I started working on the Ruby Koans exercises and once I felt sufficiently competent I moved onto understanding how it weaves into Rails to result in the accomplished and popular web framework. Michael Hartl’s Tutorial is the perfect place to start
I dabbled with deploying a Ruby On Rail web app on Phusion Passenger without much luck, so I then decided to take the simplest route to hosting and go with Heroku. I’d already decided that I would learn Git quite some time ago; now would be the time to take the plunge!
Along my path of deploying the web site I went for the option of using a mature open source photo site called Balder. Doing this meant I could get my web site launched in a reasonable time frame, and to also avoid reinventing the wheel
Overall I felt it was a positive learning experience. I started to learn a new language and framework, which allowed me to appreciate MVC.Net and see where Ruby isn’t so great in comparison. For example, Ruby’s concept of Active Record may be useful for rapid development, but it lacks the strengths of Fluent NHibernate. Some have argued that Active Record is itself an anti-pattern.
I became much more familiar with the Linux Terminal and I’m happy to see that Windows Power Shell has Windows analogues to Linux commands I’ve committed to muscle memory. I’m also a big Git fan and I’m comfortable using it at the command line.
With my understanding of git I’ve come to use Github too, and all the great ideas that flow from it.
It was a worthwhile endeavour, even just for the insight gained. You can visit the fruits of my labours and see for yourself: http://publicpics.herokuapp.com/
How to bind caps lock key to escape key on Windows using AutoHotKey for Vim only
Posted by Michael Okarimia in Handy Tips on April 24, 2012
Here’s another Vim tip that I find very handy. When using gVim on Windows, I can bind the escape key to caplock, but only for Vim. This method relies on using AutoHotKey, an excellent tool.
Once installed, right click the AutoHotKey icon in the system tray and select “Edit This Script”.
A text editor will open, with the default script that executes when AutoHotKey is running.
Add the following code snippet to the end of the script:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | classname = "" keystate = ""</code> *Capslock:: WinGetClass, classname, A if (classname = "Vim") { SetCapsLockState, Off Send, {ESC} } else { GetKeyState, keystate, CapsLock, T if (keystate = "D") SetCapsLockState, Off else SetCapsLockState, On return } return |
AutoHotKey is designed to run in the background. When Vim is running, a capslock key press will operate in an identical manner to an escape key press. Even better is the fact that the capslock status for Windows does not change when Vim is in focus.
Enjoy!