Tomas Petricek

Searching for new ways of thinking in programming & working with data

I believe that the most interesting work is not the one solving hard problems, but the one changing how we think about the world. I follow this belief in my work on data science tools, functional programming and F# teaching, in my programming languages research and I try to understand it through philosophy of science.

The Gamma

I'm working on making data-driven storytelling easier, more open and reproducible at the Alan Turing Institute.

Consulting

I'm author of definitive F# books and open-source libraries. I offer my F# training and consulting services as part of fsharpWorks.

Academic

I published papers about theory of context-aware programming languages, type providers, but also philosophy of science.

Tomas Petricek
  • Tomas Petricek
  • Home
  • F# Trainings
  • Talks and books
  • The Gamma
  • Academic

Announcing F# snippets web site

When writing F# programs, I often write some nice code snippet or some useful helper function that I'd like to share with the F# community. Unfortunately, my blog posts are usually longer and more elaborate, so I never get to blogging about it. Now that I have a twitter (follow me if you don't already) I thought I could just post the snippet somewhere, but there was no good web site for posting F# snippets - until now!

  • If you can't wait any further, then go directly to the new F# snippets web site at fssnip.net.

Introducing F# Snippets

The web site uses my earlier project F# Web Snippets to format F# source code. It highlights colors and adds JavaScript tooltips using services provided by the F# compiler, which means that you'll get almost the same experience as when reading code in Visual Studio. I also wanted to make the page a repository of browsable snippets, so you can use it in two ways:

  • Add public snippet - If you have any F# snippet that could be generally useful, you can send it as a public snippet. This means that the snippet will be listed on the web site and will be findable using search engines. You'll be asked to add some additional information such as brief description, your name or nickname and a few tags, so that the snippet can be categorized.
  • Private snippets - If you need to share some F# code at Twitter, get a nicely formatted version of code for your blog posts or attach a snippet with proper colorization and tooltips to you answer or question in some forums, you can post it as a private snippet. In this case, it won't be linked from the web site (and you won't have to enter description, your name or tags). You'll still get a nice short URL that you can use to link to your snippet (but you'll have to remember it).

Website features

When inserting an F# snippet, the web site runs a compiler on the server, which is relatively slow (so please be patient when posting snippets). Unlike for example pastebin.com or similar pages for posting snippets, the web site targets only F#, but it provides some unique F# features.

  • Colorization & Tool tips The colorization uses F# tokenizer (meaning that it handles some advanced aspects like nested comments). It also uses F# type-checker to get tool tips with type information about all identifiers and generates nice JavaScript tool tips.
  • Versioning & passcode If you post a snippet, it is possible to update it later. If you want, you can enter a passcode, so that only you can update the snippet (don't use secure password). The history of source code is stored (but changes in comments and tags are not tracked)
  • Listing & tags Public items have author and a list of tags and they are listed by the name and by tags, so you can easily browse snippets. This currently looks like a good way of finding items (together with search engines that will hopefully start indexing the web now that I posted a public link!)

The web site is still evolving and I expect to improve it as it becomes more popular. I'll do changes that will look important based on how the web site is used, so feel free to use it and it will adapt to work well :-). One of the first plans is to automatically export all snippets to some source control, so that they are archived in some independent place...

Summary

Thanks to Robert Pickering, Antonio Cisternino and James Margetson, the web site already contains a few useful F# snippets in addition to those that I submitted during the development. I think that with your help, the web site can become really useful resource of reusable snippets that solve some of the common problems that F# developers often need to solve. If you ever find yourself thinking that some snippet you just wrote is interesting and could be useful or if you write something when explaining F# to your colleagues, then please go on and post it to the web site! I'm sure I'll do that - I started working on the web site when I got irresistible feeling to share this snippet.

Published: Sunday, 12 December 2010, 2:19 AM
Author: Tomas Petricek
Typos: Send me pull request!
Tags: f#, universe, links

Contact & about

This site is hosted on GitHub and is generated using F# Formatting and DotLiquid. For more info, see the website source on GitHub.

Please submit issues & corrections on GitHub. Use pull requests for minor corrections only.

  • Twitter: @tomaspetricek
  • GitHub: @tpetricek
  • Email me: tomas@tomasp.net

Blog archives

February 2019 (1),  November 2018 (1),  October 2018 (1),  May 2018 (1),  September 2017 (1),  June 2017 (1),  April 2017 (1),  March 2017 (2),  January 2017 (1),  October 2016 (1),  September 2016 (2),  August 2016 (1),  July 2016 (1),  May 2016 (2),  April 2016 (1),  December 2015 (2),  November 2015 (1),  September 2015 (3),  July 2015 (1),  June 2015 (1),  May 2015 (2),  April 2015 (3),  March 2015 (2),  February 2015 (1),  January 2015 (2),  December 2014 (1),  May 2014 (3),  April 2014 (2),  March 2014 (1),  January 2014 (2),  December 2013 (1),  November 2013 (1),  October 2013 (1),  September 2013 (1),  August 2013 (2),  May 2013 (1),  April 2013 (1),  March 2013 (1),  February 2013 (1),  January 2013 (1),  December 2012 (2),  October 2012 (1),  August 2012 (3),  June 2012 (2),  April 2012 (1),  March 2012 (4),  February 2012 (5),  January 2012 (2),  November 2011 (5),  August 2011 (3),  July 2011 (2),  June 2011 (2),  May 2011 (2),  March 2011 (4),  December 2010 (1),  November 2010 (6),  October 2010 (6),  September 2010 (4),  July 2010 (3),  June 2010 (2),  May 2010 (1),  February 2010 (2),  January 2010 (3),  December 2009 (3),  July 2009 (1),  June 2009 (3),  May 2009 (2),  April 2009 (1),  March 2009 (2),  February 2009 (1),  December 2008 (1),  November 2008 (5),  October 2008 (1),  September 2008 (1),  June 2008 (1),  March 2008 (3),  February 2008 (1),  December 2007 (2),  November 2007 (6),  October 2007 (1),  September 2007 (1),  August 2007 (1),  July 2007 (2),  April 2007 (2),  March 2007 (2),  February 2007 (3),  January 2007 (2),  November 2006 (1),  October 2006 (3),  August 2006 (2),  July 2006 (1),  June 2006 (3),  May 2006 (2),  April 2006 (2),  December 2005 (1),  July 2005 (4),  June 2005 (5),  May 2005 (1),  April 2005 (3),  March 2005 (3),  January 2005 (1),  December 2004 (3),  November 2004 (2), 

License

Unless explicitly mentioned, all articles on this site are licensed under Creative Commons Attribution Share Alike. All source code samples are licensed under the MIT License.

CC License logo