Skip to content

Commit f9d7313

Browse files
committed
Adding more notebooks.
1 parent c611229 commit f9d7313

6 files changed

+904
-25
lines changed

notebooks/Custom Display Logic.ipynb

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@
5656
"collapsed": false,
5757
"input": [
5858
"from IPython.display import display\n",
59-
"from IPython.display import display_html, display_jpeg, display_png, display_svg, display_latex"
59+
"from IPython.display import (\n",
60+
" display_html, display_jpeg, display_png,\n",
61+
" display_javascript, display_svg, display_latex\n",
62+
")"
6063
],
6164
"language": "python",
6265
"metadata": {},
@@ -187,6 +190,16 @@
187190
"metadata": {},
188191
"outputs": []
189192
},
193+
{
194+
"cell_type": "code",
195+
"collapsed": false,
196+
"input": [
197+
"display_javascript(c)"
198+
],
199+
"language": "python",
200+
"metadata": {},
201+
"outputs": []
202+
},
190203
{
191204
"cell_type": "heading",
192205
"level": 2,

notebooks/Notebook Basics.ipynb

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
{
2+
"metadata": {
3+
"name": "Notebook Basics"
4+
},
5+
"nbformat": 3,
6+
"nbformat_minor": 0,
7+
"worksheets": [
8+
{
9+
"cells": [
10+
{
11+
"cell_type": "heading",
12+
"level": 1,
13+
"metadata": {},
14+
"source": [
15+
"IPython Notebook Basics"
16+
]
17+
},
18+
{
19+
"cell_type": "heading",
20+
"level": 2,
21+
"metadata": {},
22+
"source": [
23+
"Project directory"
24+
]
25+
},
26+
{
27+
"cell_type": "markdown",
28+
"metadata": {},
29+
"source": [
30+
"* IPython Notebooks are just files (`.ipynb`) on your file system\n",
31+
"* The Notebook server is aware of Notebooks in a single directory = Notebook directory\n",
32+
"* If you cd to that directory and type:\n",
33+
"\n",
34+
" ipython notebook\n",
35+
"\n",
36+
" you will see those notebooks in the dashboard"
37+
]
38+
},
39+
{
40+
"cell_type": "heading",
41+
"level": 2,
42+
"metadata": {},
43+
"source": [
44+
"Notebook files"
45+
]
46+
},
47+
{
48+
"cell_type": "markdown",
49+
"metadata": {},
50+
"source": [
51+
"Notebook files:\n",
52+
"\n",
53+
"* Are just that - files (`.ipynb`) on your file system\n",
54+
"* Contain JSON data"
55+
]
56+
},
57+
{
58+
"cell_type": "code",
59+
"collapsed": false,
60+
"input": [
61+
"from IPython.nbformat import current\n",
62+
"with open('Notebook Basics.ipynb') as f:\n",
63+
" nb = current.read(f, 'json')"
64+
],
65+
"language": "python",
66+
"metadata": {},
67+
"outputs": [],
68+
"prompt_number": 6
69+
},
70+
{
71+
"cell_type": "code",
72+
"collapsed": false,
73+
"input": [
74+
"nb.worksheets[0].cells[0:5]"
75+
],
76+
"language": "python",
77+
"metadata": {},
78+
"outputs": [
79+
{
80+
"output_type": "pyout",
81+
"prompt_number": 7,
82+
"text": [
83+
"[{u'cell_type': u'heading',\n",
84+
" u'level': 1,\n",
85+
" u'metadata': {},\n",
86+
" u'source': u'IPython Notebook Basics'},\n",
87+
" {u'cell_type': u'heading',\n",
88+
" u'level': 2,\n",
89+
" u'metadata': {},\n",
90+
" u'source': u'Project directory'},\n",
91+
" {u'cell_type': u'markdown',\n",
92+
" u'metadata': {},\n",
93+
" u'source': u'* IPython Notebooks are just files (`.ipynb`) on your file system\\n* The Notebook server is aware of Notebooks in a single directory = Notebook directory\\n* If you cd to that directory and type:\\n\\n ipython notebook\\n\\n you will see those notebooks in the dashboard'},\n",
94+
" {u'cell_type': u'heading',\n",
95+
" u'level': 2,\n",
96+
" u'metadata': {},\n",
97+
" u'source': u'Notebook files'},\n",
98+
" {u'cell_type': u'markdown',\n",
99+
" u'metadata': {},\n",
100+
" u'source': u'* Notebooks are just files (`.ipynb`) on your file system\\n* They are just JSON files'}]"
101+
]
102+
}
103+
],
104+
"prompt_number": 7
105+
},
106+
{
107+
"cell_type": "markdown",
108+
"metadata": {},
109+
"source": [
110+
"* Embed code, Markdown text, images, LaTeX\n",
111+
"* Are version control friendly - post your Notebooks on GitHub\n",
112+
"* Can be viewed online by anyone at http://nbviewer.ipython.org"
113+
]
114+
},
115+
{
116+
"cell_type": "markdown",
117+
"metadata": {},
118+
"source": [
119+
"IPython Notebooks can also be exported to `.py` files (see \"File:Download As\" menu item). You can tell the Notebook server to always save these `.py` files alongside the `.ipynb` files by starting the Notebook as:\n",
120+
"\n",
121+
" ipython notebook --script\n",
122+
"\n",
123+
"You can import Notebooks from the main Dashboard or simply by copying a Notebook into the Notebook directory."
124+
]
125+
},
126+
{
127+
"cell_type": "heading",
128+
"level": 3,
129+
"metadata": {},
130+
"source": [
131+
"Exercise"
132+
]
133+
},
134+
{
135+
"cell_type": "markdown",
136+
"metadata": {},
137+
"source": [
138+
"Find a Notebook on http://nbviewer.ipython.org and Download it. Then import it into your running Notebook server using the Dashboard."
139+
]
140+
},
141+
{
142+
"cell_type": "heading",
143+
"level": 2,
144+
"metadata": {},
145+
"source": [
146+
"Overview of the UI"
147+
]
148+
},
149+
{
150+
"cell_type": "markdown",
151+
"metadata": {},
152+
"source": [
153+
"* Dashboard\n",
154+
"* Notebook area and cells\n",
155+
"* Menu\n",
156+
"* Toolbar"
157+
]
158+
},
159+
{
160+
"cell_type": "heading",
161+
"level": 2,
162+
"metadata": {},
163+
"source": [
164+
"Cell types"
165+
]
166+
},
167+
{
168+
"cell_type": "markdown",
169+
"metadata": {},
170+
"source": [
171+
"* Code\n",
172+
"* Markdown\n",
173+
"* Raw text\n",
174+
"* Heading"
175+
]
176+
},
177+
{
178+
"cell_type": "heading",
179+
"level": 3,
180+
"metadata": {},
181+
"source": [
182+
"Exercise"
183+
]
184+
},
185+
{
186+
"cell_type": "markdown",
187+
"metadata": {},
188+
"source": [
189+
"Create a new Notebook that has at least one of each cell type. Practice the following cell operations:\n",
190+
"\n",
191+
"* Moving up/down\n",
192+
"* Cut/Copy/Paste\n",
193+
"* Merge/Split"
194+
]
195+
},
196+
{
197+
"cell_type": "heading",
198+
"level": 2,
199+
"metadata": {},
200+
"source": [
201+
"Keyboard shortcuts"
202+
]
203+
},
204+
{
205+
"cell_type": "markdown",
206+
"metadata": {},
207+
"source": [
208+
"* `Shift-Enter` to run a cell\n",
209+
"* `Ctrl-Enter` to run a cell in place\n",
210+
"* All other keyboard shortcuts have the form: `Ctrl-m ?`\n",
211+
"* Show all keyboard shortcuts using `Ctrl-m h`"
212+
]
213+
},
214+
{
215+
"cell_type": "heading",
216+
"level": 3,
217+
"metadata": {},
218+
"source": [
219+
"Exercise"
220+
]
221+
},
222+
{
223+
"cell_type": "markdown",
224+
"metadata": {},
225+
"source": [
226+
"Go back to that last Notebook and repeat some of those cell operations using keyboard shortcuts. Make sure you try inserting cells above and below the current one and moving cell up and down."
227+
]
228+
}
229+
],
230+
"metadata": {}
231+
}
232+
]
233+
}

0 commit comments

Comments
 (0)