Archive for the ‘Development’ Category

Download Your Snippets as a Zip File

Published in: Development, NewsPosted by Tyler on 09/11/06

I can’t count the number of times on this blog I’ve mentioned the importance of keeping websites like Snipplr open. I don’t mean online and in business, I mean keeping the data (your data) freely available for you to import and export as you see fit. That’s the point of the Snipplr API – to let you manage your snippets without ever having to even visit Today I’m releasing a new feature to continue this trend.

Many users have asked for a way to backup all their snippets. Just in case Snipplr goes offline or you want to move your code to another site. Ask an ye shall receive.

On your settings page you’ll find a new link that will let you download a zip file containing all of your snippets.


Diff Added to Languages

Published in: Development, NewsPosted by Tyler on 08/16/06

I’ve added diff syntax highlighting to Snipplr’s supported languages. Enjoy.

New Languages Added

Published in: Development, NewsPosted by Tyler on 08/10/06

I pushed out another round of updates this afternoon. The biggest change was the switch from Pear’s Text_Highlighter module to GeShi. While I prefer the Pear version, GeShi supports many more languges and is easier to maintain. A bonus I wasn’t expecting is that PHP functions are linked to their man page on Very cool.

New Languages:

Popular Users and

Published in: Development, NewsPosted by Tyler on 08/03/06

This morning I added a list of the top ten most active members on Snipplr to the Popular page.

Also, last night I announced that Snipplr can import your existing snippets from other websites such as and All of your snippets will be added to Snipplr automatically – even your tags. This morning I enabled importing from as well.

Import Your Old Snippets From Other Websites

Published in: Development, NewsPosted by Tyler on 08/02/06

Joel Spolsky (of fame) writes

When you’re trying to get people to switch from a competitor to your product, you need to understand barriers to entry . . . or people won’t switch, and you’ll be waiting tables.

He’s right. I’ve received many emails from visitors saying how much they like Snipplr and how it integrates with TextMate and WordPress, but they just can’t switch because they have too many snippets stored on other websites like and copycat newcomer

This morning I decided to do something about the problem and help users make the switch to Snipplr. I’ve added a new section to your Snipplr Settings page that let’s you import your existing snippets from other websites.

Import Screenshot

All you have to do is enter your username and Snipplr will automagically copy your snippets from their old home into Snipplr. It’ll even keep your tags in tact, too. It’s simple, quick, and painless.

Comments? Questions? Other websites you’d like to import? Let me know below.

Broken Newlines – Fixed

Published in: Development, NewsPosted by Tyler on

Last night’s update introduced a bug that added extra slashes () to any snippets you posted that contained quotation marks or newlines – in other words, every snippet. The bug has been fixed, and I’ve gone through each snippet and corrected any that were broken. Sorry for the confusion.

Snippets Now Have Comments

Published in: Development, NewsPosted by Tyler on 07/23/06

I spent a couple hours at Starbucks this afternoon and added user comments to Snipplr. (A much requested feature.) Now you can post feedback, suggestions, and critiques for each snippet on the site. You can also subscribe to comments for a particular snippet by clicking on the RSS icon in the comments section (below the snippet).

In an effort to give visitors as much flexibility as possible in formatting their comments, I’ve opted to use John Gruber‘s extremely useful Markdown syntax. An overview of the syntax is available to get you up to speed quickly.

As always, please send me any feedback you have. You can contact me here, or leave your comments below.

Snipplr API

Published in: API, Development, NewsPosted by Tyler on 07/06/06

Tonight I’m releasing an offical Snipplr API which will allow anyone to write their own plugins to communicate with Snipplr. You can use the API to talk to Snipplr from other websites, your favorite text editor, or any desktop app. It’s up to you. You’re in control now.

The Snipplr API uses the standard XML-RPC protocol and offers the following methods.

  • snippet.list – Returns a list of snippets based on the search criteria you provide.
  • snippet.get – Retrieves the details (including source code) for a given snippet.
  • – Allows you to store a new snippet into Snipplr.
  • snippet.delete – Allows you to delete a snippet.
  • user.checkkey – Validates a user’s API key.
  • languages.list – Returns a list of available languages.

I’d appreciate feedback letting me know about any problems you run into or features you’d like added.

Also, for all the TextMate hackers out there, I’ve got an offer for you. I’d like to replace the current TextMate Snipplr bundle with a more maintainable Ruby version. (The current one is a mess that uses shell scripting.) I only know a little Ruby, so along with their name on Snipplr and my eternal thanks, the first person to send in a good, working Snipplr plugin for TextMate gets a free Snipplr t-shirt ๐Ÿ™‚ In fact, if you want to write a plugin for another editor (BBEdit!), and I approve it, I’ll send you a Snipplr t-shirt as well.

Using the API



\n\nsnippet.list returns an XML formatted list of snippets matching the specified criteria. Takes two parameters (must be passed in this order):

  • api_key: Required. The API key of the Snipplr user. Snipplr returns all of this user’s snippets. An error message will be returned if the API key is invalid.

  • tags: Optional. A space delimited list of tags (keywords) to filter the results by. Snipplr returns snippets which contain at least one of the keywords in the snippet’s title or that match one of the snippet’s tags.

  • sort: Optional. Can be one of these three values: “title”, “date”, “random”.

  • limit: Optional. The number of snippets to return.

Note: snippet.list only returns snippets owned by the user or marked as favorites of the user. It does not search all of the snippets on Snipplr.


\n\nsnippet.get returns a snippet’s details. Takes one parameter:

  • snippet_id: Required. The ID of the snippet to fetch. An error message will be returned if the ID is invalid.

snippet.get currently returns the following snippet properties:

  • id
  • user_id
  • username
  • title
  • language
  • comment
  • created (datetime when snippet was created)
  • source
  • snipplr_url (url to view snippet)
  • tags (space delimited list of the snippet’s tags)

\n\ stores a new snippet into Snipplr. Takes four parameters (must be passed in this order):

  • api_key: Required. The API key of the Snipplr user to which the snippet will belong. An error message will be returned if the API key is invalid.

  • title: Required. The title of the snippet.

  • code: Required. The snippet’s source code.

  • tags: Optional. A space delimited list of keywords to tag the snippet with.

  • language: Optional. The language to mark the snippet as. Use the language name found in Snipplr’s URLs. For example, “javascript” or “c-plus-plus”.


\n\nsnippet.delete deletes a snippet from your Snipplr account. Returns 1 on success, 0 if the snippet could not be deleted. Takes two parameters (must be passed in this order):

  • api_key: Required. The API key of the Snipplr user that created the snippet you are deleting. An error message will be returned if the API key is invalid.

  • snippet_id: Required. The ID of the snippet you are deleting.


\n\nuser.checkkey validates a user’s API key. Returns 1 if the key is valid. 0 if not valid. Takes one parameter.

  • api_key: The API key to validate.


\n\nlanguages.list returns a list of supported languages in Snipplr. It returns their urlname and pretty name. The urlname is the value you pass into the method. The pretty name is a nicely formatted version of urlname. It’s just there for your reference. This method takes no parameters.

New Features Today

Published in: API, Development, NewsPosted by Tyler on 07/05/06

I pushed out a new version of Snipplr early this morning. There are a lot of improvements – both above and under the hood. In deciding what to work on over the holiday weekend, I picked out the best suggestions from all the emails I’ve received and combined that list with my own bug fixes.

New Languages

\n\n* AppleScript * Lisp * SVN * XML

New Features

\n\n* You can add your location to your profile. * You can add your website to your profile. * Each user can now pick which language tabs they want to appear throughout the site. This allows me to keep the list short and prevent wrapping as often as possible. * Snipplr’s layout has been change a little, too. The tag cloud was beginning to take up too much room on the page, so I’ve moved it to the side bar (and increased the width of the sidebar).

Update: Added an option to specify the number of snippets per page. (Thanks, Luis!) Also, I recorded a short screencast showing how to drag the language tabs for people who are having problems.


\n\n* The back and forth paging links are now located at the top and bottom of the page. * Lots of internal bug fixes.

Coming Soon

\n\nHere’s what I’m working on currently and plan to roll out this weekend.

  • Code comments. Let users leave comments on other people’s snippets.
  • Snippet ratings. Users can rate snippets 1 – 5 to help others find the best ones quickly.
  • Revamped RSS feeds allowing you to make a feed from any page. This will let you subscribe to individual tags. (Another much requested feature.)
  • Releasing an “official” Snipplr API using XMl-RPC. Right now the TextMate bundle communicates using a simple GET/POST query. I hope having a documented API will encourage developers to write plugins for BBEdit, Vim, Emacs, and all the other text editors out there.
  • I’m also toying with the idea of classifying snippets based on spoken language. So people who only speak English can ignore all the Spanish snippets and vice-versa. Thoughts?

Again, as always, please let me know of any bugs you find or suggestions you have. You can leave your comments below or contact me here.

New Features on the Way

Published in: Development, NewsPosted by Tyler on 06/30/06

Wow. Snipplr made it to number one on yesterday. This brought in a ton of new users and a lot of great suggestions for improving the website. That said, I thought I’d share my current todo list of features/changes I’m working on this weekend. Most of these are suggestions from visitors. So, if you have your own suggestions or additions to the list below, please post in the comments.

New Languages to be Supported

\n\n* C * C# * ASP * VB * Common Lisp * AppleScript * XML and XSLT

Feature Requests I’m Working On

\n\n* Discussion/comments for each snippet. * Extended user profiles. (website, location, job, fav programming languages, etc) * In the user profiles, people can set their spoken language and also set Snipplr to only show them Snippets in that language. * Option to make snippets private. * Make snippets viewable only to certain users you pick. (Not sure if I’ll do this one right away. But I’m considering it.)

So, that list along with my own bug fixes are what I’m working on at the moment and what I hope to accomplish this weekend.

One note regarding the programming languages above. It’s easy for me to add support for additional languages (I just add them to the language dropdown box). The trick is to add syntax highlighting for them. Currently, I’m using the Text_Highlighter class available from the Pear repository. If anyone would like to contribute additional language highlighting classes for it, I’d be very grateful.