-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.nim
219 lines (178 loc) · 5.74 KB
/
index.nim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
import nimib, nimiSlides
template slideIframe*(url: string) =
nbRawHtml: "<section data-background-iframe=\"" & url & "\" data-background-interactive></section>"
template slideIframeFromNblog*(filename: string) =
slideIframe("https://nimib-land.github.io/nblog/drafts/" & filename & ".html")
template slideTitle =
slide:
nbText: "# [**NimibLand**]()\n## Literate Programming and Explorable Explanations"
speakerNote: """
- I have a talk proposal with more or less of this title which I am waiting to see if it will be accepted to be presented at FOSDEM
- This presentation is also accountability for the commitment I would like to have to focus on these stuff for the rest of the batch
"""
template slideLiterate =
slide:
nbText: """### [Literate Programming](https://en.wikipedia.org/wiki/Literate_programming)
Programming paradigm by Donald Knuth (1984)
<small>
a computer program is given as an explanation of how it works
in a natural language, such as English,
interspersed (embedded) with snippets of macros
and traditional source code,
from which compilable source code can be generated.
</small>
Inspired:
- Jupyter NoteBook
- Quarto (RMarkdown)
- Nbdev
- ...
- [Nimib]()
"""
speakerNote: """
- quote is from wikipedia. TODO: check original source
1. Weaving: Generating a comprehensive document about the program and its maintenance.
2. Tangling: Generating machine executable code
- Jupyter is more Interactive Computing
- N and B in Nimib come from NoteBook
- Nbdev closest to original literate programming
- Observable most important and not quoted
"""
template slideExplorable =
slide:
nbText: """### [Explorable Explanations]()
Essay by Bret Victor (2011)
<small>
"Explorable Explanations is my umbrella project for ideas
that enable and encourage truly active reading.
The goal is to change people's relationship with text.
People currently think of text as information to be consumed.
I want text to be used as an environment to think in."
</small>
See more at [explorabl.es](https://explorabl.es/)
**Goal**: make in [NimibLand]() better tools for explorable explanations.
"""
speakerNote: """
- NimibLand concretely is a github organization where me and Hugo are
moving Nimib related projects
- The funny part is we decided on the name NimibLand
before knowing about DynamicLand and MathLand
(which I discovered about them this week)
"""
template slideNimibAsLiterate =
slide:
slide:
nbText: "### Nimib as 'Literate Programming'"
nbFile("hello.nim"): """
import nimib
nbInit
nbText: "A sample program with _Nimib_"
nbCode:
echo "hello RC!"
nbSave
"""
nbText: "`nim r hello`"
speakerNote: """
"""
slideIframe("hello.html")
template slideNimibAsExplorable =
slide:
slide:
nbText: "### [🌱✨ Explorable Example with Nimib]()"
slideIframeFromNblog("plant_app")
template slideFirstTask =
slide:
nbText: "### **FIRST TASK**\n[Groviglio](): wrapper for [Tangle.js]() for Nimib"
speakerNote: """
- Tangle.js is a Javascript library by your very own Bret Victor for explorable explanations
- Discovered this week, does not seem very much known/used but looks like a good starting point
"""
template aChristmasTwist =
slide:
nbText: """
_something else happened during Christmas period..._
"""
template slideNimipPy =
slide:
slide:
nbText: """### [Nimib.py]()
"""
nbFile("hi.py"): """
import nimib as nb
nb.init()
nb.text("Welcome to `nimib.py`!")
message = "hello"
with nb.code():
print(message)
nb.save()
"""
nbText: "`python hi.py`"
speakerNote: """
Thanks to advent of code
"""
slideIframe("../../nimib.py/hi.html")
template slideEnterPyscript =
slide:
nbText: """### [Pyscript]()
- Python in the browser
- PyConUS 2022 (Peter Wang, Anaconda): "Python for the 99%"
- Started using Pyodide (Python in WASM): heavy asset (MBs), slow loading times (seconds)
- _recently_: added a **Micropython**🤯 backend: <200kb, <200ms
"""
speakerNote: """
- Born in Anaconda but run as a community project
- Creation of Fabio Pliger
"""
template slideNimipPyscript =
slide:
slide:
nbFile("bunny_meets_whaley.py"): """
import nimib as nb
nb.init(pyscript=True)
nb.text("## Bunny 🐰 meets Whaley 🐳!")
nb.text("Hello world example for pyscript with nimib.py.")
nb.html("<button id=\"click-me\">Click me! 🐰🐳</button><br/>")
nb.html("<div id=\"emoji-container\"></div>")
nb.text("This code adds functionality to the button (try block is a workaround):")
with nb.code(pyscript=True):
try:
from js import document
def handler(e):
output = document.createElement("span")
output.innerHTML = "🐳"
container = document.querySelector("div#emoji-container")
container.appendChild(output)
button = document.querySelector("button#click-me")
button.addEventListener("click", handler)
except ImportError:
print("running pyscript block not in js")
nb.save()
"""
nbText: "**TASK**: make it idiomatic"
speakerNote """
- context manager cannot avoid yielding
- will change to decorators
"""
slideIframe("../../nimib.py/bunny_meets_whaley.html")
template slideAboutNim =
slide:
nbText: """### THANKS FOR LISTENING 🙏
"""
speakerNote: """
"""
when isMainModule:
nbInit(theme = revealTheme)
setSlidesTheme(Simple)
when false:
discard
slideTitle
slideLiterate
slideNimibAsLiterate
slideExplorable
slideNimibAsExplorable
slideFirstTask
aChristmasTwist
slideNimipPy
slideEnterPyscript
slideNimipPyscript
slideAboutNim
nbSave