Skip to content

Dev Toolkit: Code Snippet Storage

By GRAYBOX Alumni

The saying goes that good developers write code and great developers steal code*. The best developers however are those who are able to steal from themselves. The great thing about working with digital tools is the ability to apply previous solutions to new work with copy/paste. Reusing code in this manner can save development time is a standard practice, especially for veterans of the industry who get both smarter and lazier as time goes on. What's hard though is keeping all of your stolen code handy, ready to pop it into the template or script or what have you. Back in the day™ we kept this code around in dozens of text files inside of one or more folders, if you wanted to be fancy about it you might use a spreadsheet instead. The problem with these methods is that finding a particular snippet of code can be an arduous task.

So we need a good tool for keeping our modular code snippets organized, but also for pulling them up at a moment's notice. Here are a couple of my favorites;

CodeBox

Codebox is my defacto code snippet library these days. It's interface has a few really great features, such as tagging, global search and code highlighting. I use it to store snippets for reference, like PHP's date formatting syntax (something I forget as soon as I need to echo out a date) or keep my starters - bits of template that I can plug in and modify for the particular site's data. Pagination, ajax reloads, error logging scripts, csv export functions, etc.

One of my favorite features with codebox is the menu bar item (also invokable via a user-defined keyboard shortcut) that lets me search my library and paste into my editor of choice instantly.

Codebox is available in the App Store for $9.99USD

NVAlt

While I've stopped using NVAlt as my code library, I still find myself jumping in and out of it every day. A fork of Notational Velocity, NVAlt is a notepad on steroids that still fits into a size 4. With some work on the user's part it is possibly the best note taking and retrieval application I've ever used. What's beautiful about NVAlt is the live search bar, just start typing and it will search your entire library of notes for matching terms, and (here's the magic) if it can't find what you're looking for hitting enter will immediately pop your cursor down to the note entry field ready to create a new note in the application. I've used NVAlt to store everything from code snippets to server credentials to shopping lists and even a list of which X-Files episodes were included in the canonical myth-arc.

NVAlt is free (as in beer) and can be downloaded directly from it's author, Bret Terpstra

*A saying that we've stolen from the humanities (don't worry, we're aware of the redundancy).

Blog & Events

Featured Work