Archive for July, 2006

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.

Firefox and Safari Bookmarklets for Snipplr

Published in: News, ScreencastsPosted by Tyler on 07/09/06

Ever find a cool piece of code you want to remember while surfing the web? You could save the entire page to, or you can save the code straight into Snipplr with one click. You can get the new bookmarklets here.

Video showing how the bookmarklets work:


Snipplr WordPress Plugin

Published in: News, ScreencastsPosted by Tyler on

The Snipplr WordPress plugin gives you an easy way to embed snippets inside your blog posts or add a list of your recent snippets to your blog’s sidebar. My thanks go to Jan StÄ™pieÅ„ for coming up with the initial idea for this plugin and writing the first version.

Here’s a screencast of the plugin in action.

WordPress screencast

Free Snipplr T-Shirts Up For Grabs

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

As I mentioned in my previous post, I’m looking for people to write Snipplr plugins for their favorite text editors (including TextMate and BBedit) and websites. In return, if the plugin is approved, I’ll send you a free Snipplr t-shirt and list your name on the website.

Info on how to use the new Snipplr API (so you can write a plugin) is available here.

Updated: You might also want to check out the plugin for WordPress I recently released. Viewing the source will give you a good overview of how the API works. (especially if you’re using PHP).

Snipplr API

Published in: API, Development, NewsPosted by Tyler on

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.

Why I Love Snipplr

Published in: CommentaryPosted by Tyler on 07/05/06

Snipplr is incredibly useful to me. It’s become an integral part of my workflow over the last few months while I was developing it. But that’s not why I love it.

What makes Snipplr such a great site to work with is its audience. Previously, I ran the net’s largest Stephen King website. As you might imagine, that catered to a totally different demographic. While running that website I had to hold myself back and not do anything too crazy because I had to ensure that the website worked in Internet Explorer. Afterall, IE accounted for 85% of my traffic.


Snipplr, however, is totally skewed in the other direction. A quick look at the stats show that Internet Explorer is a measly 12% of our traffic. Firefox completely dominates. Even Safari is edging out the Big Blue E. This makes my life as a web designer / programmer so much easier. I can build Snipplr according to web standards and feel confident that it works in all the browsers that matter. Now that IE is the minority, I just don’t care any more. That’s not to say I won’t look for a fix if something is totally broken in the browser – I want Snipplr to be functional no matter how you choose to access it – but I’m not going to sweat over a few misplaced pixels here and there.

For those of you who enjoy building websites and are just as frustrated with Internet Explorer as I am, I invite you to dig around in the HTML of Snipplr. You’ll see that I’m using two stylesheets. One for Firefox and Safari, and then a secondary smaller one to fix the things that IE renders incorrectly. I think you’ll enjoy the name of that second stylesheet. First person to post it in the comments gets mad props.

New Features Today

Published in: API, Development, NewsPosted by Tyler on

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.