Where do you store your code snippets?

I like to write it up on my blog for two reasons. It helps me improve my writing and ensures I thoroughly explain the snippet. It also makes it quite accessible from wherever I may be.

Anything that's really reusable becomes a class in my core library, so I don't really keep a collection of snippets. And like any good library, I keep it in source control and regularly build new releases. Any of my projects that depend on the library get automatic bugfixes and performance optimizations whenever I release a new version.

Much better than a snippets library, if you ask me. EDIT: AnonJr's makes a good comment below, basically saying that the weight of the library can become a burden. I totally agree.My personal core library (in Java) has more than 100,000 lines of code, and very few of my projects actually use all that stuff.

When I distribute an application based on that library, I actually use a dependency-analyzer (GenJar) to build a new JAR file, based only on the classes from that library that I've actually used in the application. It's all part of the build-script, so I hardly even think about it anymore.

I have MediaWiki installed on a thumb drive (using PortableApps). I use it as a personal knowledge base for code snippets and any other useful programming tidbit I don't want to forget. This way I can take it with me anywhere and pull it up on virtually any computer I'm on.

Google Notebook. I have a notebook for code snippits and notes about languages, with each language having its own section. If, someday, that gets too large, I'll just break it down by category (eg languages and scripting languages).

It's searchable, I can add comments below the notes, and I can share them with others.

I use snipt.net/ for the majority of my code, but I also use Code Collector Pro for some bootstrapping templates.

If they're common code patterns I integrate them into my text editor, for context-specific insertion with a few keystrokes. Textmate Snippets If I'm going to discuss a snippet of code, historically I used pastie, but I imagine in the future I'll use gist.

I usually keep them in Visual Studio, although I got a fairly large amount of random . Txt files in my Dev-Folder on my hard drive blush.

I use snippets.dzone.com/ - helps other people as well (or so I hope)...

1 The social aspect is nice, but the ability to arbitrarily tag each item for organization is key. I really like this one because it's like delicious for code. – spoulson Jan 28 '09 at 19:14.

I'm using snipplr. Com to store my code snippets. Mostly because it has a really nice integration with Textmate and an api which makes it possible to integrate it in other tools as well.

I'm using my brain - I've found it the most portable solution, and the lookup speed is unmatched by anything else. If memory assisted by IDE autocomplete can't easily reproduce it, it's probaby too "clever" to belong in production code, or should be part of an API library.

1 Bugfixes are getting less and less likely to be forward ported with time, I'm afraid. – jamesh Jan 28 '09 at 12:38.

There is no "Acceptable Answer" - use whatever works best for you and your work. For the few snippets I need handy I keep them in Dreamweaver's snippet repository. I also have a few .

Txt files for references that I keep on my flash drive for when I travel and use either someone else's program or my portable Notepad++ - But that's just me. I could use Evernote, OneNote, Ubernote, a TiddlyWiki, or any of a million other things. In the end, what works for me may not work for someone else.

Look at your workflow, and figure out something that works best for you and your situation.

I just store them in . Snip files and let the IDE "Find in all" or google desktop search find them when I want them. I've mapped the file extension onto the IDE, so opening a snippet file gives me code highlighting and an easy way to copy the snippet into my code.It's not very exciting, but it works for me.

I have a similar story. I used to store snippets of code in the Evernote before. However, at some point I decided to get rid of this workaround and, probably, to help other developers.As result, we together with my friend have made an application that solves exactly this problem.

We are both using Macs, so the application is Mac-only and it is obviously called ‘Snippets’ :) It is still in development but is already working well and we are moving to the release very fast. Please, do not hesitate to give it a chance and request any features you wish to have. Thanks!

I use GMail and label them with "Code".. Very easy to search and accessible everywhere. Good luck!

As silly as this sounds (and not to put myself on any kind of pedastal), I wrote my own snippet tool. I have to go back and check the links above, but at the time (a year or so ago without SOFLow) I just couldn't find a basic tool that wasn't free, or required me to have some additional IDE or anything installed. So I wrote my own.It gave me a great change to try out SQLite (how I store the snippets) and it allows me to store my VB/C#/TSQL/HTML/CSS/Whatever snippets in an independent fashion.

Plus it has the drag/drop, quick copy/paste type stuff I was looking for. It was a great coding exercise for me, I have a couple of colleagues using it at work, and I can easily port or export the app as needed.

I use personal wiki TiddlyWiki for my useful stuff not only code snippets. I can sync it to my website, so I can access it anywhere, anytime.

There are different types of snippets, and how you handle them will be different. Generally I have code for reuse, code I've come across that could be useful, notes, and useful links. Code for reuse needs to go in to version control - pick your poison, but anyone will do.

Well call me old fashioned, but what's wrong with simple text files. I think the problem is more down to how you organize your information, and what you use to search. I have a well laid out folder structure, which I can search.

I also can have a copy of anything in version control in this folder structure too. There are numerous tools that will do a good search of text in folders - Spotlight, Google desktop, various editors, grep. I say keep it simple, then you never have to worry about database formats, moving from platform to platform etc.I've also taken to using DropBox as a way of syncing it between machines and having it accessible from the web.

I just bought and recommend Snippets. One licence covers as many personal computers as needed and I can keep it in sync by storing the database in my dropbox. Snippets - "Stop Reinventing the Code" Snippets is a powerful application for Mac OS X that stores the most valuable pieces of code you can reuse in different projects many times.

The main idea is to make the process of reusing as easy as possible to avoid wasting your valuable time to write the same code again. Using such powerful features as smart groups, labels, and integration with other applications increases the speed of coding. snippetsapp.com/ It is a Mac only desktop client available in any app via hot-key, free 30 day trial and $39.99 with a 25% student discount.

I really wanted to use Evernote but it has such poor text editing that it makes maintaining code unbearable. A few things that made me buy Snippets: compatible with TextMate themes. Allows alternate library locations (so you can keep it backed up in your dropbox/mozy/spideroak etc) edit in your favorite text editor button share via your favorite snippet online service (pastie.Org snipt.

Org, or add your own: gist.github. Com) active development snippetsapp.com/release-notes/ Others you may be interested in is: snippet snippely codecollectorpro coda's built in clips Coda's editor pane page PS. I put in my ref codes in a few links, I don't make any money I/we just get extra online storage space (I hope I am not breaking the rules, if so I can remove them).

I use Instiki, which is a very simple to setup, no frills, WIKI. You could run this on any disk (e.g. Portable USB drive, harddrive) and under any OS (I'm using it under Mac OS X). I keep it running in the background as I am working and switch over to it to add/view any kind of notes (including code snipplets) as needed and it works like a charm.

If it is a snippet that I use often, for example: #! /usr/bin/perl Then I'll throw map #P O#! /usr/bin/perl into my .

Vimrc file. Mapping #P to type out the snippet. If it's significantly large, I use google notebook.

I use CodeKeep, this way my snippets are close at hand. If I'm at the office or at home I always have access to my most valued snippets (and a few thousand others! ).

If code in Django, use djangosnippets.org. For my personal snippets I use gist.github. Com and use it for team work.

Also since I code in VIM, I use SnippetsEMU.

I don't keep snippets. Usually they're too specific to the project or data structure I'm working on. Plus, I'll probably have a better-fitting way of accomplishing the task next time.

ActionOutline allows you to store text in a tree structure as you see fit.

I suggest Surfulater at surfulater.com. With Surfulater you can permanently save anything you find on the web, in other applications and on your hard drive, and organize it however you want. You can categorize, cross reference and do full text searches.

Plus tag, annotate and edit whatever you have saved to make it all the more valuable. And it has a powerful search facility. Code snippets can be just one of your many categories of things you save for reference.

The place you got them gets automatically annotated for you. They have a special template specifically for code snippets. They have lots of testimonials there, e.g. : Your software is a really great help for me.

I am using Surfulater for lots of things. I use it to store computer hardware reviews, to categorize my downloaded programming codes and tips. I also use it to organize interesting topics on programming forums I'm currently subscribed to.

Before I used Surfulater, I had to manually save web pages and documents, manually create folders and save it. Now, everything's all in one place and searching is amazingly fast as well.

I use my case management / software development software... Fogbugz. I just make a case, or email in the code with a suitable title in the subject so I can search for it later. I am considering creating an account of [email protected] so I can auto file them away as snippets I want to keep or links I want to remember.

What this does is provide me an instant search engine on the contents of the snippet in-line with my case manager.

I have a private site on Google Sites, and I keep them there: Easy to edit Accessible from any web-connected PC And since the page is a "File Cabinet" type, if they're actual Visual Studio snippets, I can add them as . Snippet files.

We use the Snippet Manger in vs08, and keep the . Snippet files that could be used company-wide on the fileserver in a common location. We also (being a share-point studio) have a Team site on our Sharepoint server with a list of snippets where they can be catagorized, sorted, and filtered.

I have a small snippets project on sourceforge.net.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions