Garrett Murphey

Ruby & JavaScript Development

Automatically Add GitHub Links to Jekyll Posts

March 14, 2014

When I switched to Jekyll, one of the first features I embraced was the Liquid syntax. Markdown is a joy to write, and having a template abstraction layer like Liquid makes templating equally easy and understandable. Using yaml abstracts that templating logic even further. Being an open source contributor, I wanted a maintainable way write about and link to projects I was working on.


Backbone.CustomSync

March 09, 2014

Many times while building a Backbone.js application, you’ll either be working with an API wrapped by a library or non-RESTful resources. This can be a pain, and you’ll most likely end up having to override Backbone.sync with a giant switch statement. If you’re writing tests against this new sync method, it can seem near impossible to cover all the cases. Backbone.CustomSync attempts to alleviate some of that pain by extending Backbone.sync to allow for custom behavior for each of the sync procedures.


Ignoring Git Hooks When Rebasing

February 02, 2013

If you’re in the habit of running git rebase before pushing to origin (and you should be, in my opinion), you may notice some annoying things happening if you have prepare-commit-msg and pre-commit hooks enabled for your repository. I have both – one to pre-prend the branch name on my commit messages and another to run build processes. When I would clean up my commits with an interactive rebase each of the commits in the rebase would have their messages edited and a build would be made for every step of the way. That finally annoyed me enough to add a simple condition to my hooks.


Running Grunt Tasks with Git Pre-Commit Hooks

December 22, 2012

I’m always forgetting to run release tasks when committing to git, and then I’m forced to either rewrite history with rebase or roll back and re-commit. It’s a big time sink. Thankfully, I’ve been playing with Grunt tasks and git pre-commit hooks and found a way to not only save time and my sanity, but take release tasks out of my manual workflow entirely. This hook will stash any work that’s not staged, run the release task, stage any files created or updated by the grunt task and restore any stashed files. If you aren’t using a release task, this will work equally well with grunt jshint or any testing tasks you may have defined.


Jekyll: Replacing Pygments Highlighting With Prism.js

August 09, 2012

I’ve been battling with Pygments, the native Jekyll markup highlighter, for a while. Its reliance on Python makes it nearly impossible to run on Heroku without committing your compiled site to git (which just makes me feel dirty). Needless to say, I’ve been looking for a Pygments alternative for a while. That’s why I was excited to see Lea Verou announce Prism, a standalone and lightweight client-side syntax highlighter.


jQuery Plugin: Outbound Analytics

July 22, 2012

A jQuery plugin aimed at making it easier to track outbound (external) links with Google Analytics.


jQuery Plugin: Best Ampersand

July 19, 2012

“Best Ampersand” is a simple jQuery plugin that adds ampersand classes for better ampersand fonts. Inspired by Dan Cederholm.


Tracking Outbound Links with Google Analytics and jQuery

July 16, 2011

Here’s a quick event binding I wrote today for the site to track outbound links in Google Analytics using some jQuery selector trickery.


Photoshop Plugin: Simple Sprites

July 07, 2011

I’ve been working on a site recently that’s needed a lot of pseudo sprites, and I was getting frustrated with creating sprite maps by hand, so I created simple Photoshop plugin that takes a directory of images and merges them into a CSS friendly sprite map.


How to Exclude Pages from WordPress' Search

April 22, 2010

While working on the new theme for the site, I quickly realized that I didn’t want to show pages in any of the searches on the site. I only wanted posts.


WordPress Development: Replacing Default Widgets

April 10, 2008

I’ve been working on a little WordPress project these last few weeks with a colleague. When I first heard the idea, I thought, “That should be easy enough to build.” I decided the best way to tackle the feature would be a custom widget, but when I finally sat down to get it working I quickly began to realize that there were a few obstacles to overcome.


WordPress Plugin: Home Page Link

July 31, 2007

I received an email this evening from Dan, who uses the Page Link Manager, wondering how to get a home page link to show up in his site navigation. I had never really thought about the problem, or even realized it was a problem until I started my search for a solution. There’s not much out there covering the issue besides a few forum posts at WordPress.org. But it’s a problem, nevertheless. I understand that the blog’s heading is supposed to link to your home page, but I believe there’s a large audience of Internet users, and potential readers, that wouldn’t think to look to a heading for a shortcut back to your home page.


Wordpress Plugin: Category Link Manager

October 15, 2006

I can’t really call this a new plugin. If you look under the hood, most of codebase is just a reworking of the popular Page Link Manager. It’s one of the nice things about Wordpress plugin development – being able to borrow ideas from similiar plugins – and it’s what makes scripting for Wordpress enjoyable.


WordPress Plugin: Page Link Manager

October 05, 2006

WordPress is a fantastic tool – I can’t say that enough. I was able to migrate my old site and structure over to the WordPress model quite quickly, and in a matter of minutes I was blogging. But one of the major hurdles is that it still relies on coding knowledge a bit. For example, under the current version of WordPress, to exclude a pages from site navigation, you have to go into the source and do something like wp_list_pages('exclude=3,7'). And, if you add other pages you don’t want listed in the site navigation, you have to go into and edit the source each time. This became an obstacle recently when my sister and I began looking at WordPress as a viable content management system for clients’ use. It seemed silly to us that each time the client wanted to include an excluded page or exclude a new page they’d have to call on us, or we’d have to teach them some elementary programming skills. And so the Page Link Manager Plugin was created.