Skip to content

Commit fa3265c

Browse files
committed
nbv3 notebooks should be fixed now.
1 parent df6c2b9 commit fa3265c

File tree

100 files changed

+23963
-23963
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+23963
-23963
lines changed

notebooks/chapter01_basic/04_magic.ipynb

Lines changed: 226 additions & 226 deletions
Large diffs are not rendered by default.

notebooks/chapter01_basic/05_config.ipynb

Lines changed: 252 additions & 252 deletions
Large diffs are not rendered by default.

notebooks/chapter01_basic/06_kernel.ipynb

Lines changed: 375 additions & 375 deletions
Large diffs are not rendered by default.

notebooks/chapter02_best_practices/07_unittests.ipynb

Lines changed: 236 additions & 236 deletions
Large diffs are not rendered by default.

notebooks/chapter02_best_practices/07_unittests_py2.ipynb

Lines changed: 236 additions & 236 deletions
Large diffs are not rendered by default.

notebooks/chapter03_notebook/01_blocks.ipynb

Lines changed: 228 additions & 228 deletions
Large diffs are not rendered by default.

notebooks/chapter03_notebook/02_nbformat.ipynb

Lines changed: 295 additions & 295 deletions
Large diffs are not rendered by default.
Lines changed: 153 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -1,154 +1,154 @@
1-
{
2-
"metadata": {
3-
"name": "",
4-
"signature": "sha256:3ac8512f1eab399da758b33b61abb8225f8d6b129cf9456e316cb5e44f2bbb2c"
5-
},
6-
"nbformat": 3,
7-
"nbformat_minor": 0,
8-
"worksheets": [
9-
{
10-
"cells": [
11-
{
12-
"cell_type": "markdown",
13-
"metadata": [],
14-
"source": [
15-
"> This is one of the 100 recipes of the [IPython Cookbook](http://ipython-books.github.io/), the definitive guide to high-performance scientific computing and data science in Python.\n"
16-
]
17-
},
18-
{
19-
"cell_type": "markdown",
20-
"metadata": {},
21-
"source": [
22-
"# 3.3. Adding custom controls in the notebook toolbar"
23-
]
24-
},
25-
{
26-
"cell_type": "markdown",
27-
"metadata": {},
28-
"source": [
29-
"The CSS and Javascript of the HTML notebook can be customized through the files in `~/.ipython/profile_default/static/custom`, where `~` is your `HOME` directory, and `default` is your IPython profile. In this short recipe, we will use this feature to add a new button in the notebook toolbar on top of every notebook. Specifically, this button renumbers linearly all code cells."
30-
]
31-
},
32-
{
33-
"cell_type": "markdown",
34-
"metadata": {},
35-
"source": [
36-
"1. First, we are going to inject Javascript code directly in the notebook. This is useful for testing purposes, or if you don't want your changes to be permanent. The Javascript code will be loaded with that notebook only. To do this, we can just use the `%%javascript` cell magic."
37-
]
38-
},
39-
{
40-
"cell_type": "code",
41-
"collapsed": false,
42-
"input": [
43-
"%%javascript\n",
44-
"// This function allows us to add buttons \n",
45-
"// to the notebook toolbar.\n",
46-
"IPython.toolbar.add_buttons_group([\n",
47-
"{\n",
48-
" // The button's label.\n",
49-
" 'label': 'renumber all code cells',\n",
50-
" \n",
51-
" // The button's icon.\n",
52-
" // See a list of Font-Awesome icons here:\n",
53-
" // http://fortawesome.github.io/Font-Awesome/icons/\n",
54-
" 'icon': 'icon-list-ol',\n",
55-
" \n",
56-
" // The callback function.\n",
57-
" 'callback': function () {\n",
58-
" \n",
59-
" // We retrieve the lists of all cells.\n",
60-
" var cells = IPython.notebook.get_cells();\n",
61-
" \n",
62-
" // We only keep the code cells.\n",
63-
" cells = cells.filter(function(c)\n",
64-
" {\n",
65-
" return c instanceof IPython.CodeCell; \n",
66-
" })\n",
67-
" \n",
68-
" // We set the input prompt of all code cells.\n",
69-
" for (var i = 0; i < cells.length; i++) {\n",
70-
" cells[i].set_input_prompt(i + 1);\n",
71-
" }\n",
72-
" }\n",
73-
"}]);"
74-
],
75-
"language": "python",
76-
"metadata": {},
77-
"outputs": []
78-
},
79-
{
80-
"cell_type": "markdown",
81-
"metadata": {},
82-
"source": [
83-
"Running this code cell adds a button in the toolbar. Clicking on this button automatically updates the prompt numbers of all code cells."
84-
]
85-
},
86-
{
87-
"cell_type": "markdown",
88-
"metadata": {},
89-
"source": [
90-
"2. To make these changes permanent, i.e. to add this button on every notebook open within the current profile, we can open the file `~/.ipython/profile_default/static/custom/custom.js` and add the following code:"
91-
]
92-
},
93-
{
94-
"cell_type": "markdown",
95-
"metadata": {},
96-
"source": [
97-
"```javascript\n",
98-
"$([IPython.events]).on('app_initialized.NotebookApp',\n",
99-
" function(){\n",
100-
"\n",
101-
" // Copy of the Javascript code above (step 1).\n",
102-
" IPython.toolbar.add_buttons_group([\n",
103-
" {\n",
104-
" // The button's label.\n",
105-
" 'label': 'renumber all code cells',\n",
106-
"\n",
107-
" // The button's icon.\n",
108-
" // See a list of Font-Awesome icons here:\n",
109-
" // http://fortawesome.github.io/Font-Awesome/icons/\n",
110-
" 'icon': 'icon-list-ol',\n",
111-
"\n",
112-
" // The callback function.\n",
113-
" 'callback': function () {\n",
114-
"\n",
115-
" // We retrieve the lists of all cells.\n",
116-
" var cells = IPython.notebook.get_cells();\n",
117-
"\n",
118-
" // We only keep the code cells.\n",
119-
" cells = cells.filter(function(c)\n",
120-
" {\n",
121-
" return c instanceof IPython.CodeCell; \n",
122-
" })\n",
123-
"\n",
124-
" // We set the input prompt of all code cells.\n",
125-
" for (var i = 0; i < cells.length; i++) {\n",
126-
" cells[i].set_input_prompt(i + 1);\n",
127-
" }\n",
128-
" }\n",
129-
" }]);\n",
130-
"});\n",
131-
"```"
132-
]
133-
},
134-
{
135-
"cell_type": "markdown",
136-
"metadata": {},
137-
"source": [
138-
"The code put here will be automatically loaded as soon as a notebook page is loaded."
139-
]
140-
},
141-
{
142-
"cell_type": "markdown",
143-
"metadata": {},
144-
"source": [
145-
"> You'll find all the explanations, figures, references, and much more in the book (to be released later this summer).\n",
146-
"\n",
147-
"> [IPython Cookbook](http://ipython-books.github.io/), by [Cyrille Rossant](http://cyrille.rossant.net), Packt Publishing, 2014 (500 pages)."
148-
]
149-
}
150-
],
151-
"metadata": {}
152-
}
153-
]
1+
{
2+
"metadata": {
3+
"signature": "sha256:3ac8512f1eab399da758b33b61abb8225f8d6b129cf9456e316cb5e44f2bbb2c",
4+
"name": ""
5+
},
6+
"nbformat": 3,
7+
"nbformat_minor": 0,
8+
"worksheets": [
9+
{
10+
"metadata": {},
11+
"cells": [
12+
{
13+
"cell_type": "markdown",
14+
"source": [
15+
"> This is one of the 100 recipes of the [IPython Cookbook](http://ipython-books.github.io/), the definitive guide to high-performance scientific computing and data science in Python.\n"
16+
],
17+
"metadata": {}
18+
},
19+
{
20+
"cell_type": "markdown",
21+
"source": [
22+
"# 3.3. Adding custom controls in the notebook toolbar"
23+
],
24+
"metadata": {}
25+
},
26+
{
27+
"cell_type": "markdown",
28+
"source": [
29+
"The CSS and Javascript of the HTML notebook can be customized through the files in `~/.ipython/profile_default/static/custom`, where `~` is your `HOME` directory, and `default` is your IPython profile. In this short recipe, we will use this feature to add a new button in the notebook toolbar on top of every notebook. Specifically, this button renumbers linearly all code cells."
30+
],
31+
"metadata": {}
32+
},
33+
{
34+
"cell_type": "markdown",
35+
"source": [
36+
"1. First, we are going to inject Javascript code directly in the notebook. This is useful for testing purposes, or if you don't want your changes to be permanent. The Javascript code will be loaded with that notebook only. To do this, we can just use the `%%javascript` cell magic."
37+
],
38+
"metadata": {}
39+
},
40+
{
41+
"collapsed": false,
42+
"metadata": {},
43+
"cell_type": "code",
44+
"outputs": [],
45+
"input": [
46+
"%%javascript\n",
47+
"// This function allows us to add buttons \n",
48+
"// to the notebook toolbar.\n",
49+
"IPython.toolbar.add_buttons_group([\n",
50+
"{\n",
51+
" // The button's label.\n",
52+
" 'label': 'renumber all code cells',\n",
53+
" \n",
54+
" // The button's icon.\n",
55+
" // See a list of Font-Awesome icons here:\n",
56+
" // http://fortawesome.github.io/Font-Awesome/icons/\n",
57+
" 'icon': 'icon-list-ol',\n",
58+
" \n",
59+
" // The callback function.\n",
60+
" 'callback': function () {\n",
61+
" \n",
62+
" // We retrieve the lists of all cells.\n",
63+
" var cells = IPython.notebook.get_cells();\n",
64+
" \n",
65+
" // We only keep the code cells.\n",
66+
" cells = cells.filter(function(c)\n",
67+
" {\n",
68+
" return c instanceof IPython.CodeCell; \n",
69+
" })\n",
70+
" \n",
71+
" // We set the input prompt of all code cells.\n",
72+
" for (var i = 0; i < cells.length; i++) {\n",
73+
" cells[i].set_input_prompt(i + 1);\n",
74+
" }\n",
75+
" }\n",
76+
"}]);"
77+
],
78+
"language": "python"
79+
},
80+
{
81+
"cell_type": "markdown",
82+
"source": [
83+
"Running this code cell adds a button in the toolbar. Clicking on this button automatically updates the prompt numbers of all code cells."
84+
],
85+
"metadata": {}
86+
},
87+
{
88+
"cell_type": "markdown",
89+
"source": [
90+
"2. To make these changes permanent, i.e. to add this button on every notebook open within the current profile, we can open the file `~/.ipython/profile_default/static/custom/custom.js` and add the following code:"
91+
],
92+
"metadata": {}
93+
},
94+
{
95+
"cell_type": "markdown",
96+
"source": [
97+
"```javascript\n",
98+
"$([IPython.events]).on('app_initialized.NotebookApp',\n",
99+
" function(){\n",
100+
"\n",
101+
" // Copy of the Javascript code above (step 1).\n",
102+
" IPython.toolbar.add_buttons_group([\n",
103+
" {\n",
104+
" // The button's label.\n",
105+
" 'label': 'renumber all code cells',\n",
106+
"\n",
107+
" // The button's icon.\n",
108+
" // See a list of Font-Awesome icons here:\n",
109+
" // http://fortawesome.github.io/Font-Awesome/icons/\n",
110+
" 'icon': 'icon-list-ol',\n",
111+
"\n",
112+
" // The callback function.\n",
113+
" 'callback': function () {\n",
114+
"\n",
115+
" // We retrieve the lists of all cells.\n",
116+
" var cells = IPython.notebook.get_cells();\n",
117+
"\n",
118+
" // We only keep the code cells.\n",
119+
" cells = cells.filter(function(c)\n",
120+
" {\n",
121+
" return c instanceof IPython.CodeCell; \n",
122+
" })\n",
123+
"\n",
124+
" // We set the input prompt of all code cells.\n",
125+
" for (var i = 0; i < cells.length; i++) {\n",
126+
" cells[i].set_input_prompt(i + 1);\n",
127+
" }\n",
128+
" }\n",
129+
" }]);\n",
130+
"});\n",
131+
"```"
132+
],
133+
"metadata": {}
134+
},
135+
{
136+
"cell_type": "markdown",
137+
"source": [
138+
"The code put here will be automatically loaded as soon as a notebook page is loaded."
139+
],
140+
"metadata": {}
141+
},
142+
{
143+
"cell_type": "markdown",
144+
"source": [
145+
"> You'll find all the explanations, figures, references, and much more in the book (to be released later this summer).\n",
146+
"\n",
147+
"> [IPython Cookbook](http://ipython-books.github.io/), by [Cyrille Rossant](http://cyrille.rossant.net), Packt Publishing, 2014 (500 pages)."
148+
],
149+
"metadata": {}
150+
}
151+
]
152+
}
153+
]
154154
}

0 commit comments

Comments
 (0)