Skip to content

Instantly share code, notes, and snippets.

Created October 17, 2012 00:56
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
A bookmarklet that tries to open the current page in nbviewer. White space has been trimmed for brevity. To use make a new bookmark and copy the code below into the URL field.
javascript:date=new Date();
if (^https?:\/\/gist\.github\.com\/[0-9]+$/) !== -1) {
gist = location.href.match(/^https?:\/\/gist\.github\.com\/([0-9]+)$/);
url = url_root + gist[1];
} else if (^https:\/\/.*\.ipynb$/) !== -1) {
path = location.href.match(/^https:\/\/(.*\.ipynb)$/);
url = url_root + 'urls/' + path[1];
} else if (^http:\/\/.*\.ipynb$/) !== -1) {
path = location.href.match(/^http:\/\/(.*\.ipynb)$/);
url = url_root + 'url/' + path[1];}
if (url) {
void(, 'nbviewer' + date.getTime()));}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment