Skip to content

Instantly share code, notes, and snippets.

@runeleaf
Created August 22, 2010 13:47
Show Gist options
  • Save runeleaf/543787 to your computer and use it in GitHub Desktop.
Save runeleaf/543787 to your computer and use it in GitHub Desktop.
javascript:var getTinyURL=function(longURL,success){var ud='json'+(Math.random()*100).toString().replace(/\./g,''),api='http://json-tinyurl.appspot.com/?url=';window[ud]=function(o){success&&success(o.tinyurl);};document.getElementsByTagName('body')[0].appendChild((function(){var s=document.createElement('script');s.type='text/javascript';s.src=api+encodeURIComponent(longURL)+'&callback='+ud;return s;})());};getTinyURL('http://runeleaf.net',function(tinyurl){location.href='http://twitter.com/home?status='+encodeURIComponent('Browsing: '+document.title+' '+tinyurl)});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment