Skip to content

Instantly share code, notes, and snippets.

@ICBacon
Forked from tonyfast/index.html
Last active August 29, 2015 14:27
Show Gist options
  • Save ICBacon/3e84770552501388392d to your computer and use it in GitHub Desktop.
Save ICBacon/3e84770552501388392d to your computer and use it in GitHub Desktop.
My starred gists and a brand new gist, nbviewer, and bl.ocks workflow http://bl.ocks.org/tonyfast/raw/1e1bc45d17020fba5148/

Testing a workflow

  1. Initialize the idea as a Gist readme
  2. Clone the repository locally with just the readme
  3. Create a new notebook in the repository
  4. Use notebook to create visualizations
  5. Create index.html to host on blocks through the notebook
  6. Use GitPython API to commit changes.
<table><tr><th>User</th><th>description</th></tr><tr><td>tnearey</td><td><a href="https://gist.github.com/tnearey/b0f6c25399c1cdab4d66" target="_blank">Minimal IPython 3 notebook (Anaconda) runing R code</a></td></tr><tr><td>bollwyvl</td><td><a href="https://gist.github.com/bollwyvl/e62fd91266afbcb0c749" target="_blank"></a></td></tr><tr><td>canavandl</td><td><a href="https://gist.github.com/canavandl/13259d94d58786dd5aa8" target="_blank"></a></td></tr><tr><td>jaredly</td><td><a href="https://gist.github.com/jaredly/404a36306fdee6a1737a" target="_blank">Jupyter NodeJS Example</a></td></tr><tr><td>robclewley</td><td><a href="https://gist.github.com/robclewley/6bf44c94443bbe7e9424" target="_blank">Brief description of gamified exploratory modeling tool application, Bombardier</a></td></tr><tr><td>bollwyvl</td><td><a href="https://gist.github.com/bollwyvl/e51b4e724f0b82669c84" target="_blank">Embedded Mermaid diagrams in the IPython Notebook</a></td></tr><tr><td>insin</td><td><a href="https://gist.github.com/insin/4ce0df7537a567f1eecb" target="_blank">Riot.js Boolean Attribute Test Case - http://bl.ocks.org/insin/raw/4ce0df7537a567f1eecb/</a></td></tr><tr><td>domenic</td><td><a href="https://gist.github.com/domenic/ec8b0fc8ab45f39403dd" target="_blank">Auto-deploying built products to gh-pages with Travis</a></td></tr><tr><td>luislavena</td><td><a href="https://gist.github.com/luislavena/f064211759ee0f806c88" target="_blank">Workaround RubyGems' SSL errors on Ruby for Windows (RubyInstaller)</a></td></tr><tr><td>sebmarkbage</td><td><a href="https://gist.github.com/sebmarkbage/fcb1b6ab493b0c77d589" target="_blank">React (Virtual) DOM Terminology</a></td></tr><tr><td>davidbrough1</td><td><a href="https://gist.github.com/davidbrough1/65fbce77bef5501fb85e" target="_blank"></a></td></tr><tr><td>zanarmstrong</td><td><a href="https://gist.github.com/zanarmstrong/ca0adb7e426c12c06a95" target="_blank">d3 time formatting example</a></td></tr><tr><td>espinielli</td><td><a href="https://gist.github.com/espinielli/b717ed2cc0d1a9a789ae" target="_blank">D3 keybinding with jwerty</a></td></tr><tr><td>nolanlawson</td><td><a href="https://gist.github.com/nolanlawson/863e464f3025d7199a1f" target="_blank">IndexedDB with Web Workers</a></td></tr><tr><td>bollwyvl</td><td><a href="https://gist.github.com/bollwyvl/fe1d2806449487cdf88a" target="_blank">RevealJS SVG fragment presenter</a></td></tr><tr><td>jebeck</td><td><a href="https://gist.github.com/jebeck/9671241" target="_blank">all about D3 time scales</a></td></tr><tr><td>ramnathv</td><td><a href="https://gist.github.com/ramnathv/9334834" target="_blank">R Markdown to IPython Notebook</a></td></tr><tr><td>dan-blanchard</td><td><a href="https://gist.github.com/dan-blanchard/7045057" target="_blank">Quicker Travis builds that rely on numpy and scipy using Miniconda</a></td></tr><tr><td>jasonrudolph</td><td><a href="https://gist.github.com/jasonrudolph/6065289" target="_blank">5 entertaining things you can find with the GitHub Search API</a></td></tr><tr><td>jasonrudolph</td><td><a href="https://gist.github.com/jasonrudolph/6057563" target="_blank">GitHub Search API: Get the number of stars for a repository</a></td></tr><tr><td>bcambel</td><td><a href="https://gist.github.com/bcambel/5853818" target="_blank"></a></td></tr><tr><td>herrstucki</td><td><a href="https://gist.github.com/herrstucki/5467720" target="_blank">Indented tree layout</a></td></tr><tr><td>bj0</td><td><a href="https://gist.github.com/bj0/5343292" target="_blank">IPython Custom Cell Magic for Rendering Jinja2 Templates</a></td></tr><tr><td>Caged</td><td><a href="https://gist.github.com/Caged/4649511" target="_blank">Convert SVG's to PNGs. This works OK if the SVG's styles are inline. The SVG element must contain an xmlns attribute. Webkit also requires you specify a font size on `text` elements.</a></td></tr><tr><td>tmcw</td><td><a href="https://gist.github.com/tmcw/4444952" target="_blank">d3.keybinding</a></td></tr><tr><td>mbostock</td><td><a href="https://gist.github.com/mbostock/4341156" target="_blank">Delaunay Triangulation</a></td></tr><tr><td>mattsahr</td><td><a href="https://gist.github.com/mattsahr/4190206" target="_blank">requireJS Example</a></td></tr><tr><td>mbostock</td><td><a href="https://gist.github.com/mbostock/3934356" target="_blank">Underscore’s Equivalents in D3</a></td></tr><tr><td>mbostock</td><td><a href="https://gist.github.com/mbostock/3808218" target="_blank">General Update Pattern, I</a></td></tr><tr><td>mbostock</td><td><a href="https://gist.github.com/mbostock/3757119" target="_blank">Equirectangular (Plate Carrée)</a></td></tr><tr><td>mrjoes</td><td><a href="https://gist.github.com/mrjoes/3284402" target="_blank">Dead simple broker on top of sockjs-tornado</a></td></tr><tr><td>jonathanmoore</td><td><a href="https://gist.github.com/jonathanmoore/2640302" target="_blank">Get the share counts from various APIs</a></td></tr><tr><td>caspyin</td><td><a href="https://gist.github.com/caspyin/2288960" target="_blank">A curl tutorial using GitHub's API</a></td></tr><tr><td>ToulBoy</td><td><a href="https://gist.github.com/ToulBoy/1941432" target="_blank">Elasticsearch 0.18.6 : My example of "parent child"</a></td></tr><tr><td>efeminella</td><td><a href="https://gist.github.com/efeminella/1937609" target="_blank">Loading external Handlebars Templates with jQuery or Zepto</a></td></tr><tr><td>dupuy</td><td><a href="https://gist.github.com/dupuy/1855764" target="_blank">Common markup for Markdown and reStructuredText</a></td></tr><tr><td>ssp</td><td><a href="https://gist.github.com/ssp/1663093" target="_blank">Extract a single file from a git repository</a></td></tr><tr><td>harlantwood</td><td><a href="https://gist.github.com/harlantwood/1091420" target="_blank">CoffeeScript->Javascript D3 Force-Directed Layout (Multiple Foci)</a></td></tr><tr><td>irfani</td><td><a href="https://gist.github.com/irfani/1045108" target="_blank">Scrapyd with Selenium Spider</a></td></tr></table>
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"> APIless list of starred gists"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from pyquery import PyQuery as pq\n",
"import requests\n",
"import pandas as pd\n",
"from IPython.display import HTML\n",
"import git"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<table><tr><th>User</th><th>description</th></tr><tr><td>tnearey</td><td><a href=\"https://gist.github.com/tnearey/b0f6c25399c1cdab4d66\" target=\"_blank\">Minimal IPython 3 notebook (Anaconda) runing R code</a></td></tr><tr><td>bollwyvl</td><td><a href=\"https://gist.github.com/bollwyvl/e62fd91266afbcb0c749\" target=\"_blank\"></a></td></tr><tr><td>canavandl</td><td><a href=\"https://gist.github.com/canavandl/13259d94d58786dd5aa8\" target=\"_blank\"></a></td></tr><tr><td>jaredly</td><td><a href=\"https://gist.github.com/jaredly/404a36306fdee6a1737a\" target=\"_blank\">Jupyter NodeJS Example</a></td></tr><tr><td>robclewley</td><td><a href=\"https://gist.github.com/robclewley/6bf44c94443bbe7e9424\" target=\"_blank\">Brief description of gamified exploratory modeling tool application, Bombardier</a></td></tr><tr><td>bollwyvl</td><td><a href=\"https://gist.github.com/bollwyvl/e51b4e724f0b82669c84\" target=\"_blank\">Embedded Mermaid diagrams in the IPython Notebook</a></td></tr><tr><td>insin</td><td><a href=\"https://gist.github.com/insin/4ce0df7537a567f1eecb\" target=\"_blank\">Riot.js Boolean Attribute Test Case - http://bl.ocks.org/insin/raw/4ce0df7537a567f1eecb/</a></td></tr><tr><td>domenic</td><td><a href=\"https://gist.github.com/domenic/ec8b0fc8ab45f39403dd\" target=\"_blank\">Auto-deploying built products to gh-pages with Travis</a></td></tr><tr><td>luislavena</td><td><a href=\"https://gist.github.com/luislavena/f064211759ee0f806c88\" target=\"_blank\">Workaround RubyGems' SSL errors on Ruby for Windows (RubyInstaller)</a></td></tr><tr><td>sebmarkbage</td><td><a href=\"https://gist.github.com/sebmarkbage/fcb1b6ab493b0c77d589\" target=\"_blank\">React (Virtual) DOM Terminology</a></td></tr><tr><td>davidbrough1</td><td><a href=\"https://gist.github.com/davidbrough1/65fbce77bef5501fb85e\" target=\"_blank\"></a></td></tr><tr><td>zanarmstrong</td><td><a href=\"https://gist.github.com/zanarmstrong/ca0adb7e426c12c06a95\" target=\"_blank\">d3 time formatting example</a></td></tr><tr><td>espinielli</td><td><a href=\"https://gist.github.com/espinielli/b717ed2cc0d1a9a789ae\" target=\"_blank\">D3 keybinding with jwerty</a></td></tr><tr><td>nolanlawson</td><td><a href=\"https://gist.github.com/nolanlawson/863e464f3025d7199a1f\" target=\"_blank\">IndexedDB with Web Workers</a></td></tr><tr><td>bollwyvl</td><td><a href=\"https://gist.github.com/bollwyvl/fe1d2806449487cdf88a\" target=\"_blank\">RevealJS SVG fragment presenter</a></td></tr><tr><td>jebeck</td><td><a href=\"https://gist.github.com/jebeck/9671241\" target=\"_blank\">all about D3 time scales</a></td></tr><tr><td>ramnathv</td><td><a href=\"https://gist.github.com/ramnathv/9334834\" target=\"_blank\">R Markdown to IPython Notebook</a></td></tr><tr><td>dan-blanchard</td><td><a href=\"https://gist.github.com/dan-blanchard/7045057\" target=\"_blank\">Quicker Travis builds that rely on numpy and scipy using Miniconda</a></td></tr><tr><td>jasonrudolph</td><td><a href=\"https://gist.github.com/jasonrudolph/6065289\" target=\"_blank\">5 entertaining things you can find with the GitHub Search API</a></td></tr><tr><td>jasonrudolph</td><td><a href=\"https://gist.github.com/jasonrudolph/6057563\" target=\"_blank\">GitHub Search API: Get the number of stars for a repository</a></td></tr><tr><td>bcambel</td><td><a href=\"https://gist.github.com/bcambel/5853818\" target=\"_blank\"></a></td></tr><tr><td>herrstucki</td><td><a href=\"https://gist.github.com/herrstucki/5467720\" target=\"_blank\">Indented tree layout</a></td></tr><tr><td>bj0</td><td><a href=\"https://gist.github.com/bj0/5343292\" target=\"_blank\">IPython Custom Cell Magic for Rendering Jinja2 Templates</a></td></tr><tr><td>Caged</td><td><a href=\"https://gist.github.com/Caged/4649511\" target=\"_blank\">Convert SVG's to PNGs. This works OK if the SVG's styles are inline. The SVG element must contain an xmlns attribute. Webkit also requires you specify a font size on `text` elements.</a></td></tr><tr><td>tmcw</td><td><a href=\"https://gist.github.com/tmcw/4444952\" target=\"_blank\">d3.keybinding</a></td></tr><tr><td>mbostock</td><td><a href=\"https://gist.github.com/mbostock/4341156\" target=\"_blank\">Delaunay Triangulation</a></td></tr><tr><td>mattsahr</td><td><a href=\"https://gist.github.com/mattsahr/4190206\" target=\"_blank\">requireJS Example</a></td></tr><tr><td>mbostock</td><td><a href=\"https://gist.github.com/mbostock/3934356\" target=\"_blank\">Underscore’s Equivalents in D3</a></td></tr><tr><td>mbostock</td><td><a href=\"https://gist.github.com/mbostock/3808218\" target=\"_blank\">General Update Pattern, I</a></td></tr><tr><td>mbostock</td><td><a href=\"https://gist.github.com/mbostock/3757119\" target=\"_blank\">Equirectangular (Plate Carrée)</a></td></tr><tr><td>mrjoes</td><td><a href=\"https://gist.github.com/mrjoes/3284402\" target=\"_blank\">Dead simple broker on top of sockjs-tornado</a></td></tr><tr><td>jonathanmoore</td><td><a href=\"https://gist.github.com/jonathanmoore/2640302\" target=\"_blank\">Get the share counts from various APIs</a></td></tr><tr><td>caspyin</td><td><a href=\"https://gist.github.com/caspyin/2288960\" target=\"_blank\">A curl tutorial using GitHub's API</a></td></tr><tr><td>ToulBoy</td><td><a href=\"https://gist.github.com/ToulBoy/1941432\" target=\"_blank\">Elasticsearch 0.18.6 : My example of \"parent child\"</a></td></tr><tr><td>efeminella</td><td><a href=\"https://gist.github.com/efeminella/1937609\" target=\"_blank\">Loading external Handlebars Templates with jQuery or Zepto</a></td></tr><tr><td>dupuy</td><td><a href=\"https://gist.github.com/dupuy/1855764\" target=\"_blank\">Common markup for Markdown and reStructuredText</a></td></tr><tr><td>ssp</td><td><a href=\"https://gist.github.com/ssp/1663093\" target=\"_blank\">Extract a single file from a git repository</a></td></tr><tr><td>harlantwood</td><td><a href=\"https://gist.github.com/harlantwood/1091420\" target=\"_blank\">CoffeeScript->Javascript D3 Force-Directed Layout (Multiple Foci)</a></td></tr><tr><td>irfani</td><td><a href=\"https://gist.github.com/irfani/1045108\" target=\"_blank\">Scrapyd with Selenium Spider</a></td></tr></table>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"html, page_number, num_gist = [ '',1,10]\n",
"while num_gist == 10:\n",
" response = requests.get( url = 'https://gist.github.com/tonyfast/starred', params = { 'page': page_number, },)\n",
" gists = pq( response.text )('.gist-snippet')\n",
" num_gist, page_number = [ len(pq( response.text )('.gist-snippet')), page_number + 1]\n",
" for snippet in gists.items():\n",
" t = {\n",
" 'author': snippet('.creator > a:first').text(),\n",
" 'url': 'https://gist.github.com' + snippet('.creator > a:last').attr['href'],\n",
" 'description': snippet('.description').text()\n",
" }\n",
" html += '<tr><td>{author}</td><td><a href=\"{url}\" target=\"_blank\">{description}</a></td></tr>'.format( **t ) \n",
"\n",
"html = '<table><tr><th>User</th><th>description</th></tr>' + html + '</table>'\n",
"HTML( html )"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"with open( 'index.html','w') as f:\n",
" f.write( html )"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[<git.remote.PushInfo at 0x108749eb8>]"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"repo = git.Repo('.')\n",
"index = repo.index\n",
"index.add(['starred_gists.ipynb', index.html])\n",
"index.commit( message = \"Committed from the notebook\")\n",
"repo.remotes['origin'].push()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment