views:

2390

answers:

21

Hi all,

Just wondering if you can point me in the direction of a simple, fast program which stores code snippets. I have been using a local wiki up to now, but I find it a little annoying at times. Ideally I would like this application to be portable - i.e. it could run off of a USB stick on multiple machines with no installation.

What do you guys use?

EDIT: I would prefer a solution that was decoupled from the IDE and stored locally, not in the cloud.

EDIT 2: Thanks for all the replies thus far, but I am still awaiting a non cloud / web based portable solution. Anyone else care to weigh in? :)

+4  A: 

I use Snipplr.

Oli
+1 Bravo for Snipplr!
unhillbilly
Snipplr rocks! Now it will be even better since Envato acquire it.
dede
+2  A: 

Since I use the Visual Studio IDE for development, I tend to use the built-in code snippet editor which is very similar to the downloads http://msdn.microsoft.com/en-us/vbasic/ms789085.aspx and http://msdn.microsoft.com/en-us/vbasic/bb973770.aspx.

These 2 links here can operate separate from the IDE. It's a standalone app.

Jason N. Gaylord
Excellent tool. I love it. How do you organize your snippets so you can find them when you need them?
DOK
+4  A: 

I believe subversion can be made portable, so all you'd have to do is "pull" the snippet down and use it. If you update it, then back up it goes.

Adam Davis
SVN is a little too rigit for this. I use it extensively for source control, but would not relish the prospect of using it for this. Also it would not be portable unless the machines were on the same network.
Konrad
SVN is accessible over the internet, so as long as you made your repository accessible from an internet facing machine, you'd be fine.
Kibbee
Network? Can't you use subversion as a local file structure without a server component and pull directly from it? ie, move your repository around on a flash drive? Sure, it's an odd use, but I thought you could use it without a network.
Adam Davis
+1 Actually I do this, I keep an SVN repository for personal stuff on a flash card I carry with me.
Robert Gould
Oh and I keep it encrypted just incase
Robert Gould
That must be a nightmare for your SVN to cope with :) Change one character, encrypt it and the whole file changes ^_^
Konrad
A: 

Eclipse supports code snippets off the shelf. Just in case you wondered... ;-)

Manrico Corazzi
Can you tell us more about it? How's the feature called, where it's available?
Kena
In 'Window>Show View' choose 'Snippets'; it's pretty straightforward, you can create a template and customize it with placeholders and insert the text wherever you want with a double click.
Manrico Corazzi
A: 

I use a generic desktop product (I have no association with that company) that's a lot like writing each snippet on a 3x5 index card, and then being able to search the text. I include comments and troubleshooting tips for myself. Been doing it for 15 years now, and I have quite a dogpile of code snippets.

One of the challenges is being able to find the darn snippet when you need it. Being able to do a text search is good, but being able to add tags would be even better.

DOK
+5  A: 

I keep it in a Google Notebook, with a section for each programming language. It's tagged, searchable, and browsable. And I can get at it from any computer. If you don't mind waiting and keeping it both local and in the cloud, I hear Google is going to be adding Gears support to Notebook.

If I'm going to be out of the cloud, I usually export that notebook to a document file. Not the neatest solution, but better than nothing.

Thomas Owens
A fine solution, except that the site is blocked from my workplace.
Raithlin
Goole Notebook is about to be phased out, afaik. You might want to try Evernote - which has a cool import feature.
Manrico Corazzi
A: 

I use Pastie ( http://pastie.org/ ) It´s the best online for code. Other than code I tag articles and code on delicious. For private stuff I use Evernote (Mac /Win /Online)

AlePani
A: 

I use Ditto for this. It is a clipboard extender for Windows.
One of the extended features is that you can create groups and also mark items as "Never Auto Delete". This enables you to build up a tree of categories in which to store your code snippets.

Finding items is pretty easy: I've set a keyboard shortcut for "Activate Ditto" to CTRL+SHIFT+V. This will open a Ditto window, in which you can type text to filter the displayed snippets.

I have not tried it but there is also a portable version.

mxp
+1  A: 

I have found that I don't can trust me snippets without proper TDD or BDD test, and sometimes I even need the compile argument or some other thing (like which version of .net as a manifest this c# code does what is supposed to do or ruby/gem or in which erlang release can I do this, or on what machine can this c code be good or bad)

So I treat not snippets but small sandboxes of environments that is contained in there own directory given the context. I try to give good names on the file/directory (so I don't really have to index but can use grep). I put everything in a hg repos (Mercurial) . That way I can use hg to take care of much of the rest, log, revision and sync with different computers, and if I need to take only a usb with med I clone my master to the usb and do a hg update, then I can see the plain files regardless on any computer that can mount the usb.

This is battle-proven, because on some customers site I have not been allowed to connect to internet at all, not ben allowed to use my own computer, not been allowed to use anything that needs to be installed on their computers. But I have been allowed to look (read-only) to a usb if they have done their thing with it first (virus scan, sandboxed it and what not).

Jonke
+1  A: 

Another option is Evernote, which can synchronize on multiple machines, run on the iPhone, is accessible from the web, and has a ton of ways to get stuff into it (active bookmark, client app, screenshot grabber, email, etc).

dpurrington
And... it will destroy all formatting in your code snippets!
Yar
+1  A: 

EDIT 2: Thanks for all the replies thus far, but I am still awaiting a non cloud / web based portable solution. Anyone else care to weigh in? :)

I use live mesh for the synchronization of my code snippets. It is integrated with VS and supports online and offline scenarios. I can also add code gems when I am not in any of my computers using the online access to my mesh.

MMind
You just have to love how all the answers use the cloud. On PC you can check on my product www.thekbase.com. I'm still trying to decide to make an AIR version, work more on the web version (www.kbaseweb.com), or just use evernote which is not good for this use.
Yar
+1  A: 

Check out Evernote

HJ
+1  A: 

I'm looking for the same thing, and ran across a little app called CodeBank - while I'm blocked from downloading it from my current PC, I will be trying it at home. As a result, I'm not sure if it is portable... still, it looks like a good little app.

On further investigation, I came across the DevProject Manager, which is definitely portable, has syntax highlighting, search, and a number of other features that have made it my number 1 choice.

Raithlin
CodeBank looks alike an awesome program, but I can't seem to find a working link for it anywhere - do you know where I can get it?
Konrad
+1  A: 

I use TiddlyWiki. It's simple and flexible. It's simple to install. Doesn't require a DB. You can just drop it into a HTTP Server's document root and it's accessible from the web.

+1  A: 

You could use a wiki-based solution on your own machine, that's probably the easiest way if you really need it outside of the cloud.

Keltia
+1  A: 

For the Mac I would recommend Code Collector Pro. Everything is stored locally and it can use TextMate syntax coloring bundles. Code Collector Pro also has a quite nice sharing feature - upload to http://www.codecollector.net/

There is also a Adobe Air alternative: Snippely

A: 

Try Snippet - http://snippetapp.com/

Charlie
In the question I do clearly state I don't want the code stored in the cloud.
Konrad
It's not. Snippet app keeps the data on the hard drive with an option to keep it synced via MobileMe.
Charlie
A: 

It's cloudy' but I use snipplr.

It has support for many different apps and plugins like Snip-It Pro, wordpress-plugin, gedit, firefox, etc.

It is also a community sp you can find other peoples snippets and get comments on your own.

jkjeldgaard
A: 

I store all the snippets in Emacs yasnippet folder, which is in Dropbox + version controlled by Bazaar.

myfreeweb
+2  A: 

You may be interested in the Snippets application for Mac OS X.

Stream
A: 

On Linux I use NoteCase and Zim.

trixy