Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Over the years I've often thought to myself "This function must have been written before by someone" This often comes up when writing sorting or searching algorithms. While Wikipedia and Google Code often have great snippets in many different languages for common problems, are there any sites where people can openly share useful blocks of code?

share|improve this question
I think a SE site might actually be pretty good for that. SE sites come with a lot of useful infrastructure (tagging, voting, etc.) for such a site. The one thing dearly missing is a good site search, though. – sbi Jan 27 '11 at 20:03
We're trying to make a place just like this. codecatalog.net – luqui Jun 28 '11 at 2:29

4 Answers

up vote 2 down vote accepted

Rossetta Code is a good start.

Gist on GitHub is worth a look as well.

Snipplr seems good as well.

share|improve this answer
Rossetta Code is amazing! Thats pretty much what I was looking for in terms of common algorithms. Snipplr is also great because it is a lot of code that other programmers have found useful through the days... – Spacebob Jan 27 '11 at 21:13

Check out Pastebin. It's kind of a dumping grounds for all sorts of algorithm implementations and random bits of code, but it's designed for helping programmers specifically and will probably have what you need on it somewhere. And yes, searching works well.

share|improve this answer

GitHub has Gists. They are public, searchable, and can be forked. (You can make private ones, too.)

share|improve this answer
From by brief look it doesn't seem like searching works well. Example: Searching fibonacci sequence yields no results – Spacebob Jan 27 '11 at 20:08
The search is a bit strict, as it only searches exact occurances of the terms. Of course, the results pages don't show entire Gists, just the relevant part. gist.github.com/gists/search?q=fibonacci&page=1 – Jeremy Heiler Jan 27 '11 at 20:14

Microsoft offers an All-in-One code framework if you're interested in that kind of thing. It's certainly not the "best place" (you can't share your own, which is what you want to do) but the option is there.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.