subscribe via RSS

  • Vim and Ctags [vim]

    Ctags is an old tool, just like vim, and it works wonders for code navigation. Since I was recently told that TextMate doesn’t have ctags integration out of the box, I figured I’d make an article explaining it. Even if you’ve used it before, I’ll describe some of my own workflow, so you might learn something interesting anyway. I’ll start from the basic usage, and then I’ll discuss things like keeping the tags file up to date and maintaining tags for any libraries you might be using.

    [...]
  • Grouped Select Helper Methods in Rails [rails]

    I’ve always thought generating select tags was a bit odd in Rails. There are various choices and it might be difficult to decide which to use in a specific situation. A popular article on the topic is this one: Select helper methods in Ruby on Rails. It’s pretty old (2007), but still relevant. I’ll go through the helpers in that post quickly:

    • collection_select: Mostly used for model-backed data, invoked with all the method names it needs to build up the select box.
    • select_tag: A lot simpler, requires the option tags as a string, which usually needs to be delegated to another helper.
    • select: Used with a hash of names and values or with a list of pairs. This means that you can use it for any kind of data, including one from a model, but you need to prepare it first.

    What the article doesn’t cover, though, is the grouped select helpers. They’re used when you need to categorize the data with optgroup tags. There’s info on the Net here and there, but I’ll try to give a quick run-down on how and when to use them. I’ll be using the FormBuilder variants of the helpers, but I’ll also give an example later on for non-resource forms.

    [...]
  • Vim Regexes [vim]

    Finding and replacing strings are often-used operations when editing text and vim has a full-featured regex engine to aid in that. Unfortunately, it’s one of a kind – neither POSIX- nor perl-compatible, though mostly the latter. There are various differences with perl, though, and minor oddities that can be pretty annoying until you get used to them, so I’ll try to explain a few of them here.

    Note: I’ll be assuming you’ve worked with some flavor of PCRE before.

    [...]
  • My Vim Workflow: Basic Moves [vim]

    To start off, I’ll write about something I’ve actually seen interest in from people I know – my Vim configuration. I’ll try to explain my personal workflow and maybe share some useful tricks along the way. For now, I’ll limit myself to the basic stuff and exclude plugin-related wizardry, maybe I can devote another blog post to some of the plugins I can’t live without.

    [...]
  • Hello, World []

    Hi, I’m Andrew and this is my first blog post.

    [...]