Skip to content

Instantly share code, notes, and snippets.

@parente
Last active January 27, 2016 14:18

Revisions

  1. parente revised this gist Jan 27, 2016. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions howto_gist.ipynb
    Original file line number Diff line number Diff line change
    @@ -72,6 +72,11 @@
    },
    "cell_type": "markdown",
    "source": "<p class=\"alert alert-warning\">NOTE: Your token is stored in the browser localStorage for the current notebook server domain. Any JS scripts loaded from the domain can access your token.</p>"
    },
    {
    "metadata": {},
    "cell_type": "markdown",
    "source": "PS: This notebook was posted as a gist using its own recipe &#x1F648;&#x1F649;&#x1F64A;"
    }
    ],
    "metadata": {
  2. parente revised this gist Jan 27, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion howto_gist.ipynb
    Original file line number Diff line number Diff line change
    @@ -63,7 +63,7 @@
    {
    "metadata": {},
    "cell_type": "markdown",
    "source": "Then:\n\n1. Get a [personal access token from GitHub](https://github.com/settings/tokens) that has *gist* permissions.\n2. Click the <i class=\"fa-share fa\"></i> share button in the toolbar.\n3. Enter your access token when prompted.\n4. Click the nbviewer link to see your gisted notebook.\n5. Click the <i class=\"fa-share fa\"></i> share button again in the toolbar to update your gist. (The gist ID is preserved in the notebook file.)"
    "source": "Then:\n\n1. Get a [personal access token from GitHub](https://github.com/settings/tokens) that has *gist* permissions.\n2. Click the <i class=\"fa-share fa\"></i> share button in the toolbar.\n3. Enter your access token when prompted.\n4. Click the nbviewer link to see your gisted notebook. (nbviewer caches renders so it may not show your latest changes immediately.)\n5. Click the <i class=\"fa-share fa\"></i> share button again in the toolbar to update your gist. (The gist ID is preserved in the notebook file.)"
    },
    {
    "metadata": {
  3. parente revised this gist Jan 27, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion howto_gist.ipynb
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    {
    "metadata": {},
    "cell_type": "markdown",
    "source": "# Gist on Demand\n\nOn-the-fly recipe for using [minrk's gist extension](https://github.com/minrk/ipython_extensions/) on a Jupyter Notebook server."
    "source": "# Gist on Demand\n\nOn-the-fly recipe for using [minrk's gist extension](https://github.com/minrk/ipython_extensions/) on a Jupyter Notebook server (>=v4.0)."
    },
    {
    "metadata": {
  4. parente revised this gist Jan 27, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion howto_gist.ipynb
    Original file line number Diff line number Diff line change
    @@ -71,7 +71,7 @@
    "trusted": true
    },
    "cell_type": "markdown",
    "source": "<p class=\"alert alert-warning\">**NOTE**: Your token is stored in the browser localStorage for the current notebook server domain. Any JS scripts loaded from the domain can access your token.</p>"
    "source": "<p class=\"alert alert-warning\">NOTE: Your token is stored in the browser localStorage for the current notebook server domain. Any JS scripts loaded from the domain can access your token.</p>"
    }
    ],
    "metadata": {
  5. parente revised this gist Jan 27, 2016. 1 changed file with 21 additions and 7 deletions.
    28 changes: 21 additions & 7 deletions howto_gist.ipynb
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    {
    "metadata": {},
    "cell_type": "markdown",
    "source": "# HOWTO gist\n\nUsing minrk's gist extension."
    "source": "# Gist on Demand\n\nOn-the-fly recipe for using [minrk's gist extension](https://github.com/minrk/ipython_extensions/) on a Jupyter Notebook server."
    },
    {
    "metadata": {
    @@ -15,13 +15,18 @@
    "execution_count": 4,
    "outputs": []
    },
    {
    "metadata": {},
    "cell_type": "markdown",
    "source": "Install to the user directory where we should have access."
    },
    {
    "metadata": {
    "collapsed": false,
    "trusted": true
    },
    "cell_type": "code",
    "source": "notebook.nbextensions.install_nbextension('https://rawgithub.com/minrk/ipython_extensions/master/nbextensions/gist.js', user=True)",
    "source": "notebook.nbextensions.install_nbextension('https://rawgithub.com/minrk/ipython_extensions/master/nbextensions/gist.js', \n user=True)",
    "execution_count": 5,
    "outputs": [
    {
    @@ -31,6 +36,11 @@
    }
    ]
    },
    {
    "metadata": {},
    "cell_type": "markdown",
    "source": "Enable the extension right away."
    },
    {
    "metadata": {
    "collapsed": false,
    @@ -50,15 +60,18 @@
    }
    ]
    },
    {
    "metadata": {},
    "cell_type": "markdown",
    "source": "Then:\n\n1. Get a [personal access token from GitHub](https://github.com/settings/tokens) that has *gist* permissions.\n2. Click the <i class=\"fa-share fa\"></i> share button in the toolbar.\n3. Enter your access token when prompted.\n4. Click the nbviewer link to see your gisted notebook.\n5. Click the <i class=\"fa-share fa\"></i> share button again in the toolbar to update your gist. (The gist ID is preserved in the notebook file.)"
    },
    {
    "metadata": {
    "collapsed": true,
    "trusted": true
    },
    "cell_type": "code",
    "source": "",
    "execution_count": null,
    "outputs": []
    "cell_type": "markdown",
    "source": "<p class=\"alert alert-warning\">**NOTE**: Your token is stored in the browser localStorage for the current notebook server domain. Any JS scripts loaded from the domain can access your token.</p>"
    }
    ],
    "metadata": {
    @@ -78,7 +91,8 @@
    "version": "3.4.4",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3"
    }
    },
    "gist_id": "587e2bc8b335e90d890b"
    },
    "nbformat": 4,
    "nbformat_minor": 0
  6. parente created this gist Jan 27, 2016.
    85 changes: 85 additions & 0 deletions howto_gist.ipynb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,85 @@
    {
    "cells": [
    {
    "metadata": {},
    "cell_type": "markdown",
    "source": "# HOWTO gist\n\nUsing minrk's gist extension."
    },
    {
    "metadata": {
    "collapsed": false,
    "trusted": true
    },
    "cell_type": "code",
    "source": "import notebook.nbextensions",
    "execution_count": 4,
    "outputs": []
    },
    {
    "metadata": {
    "collapsed": false,
    "trusted": true
    },
    "cell_type": "code",
    "source": "notebook.nbextensions.install_nbextension('https://rawgithub.com/minrk/ipython_extensions/master/nbextensions/gist.js', user=True)",
    "execution_count": 5,
    "outputs": [
    {
    "text": "downloading https://rawgithub.com/minrk/ipython_extensions/master/nbextensions/gist.js to /tmp/tmpvleoz37l/gist.js\ncopying /tmp/tmpvleoz37l/gist.js -> /home/jovyan/.local/share/jupyter/nbextensions/gist.js\n",
    "name": "stdout",
    "output_type": "stream"
    }
    ]
    },
    {
    "metadata": {
    "collapsed": false,
    "trusted": true
    },
    "cell_type": "code",
    "source": "%%javascript\nJupyter.utils.load_extensions('gist')",
    "execution_count": 6,
    "outputs": [
    {
    "metadata": {},
    "data": {
    "application/javascript": "Jupyter.utils.load_extensions('gist')",
    "text/plain": "<IPython.core.display.Javascript object>"
    },
    "output_type": "display_data"
    }
    ]
    },
    {
    "metadata": {
    "collapsed": true,
    "trusted": true
    },
    "cell_type": "code",
    "source": "",
    "execution_count": null,
    "outputs": []
    }
    ],
    "metadata": {
    "kernelspec": {
    "name": "python3",
    "display_name": "Python 3",
    "language": "python"
    },
    "language_info": {
    "mimetype": "text/x-python",
    "name": "python",
    "codemirror_mode": {
    "version": 3,
    "name": "ipython"
    },
    "file_extension": ".py",
    "version": "3.4.4",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3"
    }
    },
    "nbformat": 4,
    "nbformat_minor": 0
    }