Dr Nic

How to yell at people with GitHub from TextMate

Sometimes when you are perusing code you ask the question: why the hell is that there? or why does this even work?

Now you can instantly navigate from that erroneous line to the git commit where it was added, and then using github’s commenting system add a full-flavoured remark about that person’s code. I’m not sure if profanity is against the GitHub Terms of Service, but I’d rather ask forgiveness than permission.


TextMate + GitHub – how to comment/discuss on a line via GitHub from Dr Nic on Vimeo.

Download and installation instructions are available in all good bookstores.

Just for TextMate?

There is an editor for Windows – E-TextEditor – that was designed to support TextMate bundles. So far, the GitHub bundle doesn’t use any special features of TextMate’s latest-and-greatest UI libraries, so it should be usable on E-TextEditor.

Also, a VIM project has been created to port the GitHub bundle, by Christoph Blank. Cristoph can be found hanging around #hobo on irc as ‘solars’, if you want more goodies in the VIM bundle.

GitHub and TextMate Unite

I wanted to go from a source file to the equivalent file on github. I wanted a selection of lines in TextMate editor to also be selected when I was taken to github.com. I wanted to cut back on my senseless killing of innocent pasties.

Finally, I wanted to make a nice little video to show off the new GitHub.tmbundle.


TextMate and GitHub: Show the current file in GitHub from Dr Nic on Vimeo.

Which remote repository is it choosing?

If you have multiple remote references to github.com repositories, then the algorithm picks one in the following order:

  1. A remote named ‘github’
  2. A remote named ‘origin’
  3. The first remote for a github.com repository

What else could go in a GitHub textmate bundle?

Rails 2.0 TextMate bundle – Tasty Tidbit – respond_to and view navigation

The new release of the Rails TextMate bundle is coming soon. Its guaranteed to be shiny, sparkly and will fit in with any home or office decor. More importantly, it will be upgraded for Rails 2.0.

Today is the first Tasty Tidbit – a demonstration of one of the snazzy new features coming to your Macintosh soon.

In this Tasty Tidbit, we look at respond_to and the ability to create and navigate to view templates based on the selected format block, such as wants.js -> .js.rjs.

Cannot see the embedded video? Want the Hi-Def version? Download the video (5 Mb).

Contribute to the Bundle

To clone the git repository and start sharing your own personal goodness, see previous article.

Find objects in IRB directly from browser URLs

A long time ago, I tired of going into the irb/console and finding objects/models using the traditional ActiveRecord command Person.find(15) and now I’m sitting pretty: I can paste in URLs to fetch objects.

# No more of this:
=> Person.find(15)
# instead:
=> people/15

people/15 is something you’ll copy+paste directly from your browser: http://localhost:3000/people/15

Of course, the url is based on your routing + controllers, so the assumption here is that your routes/controllers map to your active record models. That is, your app is smothered in RESTful love and cuddles.

Not following this? Here’s a video:

How to make this work at home

Copy and paste the following into your .irbrc file:

Thanks goes to…

The some original code for this comes via Mike Clark, who had the idea for syntax activity(6). This was good.

I previously had another idea to support the syntax 6.to_activity using the RubyGem to_activerecord. I still like the id.to_class_name structure of this and still use it.

But if I have a perfectly nice looking url sitting in front of me, I can now paste the class_name/id part into irb and I’m off and running.

Happy New Year.

Everything you wanted to know about Ruby.NET

Recently Wayne Kelly spoke at the Brisbane Ruby and Rails Brigade about Ruby.NET (code repository).

We figured he was some authority figure on the topic, as he wrote it, together with some other members of his QUT department, plus a growing number of Ruby.NET users and contributors.

Local Microsoft officialdom sponsored the show with pizza and then drinks afterwards. Ok, I’m understating that – Charles Sterling is an ex-.NET project manager, who is now in Oz for a Tour of Duty as an Evangelist. In his capacity as an evangelist, he giveth us thy pizza. Twas tasty too.

I believe Ruby.NET is in direct competition with IronRuby for the hearts and minds of Ruby/.NET/Windows developers.

Wayne starts the video below with a comparison of the two, plus a few other Ruby implementations (sorry Evan, Rubinius wasn’t mentioned).

Fortunately we were treated to a demo early in the show. Wayne had recently implemented Ruby code-behind for some of the drag-and-drop widgets that come with Visual Studio. It was very sexy to see all that Ruby being generated.

The video also includes lots of “why Ruby is hard to work with as a compiler writer”, and more importantly, there are lots of audience questions all throughout the talk. This might be why the talk is 1.45hrs long!! :)

Enjoy… (and the slides from Wayne)