codebykat.blog

thoughts on code, tech and life.

Gorgeous Octopress Codeblocks with CodeRay

When I upgraded to Octopress 2.0, I was pretty excited about the syntax highlighting. I eagerly went back to some old posts and wrapped my code in {% codeblock %} tags.

But… the default Octopress codeblock colors leave something to be desired. In fact, if you have a lot of code on the page, it starts to feel a bit like being underwater.

1
2
3
4
5
6
7
def test
  @answer = 6*9
  if @answer != 42  # this should never happen
    raise "Oh no, not again."
  else
    print "Don't panic."
end

I wanted codeblocks that looked more like GitHub’s: lighter colors, softer edges, slightly less… well, blue. So I started poking around, and here’s what I wound up with:

def test
  @answer = 6*9
  if @answer != 42  # this should never happen
    raise "Oh no, not again."
  else
    print "Don't panic."
end

Ahhhhhhh. Don’t your eyeballs feel much happier now? Read on to find out how it works!

Remote API Authentication With Rails 3 Using ActiveResource and Devise

I recently had to implement this workflow for a client project, and it got a little confusing. There’s a lot of example code floating around, but it took some trial and error to get everything working smoothly. So, on the off-chance it’ll be helpful for someone else, here’s a walkthrough that illustrates the complete package.

RubyConf Recap

RubyConf 2011 was my first technical conference as a Rubyist, and it was an absolute blast. I was afraid that many of the talks would be too advanced, since I’ve been writing Ruby for less than a year, but on the whole there was a good mix for programmers at any level. Not only did I learn a ton, I got to spend three days rubbing elbows with a bunch of smart, inspiring and genuinely nice folks. It was great to put faces to some of the names I’d seen online and get to hear about what everyone’s working on. As my first real dose of the Ruby community, the experience was nothing but positive.

Hello

I have a blog now. Blogging is cool.