View README.md

Jupyter Kernels and Node

This is a (lightly) annotated run through of launching a jupyter kernel, sending some messages, and cleaning it up.

git clone https://gist.github.com/3239c1547b53c97cc648d5abb3cbe3e0.git kernely
cd kernely
npm install
node index.js
View Cleaning Up Empty Notebooks.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View notebook.save.js
(function(console){
console.save = function(data, filename){
if(!data) {
data = Jupyter.notebook.toJSON();
}
filename = Jupyter.notebook.notebook_name;
if(!filename) {
View notebook-require-usage.md

nteract doesn't support requirejs because we have the builtin require at our fingertips. Jupyter notebook however has long operated under the assumption that you can use the builtin requirejs for loading modules asynchronously:

require(['d3'], function(d3) {...

I started exploring the idea of providing some of these modules in a "quirks" sort of mode where we provide limited access to "requirejs" while still sandboxed. To find out what modules were commonly required, I turned to Google BigQuery, the GitHub dataset, and a User Defined Function (UDF) written in JavaScript.

I'll flesh out this gist or a blog post later. For now, I'll just provide my query code:

View big_query_examples.md

How many times shouldn't it happen...

-- https://news.ycombinator.com/item?id=11396045

SELECT count(*)
FROM (SELECT id, repo_name, path
        FROM [bigquery-public-data:github_repos.sample_files]
      ) AS F
View random_image.py
import IPython.display
import requests
def random_image_url(tags=None):
query = ""
if tags is not None:
query = "&tag=" + "+".join(tags)
api_url = "http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC" + query
resp = requests.get(api_url)
View javascript-proposal.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View table-with-schema.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View dabblet.css
/**
* The cicada principle in animations
* Remember the cicada principle that used prime numbers to make multiple overlaid repeated backgrounds seem more random?
* There’s no reason it can’t be applied to repeating linear animations too (using primes for the durations, divided by 10)
*/
@keyframes spin { to { transform: rotate(1turn); } }
@keyframes radius { 50% { border-radius: 50%; } }
@keyframes color { 33% { color: rebeccapurple; } 66% { color: deeppink } }
@keyframes width { 50% { border-width: .3em; } }
View dabblet.css
/**
* Pseudorandom stripes
*/
background: #D5D5D5;
background-image:
linear-gradient(89deg, #EEE 23px, transparent 0),
linear-gradient(97deg, #DDD 17px, transparent 0),
linear-gradient(101deg, #D0D0D0 23px, transparent 0);
background-size: 83px 100%, 61px 100%, 41px 100%;