home icon contact icon rss icon

Textmode

tools I use

Archive for Home

github.vim a vim plugin for github

Recently drnic showed me his textmate bundle for github and I was really impressed.

It let’s you do the following:

  • select some lines of code in Textmate, and open the same section (including selection hilighting) on the corresponding public github url
  • go to a specific line of code, hit a key, and get directly to the github page of that commit and file, ready to post a comment

I didn’t even know about those possibilites github offers.. and I thought, wow I need this in my editor (vim) too.

So i created a little plugin, my first vim plugin, wrapping the – fortunately very modular – scripts drnic wrote.

There are 2 branches:

  • Master – a standalone version without the github-tmbundle dependency
  • TMB – a shorter version that depends on the scripts included in github-tmbundle

Both are available on my github repository as github-vim

The latter is easier to maintain since I only have to write calls to the existing methods, so I will update it with all new features in the tmbundle as soon as possible. But I will try to keep the standalone version as current as possible.

As mentioned this is my first vim plugin, therefore any suggestions, corrections and requests are very welcome.

21 nice Ruby tricks

Although there are tons of tricks and shortcut sites, 21 Ruby Tricks You Should Be Using In Your Own Code by Peter Cooper is really nice.

Many things I did not really use or forgot. Check it out.

Ack-Grep, a grep replacement

Ack-Grep is a replacement for grep written in perl.

It’s basic usage is ack fubar, which is about the same as grep -r fubar

It’s a very fast tool since it excludes a lot of files you don’t really want to search (like repository information, temporary files, backup files etc.) And furthermore it let’s you define and specify specific filetypes.

For example, I often want to search only .dryml files (I’ll mention in a future post what this is all about). To define such a custom simple define it in your ˜/ackrc like this:


--type-set=dryml=.dryml

This enables commands like


ack --dryml fubar

searching only files ending in .dryml

Furthermore the option ack-grep -f let’s you list the files only, without actually searching them, this can be useful, although good shells provide similar functionality. It’s nice to simply use something like


ack -f --dryml

You can even print the matching parts with perls special variables like $&.

Give it a try, you will like it! Note: The Debian package name is ack-grep, not ack.

Ruby HTMLdoc gem, falseClass error

I encountered the error “undefined method `size’ for false:FalseClass” with the ruby htmldoc gem

The error is caused by htmldoc (1.9svn here) returning some additional white spaces in it’s output and the htmldoc gem parser doesn’t recognize it. I was able to reproduce the bug partially when using images, but not always – which is quite funny ..

Anyways, a simple String#strip! helps, here is a patch for htmldoc.rb.

Edit:

To apply the patch download the file into the directory where htmldoc.rb is located (/var/lib/gems/1.8/gems/htmldoc-0.2.0/lib/ in my case), and run:


patch < htmldoc_gem_patch.txt

Opera Dragonfly: no more Firefox & Firebug

Yay, check out Opera Dragonfly, Opera’s answer to firebug.

Finally there is a good alternative to using the memory eating Firefox monster to get firebug’s functionality.

It’s only a Alpha release, without editing support, but I guess it’s in very good hands :)

A button has been posted in the comments already: Opera Dragonfly