No Credit Check Payday Loans

Hacking a Gist API with Mechanize

I’ve been wanting to hack in support for code snippets with syntax highlighting for Get Satisfaction for quite a while. After Gist was released, I had the bright idea to allow our users at GSFN to easily create gists, since they give you so many nice features.

So, I did that today. Unfortunately, the slowness of the service is too much overhead, on both the embedding side and the uploading side, and so I’ll wait until they get a little faster. In the meantime though, I have this quickly thrown together piece of code to interface with gist from ruby, allowing you to either upload or delete gists. Might as well share it.

It uses ruby mechanize, so you’ll need to gem install that first, but otherwise, here’s the code: (obviously, presented to you as a gist)

3 Responses to “Hacking a Gist API with Mechanize”

  1. patrick Says:

    awesome tutorial. installed mechanize and everything but on runtime i get this very strange error

    ./gistit.rb:1: uninitialized constant WWW (NameError) from example.rb:1:in `require' from example.rb:1

    any chance you ran into the same error?

  2. patrick Says:

    don't bother.. i found my stupid mistake. everything works just fine now

  3. Nome do Jogo » Blog Archive » Rails Podcast Brasil - Episódio 28 Says:

    [...] Hacking a Gist API with Mechanize [...]

Leave a Reply