Skip to content

Instantly share code, notes, and snippets.

@ashnur
Last active December 27, 2015 09:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashnur/7307452 to your computer and use it in GitHub Desktop.
Save ashnur/7307452 to your computer and use it in GitHub Desktop.
Open npm package url in a new tab from its github page.
javascript:(function(){ var w=window.open(''); var r=document.createElement('script'); r.textContent = 'var x=new XMLHttpRequest;x.onload = function(){window.location.href=\'https://npmjs.org/package/\'+JSON.parse(atob(JSON.parse(x.responseText).content.replace(/\\n/g,\'\'))).name}; x.open(\'GET\',(\'https://api.github.com/repos'+window.location.pathname+'/contents/package.json\').replace(/([^:])[\/][\/]+/g,\'$1/\'));x.send()'; w.document.body.appendChild(r) }())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment