Ryan Lanciaux

Random programming blog.

Goodreads Status Widget Available on Github

Goodreads is currently one of my favorite sites; I love that I can see what my friends are reading and find new books to read based on their recommendations. Noticing that many other blog platforms have sidebar widgets (asides), I decided to create one for Octopress. The first thing I did was make sure I was not duplicating effort. Goodreads has some great sidebar widgets, however, I preferred to generate the aside in the standard rake generate process (as well as keep the same look-and-feel of the other asides).

The Goodreads API is pretty robust but I was a little concerned about the possibility of a user’s API key getting checked into github. Thankfully, Goodreads also provides an RSS feed for status updates – which seemed a bit safer to use for publicly available code (and with the RSS feed it’s not necessary to obtain an API key). I assumed that if someone didn’t want their status updates public via RSS, they probably wouldn’t be installing an aside to display their status.

I created an aside and a subsequent liquid tags plugin that grabbed and formatted the RSS data. I used REXML to process the xml because it wouldn’t require users to install additional gems. One thing I still need to figure out is how to pass data from the config.yml into the plugin via the aside. I realize I have access to the config properties via site.whatever variables but I’m not entirely sure how to pass that info along to the tag plugin. Currently, the aside needs to be modified with the user’s Goodreads unique id and the max number of results to display. I noticed some others on the 3rd party plugins list on the Octopress wiki are doing the same thing, however, I would prefer to use the config file for the config data :P

All-in-all, it was pretty fun creating the plugin. If you use Octopress and would like to install the Goodreads plugin, take a look at the github repo.

Sublime Text on Ubuntu

Recently, I have switched from Windows 8 to Ubuntu on my laptop. Since the primary function of my laptop is development I have spent some time tweaking the software installed to fit my workflow.

The main tool I am using for all my development is Sublime Text. I like Sublime Text for many reasons – it’s lightweight, great community, tons of plugins and most importantly, vim keybindings; needless to say, it’s pretty awesome.

To start with, I installed the package like so: apt-get install sublime-text. From there, I pretty much followed Alex MacCaw’s excellent post on Sublime Text. Mentioned in the post, Package Manager is pretty much a must. As someone who has grown pretty dependent on ReSharper when doing .NET development, I find myself typing Ctrl + Shift + T to switch files (rather than the default Ctrl + P – which, to me, seems a little weird because doing that in different environments brings up print dialog)

{ "keys": ["ctrl+shift+t"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} }

Finally, since I will be writing most of my blog posts with Sublime Text (yea, this post about Sublime Text was written in Sublime Text :P), I installed Markdown Preview through package control. If you notice the statement on the GitHub page, Linux users need to install a different version of Python to get the plugin to work. I wasn’t super comfortable changing Python just for installing the Markdown plugin. Thankfully, one of the comments on the plugin’s GitHub page has a pretty decent walkthrough on how to use pythonbrew to give Sublime Text the version of Python that the plugin needs (without necessarily using it throughout the system).

Now, I only wish there was a way to open up a console directly in Sublime Text – because alt tabbing to terminal is just so difficult.

Moving to Octopress

Recently, it seems that the only time I’ve spent with my blog has been moving it to other platforms. Hopefully, that will change with the move to Octopress. Since this is mainly a programming / technical blog, I thought it would be great to host the blog with Github pages.

The Octopress install was pretty simple.. I mostly just followed the steps on the Octopress Setup page:

  1. Install Ruby / rbenv
  2. Install git
  3. Clone the Octopress repo
  4. Export posts from Wordpress
  5. Convert the Wordpress xml file to Jekyll with wpXml2Jekyll
  6. rake generate / rake deploy / git commit origin source (from the examples)

The part that gave me the most trouble was hiding legacy posts from the main page area. I wanted to keep some of the posts around for posterity but I didn’t want them to show up with any sort of prominence on the blog. To that end, I created a folder called ‘Legacy’ and a folder within this newly created folder called ‘_posts’. From there, I moved the markdown versions of the posts into this folder. So far so good…

When I fired up the preview for Octopress, the blog was still loading all the legacy posts in the content area. I asked a question on Stack Overflow (that was subsequently shut down for not being programmy enough – whoops) and tried a couple other things until I stumbled upon this post on Hiding Pages from Octopress. Making the suggested changes produced the results I was looking for. Mission Accomplished – for now. I may try to change the ‘Recent Posts’ widget so it does not show legacy posts, however, that won’t be an issue when there is more content.

So, as of this post, I’ve used all Octopress for all of one new article but I really like the workflow; storing the posts in github is definitely an added benefit. Hopefully, I will continue writing beyond this post but I guess we will see.