Collaborative development or getting development help from your peers online dictates that you share code with people, but that’s not always possible. If you’re on IRC, pasting giant blocks of code into a public chat channel is annoying for everyone else, and sharing code via instant messenger or email is clumsy, slow, and hard to read (since those tools lack code formatting and line numbering).
That’s where pastebins come in. Pastebins allow developers to post code snippets at shareable, throwaway URLs in order to easily swap code back and forth unobtrusively with one another. There are a large number of pastebin sites, and the differences between them are generally minor. However, below is a list of our top five places to easily and quickly share code. Presented in no particular order.
Pastie isn’t the most feature rich pastebin site out there, nor does it support the most languages, but it is one of the most elegant. What Pastie lacks in features, it makes up for in simplicity and beauty. The site offers private pasting and pastes don’t expire. For more feature rich code pasting, check out Paste2, Pastebin.com, Lodge It, Pastebin.ca, and GnoPaste.
Gist is one of the most robust paste tools on the Internet. What sets it apart from other pastebins? How about versioning, SSL security for private pastes, support for embedding pastes on other sites, and the ability to push and pull pastes using Git. Like parent site GitHub, public pastes on Gist (called, not surprisingly, “gists”) can be forked by other users with the click of a button.
GitHub’s active user community has also contributed to Gist by creating a growing ecosystem of extensions, such as auto-posting to Tumblr and Textmate support. You can even serve Greasemonkey scripts from Gist. Very cool.
If you crave pasting that is more succinct and to the point, then perhaps TinyPaste is for you. TinyPaste is a barebones pastebin. Just enter your code and go. No futzing with names, descriptions, choosing a language, etc. Unfortunately that also means syntax highlighting is out the window. But if you just want to paste and go, then TinyPaste might be what you’re looking for. The site also has a Firefox plugin that allows you to paste text from any text source (within the browser) and get the paste URL without ever visiting the TinyPaste site, and it has an API.
Also see Snipt, which is billed as a pastebin for Twitter. Theoretically, that means it should function much the same way TwitPic does for images — unfortunately, right now it appears to just be a run of the mill paste site with short URLs for pastes. Hopefully they add things like auto-post to Twitter and the ability to target pastes at specific users via @ replies.
EtherPad is not actually a paste site, but if your reason for pasting is because you’re working through a coding problem with a collaborator, then it might be better than any other site on this list. EtherPad lets users collaborate in real time on text documents. Users each join a workspace and can watch each other make changes in real time — if user A types something new, user B sees it appear on his screen in real time.
Because EtherPad isn’t a real pastebin, it doesn’t support syntax highlighting for many languages, but adding that should be fairly trivial. It does have line numbering, though, so even lacking syntax highlighting, it should be suitable for collaboratively working through a coding issue in ways that a static pastebin couldn’t hope to match.
Like EtherPad, Snipplr also isn’t really a pastebin. Rather, Snipplr is a public code snippet library, and one of the best. If you want to share your code bits with more than just a few people, Snipplr is a great place. It is a very well designed snippet site with over 10,000 snippets. They have a Textmate bundle, a WordPress plugin, Firefox and Safari bookmarklets, and even a plugin for the somewhat more obscure Gnome text editor Gedit.
Also check out DZone Snippets, which is another large public snippet site.
If you know of any other good sites or methods to share your code, please share them in the comments below. And if you liked this post, be sure to check out 7 Places to Find the Code You Need.
Josh Catone joined Mashable in May 2009 and is Executive Director of Editorial Projects. Before joining Mashable, Josh was the Lead Writer at ReadWriteWeb, the Lead Blogger at SitePoint, and the Community Evangelist at DandyID.