views:

511

answers:

7

Does anyone know of a good and simple open source code snippet repository? Ive seen many that are free services, but I want to host it myself. A few google searches just find the free services.

+1  A: 

http://code.google.com or sourceforge not good enough? Also, there is GitHub if you preffer git to svn.

Granted, it's not for short snippets, mainly, but you could easely use it for that.


Edit

Reading again your question and your comments, what you really want is an existing, open source, system to hold short pieces of text made in c#?

I'd guess you'd have to do that yourself, I know of no project to do just that :S

voyager
Im looking for a web application that I host that will hold my snippets.
RyanOC
Why can't you use a standard repository for that? With http://code.google.com/ you can make 1 file per snippet, and access them through a browser. The only *difficulty* could be the upload, but *if you are a developer*, most likely, you have a CVS client installed.
voyager
A: 
  • Krugle has an excellent base and allows for quick searching and filtering.
  • Active State has a some good snippets with excellent reasoning and documentation.

Take a look into OpenGrok : http://opensolaris.org/os/project/opengrok/ in conjunction with a SVN setup.

Bob Breznak
+2  A: 

Can you clarify what you mean? Do you want one for your own personal use (what is wrong with the built in snippet management in visual studio? Are you looking for examples of design patterns? In that case maybe check java2s or the portland pattern repository. For snippets such as looping constructs, try catches, etc i love Coderush templates.

That being said, my personal opinion is that snippets are as evil as copy-paste. What you probably want is to refactor so that there is no duplicate code. And if you need to share code between projects - some sort of core library might be the way to go.

Edit: In the comments below you specify that you want snippets available via web. I don't have anything to recommend thats exactly like that but you should look into storing your snippets in visual studio and syncing them using LiveMesh. I know of several people that do something similar and they like it.

OOoooor...what's wrong with just a wordpress blog? You can set it to private access only. You get tagging, searching, syntax highlighting (via the google syntax highlight plugin) and a nearly 0 fuss setup.

George Mauer
I want a library of code snippets that I can access from any computer connected to the internet, but hosted and controlled by myself.
RyanOC
See my edit, a couple of good possibilities.
George Mauer
A: 

I'd still suggest using existing sites. I often use Google Codesearch when I'm looking for existing examples of how to use a function or boilerplate code (just watch licenses of the code you are borrowing from...)

But it sounds like you're looking to host a pastebin.

pastebin.com has source code available.

Other variations are available, and wikipedia has a good comparison of pastebin software.

jmanning2k
Thats very close. My ideal solution would be written in asp.net so I could modify it.I might just have to build one myself.
RyanOC
+3  A: 

I use Wordpress with WP-Syntax plug-in for that. Selfhosted, easy, and all done by couple clicks :)

lfx
I was thinking about that, but can you lock down certain posts to be private to only certain authenticated users?
RyanOC
You certainly could.
George Mauer
@RyanOC: Yes you can. Have a WordPress blog myself, and I've done it :)
Svish
A: 

git + gitosis + gitweb

I have a repository specifically for small one-off scripts I'm unlikely to change or expand. Doing something similar for a personal library doesn't seem unreasonable. You want to manage source code; that's what source control is for.

Eevee
A: 

If you're just looking to host individual snippets, you might want to check out my site, http://www.siafoo.net . You can organize them into libraries, allow others to edit them, etc. I feel like it's a good mid-point between pastebin sites and full-on version control.

Anyways I hope this isn't too spammy, I was actually googling for something else entirely and thought I'd drop in. That comparison of pastebins looks pretty sweet too thanks.

David