views:

185

answers:

3

I've looked at CodeLocker (poorly styled and relatively unflexible, but free) and Source Code Library (Overzone software - very nicely styled, looks flexible, but very expensive - $80).

Ideally, I'm looking for a relatively simple, inexpensive program (not an online website) that I can save text data (source code) with a title and keywords, maybe even a description. It would also have some type of search functionality.

+4  A: 

It doesn't come much cheaper than the solution I use - I like to consider myself frugal, my wife has another phrase for it :-)

All my useful code is stored in individual files in a single snippets directory. The first line of each contains:

KEYWORDS:A:B:C:

where A, B and C are useful search terms such as perl, c or btree.

The next few lines are often a description, mostly unnecessary since the code itself has extensive comments on how to use it.

Then when I want some code for a BTree implementation in COBOL, I just use a script snippet btree cobol which boils down to:

grep '^KEYWORDS:' * | grep ':btree:' | grep ':cobol:'

along with other tools which can be run within vim using !! to insert a snippet directly into my current source code file.

Okay, so it's not the most speedy or elegant solution on the planet, but it works for me. And it easily handles the huge amounts of code I've collected over the last 30-odd years, in a format that's easy to recover and process.

$80 isn't really that expensive but I prefer a simple free solution that's guaranteed to be around, and working, longer than any software product I could purchase. If UNIX ever ships without grep, I may change my mind, but it'll no doubt be replaced with another search tool I could drop in as easily.

paxdiablo
I like this solution, it's simple enough to be usable for what you need.My approach would be to put the lot in a lightweight database (sqlite) and query it that way but this is a real overkill compared to your approach
djhworld
A: 

My response on superuser

"I myself use Snippely, it's an AIR application that lets you do exactly what you're looking for; stores chunks or snippets of code.

It lets you create groups (like folders) in which you can add chunks of code, notes and descriptions and it also has a syntax highlighter.

Very lightweight and most importantly, it's free :)

Oh, it doesn't have a search function but the source code is provided so it's possible to add one yourself."

Serge
+1  A: 

I just wound up installing Code Sight from Black Duck Software and have been very happy with it. I'm using the free version, which can store up to 5 million lines. Its the same stuff used at Koders.com. As a developer who writes stuff at home for fun, this has proved to be a great way to index and search all of those "proof of concept" (IE. unfinished) apps I've got lying around Site