Free Code Snippet Management and Syncing with Dropbox
by Ash White / 08.14.10
As anyone who has been writing code for a while can attest, keeping track of reusable code snippets is a must in terms of speeding up development. After all, who wants to waste time writing the same code over and over when you can simply copy and paste?
There is a plethora of software-based solutions to this problem, notably Code Collector Pro and Snippets (both for the Mac). I have used both of these in the past, and while they are great apps they either don't work quite the way I want or are a bit too unreliable in terms of syncing.
So what's the best solution for maintaining code snippets and reliably syncing them across multiple computers? For me it's through the filesystem, with a lot of help from Dropbox. I simply create a folder for each language, each of which containing snippets for that language (one file per snippet, with the appropriate file extension for the language).
This presents several advantages over dedicated snippet management apps:
Syncing is instant and 100% reliable
When you save a file it is instantly pushed to any other computers that are linked to your Dropbox account. You can even share folders or files with other people using Dropbox's sharing feature.
You get to manage the code in your own editor
Being locked into a snippet management app's text editor sucks. Though many of them will let you open snippets in an external app, that's still an extra and unnecessary step.
Snippets are indexed by the filesystem
This allows you to use Spotlight, LaunchBar, Quicksilver, or something similar to quickly search your snippets without having to launch another app. Practical filenames and embedded comments make finding the right snippet super easy, replacing the need for a tagging system.
Versioning and Backup
Dropbox provides awesome file versioning, making it easy to revert back to a previous version if needed. Dropbox keeps your files safe in the event of a disk failure.
Your mileage may vary of course, but in my opinion this method works wonderfully, especially for a free solution.