Created
October 23, 2019 06:19
-
-
Save fx-kirin/1d2f2cc5a0ed3038d03fb881c6bb92c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:date = new Date(); url_root = 'http://nbviewer.ipython.org/'; url = null; gist_re = /^https?:\/\/gist\.github\.com\/(?:\w+\/)?([a-f0-9]+)$/; github_re = /^https:\/\/(github\.com\/.*\/)blob\/(.*\.ipynb)$/; https_re = /^https:\/\/(.*\.ipynb)$/; http_re = /^http:\/\/(.*\.ipynb)$/; loc = location.href; if (gist_re.test(loc)) { gist = gist_re.exec(loc); url = url_root + gist[1]; } else if (github_re.test(loc)) { path = github_re.exec(loc); url = url_root + 'urls/raw.' + path[1] + path[2]; } else if (https_re.test(loc)) { path = https_re.exec(loc); url = url_root + 'urls/' + path[1]; } else if (http_re.test(loc)) { path = http_re.exec(loc); url = url_root + 'url/' + path[1];} if (url) {void(window.open(url, 'nbviewer' + date.getTime()));} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add it to your browser's bookmark as bookmarklet. It will open ipynb file in nbviewer on clicking the bookmark from Github.