Code snippet: <a href="https://gist.github.com/pbadenski/a4ce272dfdcb517974c3d01682395443" rel="nofollow">https://gist.github.com/pbadenski/a4ce272dfdcb517974c3d01682...</a><p>I couldn't find any (decent) examples on the web, and I'm hoping others will find this contribution useful.<p>I'm also not entirely sure this is foolproof (although it seems to work ok). I'm hoping HN can help.