February 2012
1 post
undefined method `original_path_set' for...
Just a quick note: If you are testing a module which you include in multiple controllers you need to describe the controller name you are testing, not the module name or you end up with the stack trace below Failure/Error: Unable to find matching line from backtrace NoMethodError: undefined method `original_path_set' for nil:NilClass #...
Feb 20th
November 2011
2 posts
Aphro gem and HATEOAS
Aphro I’ve been captivated by this topic and am currently in the process of building a Ruby gem to help consume HATEOAS compliant services. I’ve called it Aphro for want of a better name and because I think HATEOAS isn’t a very nice name. One thing I’ve been finding in my thought experiment is that the hypermedia constraint (better name in my opinion than HATEOAS), is...
Nov 27th
HATEOAS
I’m veering further from the simple vim and ruby path and may need to rename this blog. I’ve been trying to gain insight into the meaning of HATEOAS. This started off as a README for my fork of Steve Klabnik’s Hateos project. I have an intuitive sense that there must be value in the principle of HATEOAS, but I’m really not fully sold on the ideas. I’m posting...
Nov 13th
2 notes
September 2011
1 post
Ruby 1.9.2 invalid character property name...
OK this has nothing to do with Vim, but sometimes I want to talk about just Ruby too. I came across the following issue: This is OK: "abcアイウ".scan(/\p{Katakana}/) => ["ア", "イ", "ウ"] This isn’t: "abc".scan(/\p{Katakana}/) invalid character property name {Katakana}: /\p{Katakana}/ Workaround works: line = "abc" "#{line}☃".encode('utf-8')[0..-2].scan(/\p{Katakana}/) =>...
Sep 11th
August 2011
1 post
Aug 20th
July 2011
3 posts
DOS/Unix line endings
I have a setting to automatically trim whitespace at the end of lines on save. I found that the pre-commit gem was still warning me about trailing whitespace Turns out that the file was in DOS mode and was saving ^M style line endings and pre-commit didn’t like it. No amount of whitespace trimming would save the day. I ended up viewing the file in hex mode before I noticed. Anyway, if...
Jul 25th
Toggling relative line numbers
Do you like the relative line numbers setting? set relativenumber  I do, but sometimes I’d like to see the actual line numbers when going to a line in a stack trace for example. Anyway, try:  let g:show_relative_numbers = 1 function! ToggleRelativeLineNumber() if g:show_relative_numbers set number! else set relativenumber! endif let g:show_relative_numbers =...
Jul 12th
Mac keyboard shortcut inconsistencies
I use Chrome, Terminal and MacVim now on a daily basis. One thing that absolutely kills me is inconsistency in user interfaces. When I switch between tabs in any application I expect it to be pretty damn predictable. Save yourself hours and hours in a year by going to your System Preferences > Keyboard > Application Shortcuts  And work your magic to make it look like this:
Jul 6th
May 2011
3 posts
Actually close all (saved) buffers in vim
A google search at present returns questions about closing all buffers easily in vim but not straightforward tutorials - which always makes me feel that the issue is not being properly solved. Well it took me a while to wade through the initial search results and actually find something that closes all saved files. (Next post will deal with a destructive close all including unsaved files.) ...
May 11th
Vimscript tutorial →
May 11th
VIM: Specs side by side with controllers/models
Update It seems you could do this already with :AV. I’ll leave this post here for posterity’s sake. Using vim for Rails development I often found myself entering :Rcont :vsp :A to see my controller spec on the left, with my controller on the right. now with this in my .vimrc: nmap vspa :vsp<cr>:A<cr> nmap RC :only<cr> :Rcontroller<cr> :vsp<cr>...
May 10th