-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
504 lines (436 loc) · 22 KB
/
index.html
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Interactive Code Playgrounds</title>
<!-- Main Reveal Stylesheet -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/reveal.js@4.1.0/dist/reveal.css">
<!-- Blood Reveal Theme Stylesheet -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/reveal.js@4.1.0/dist/theme/blood.css" id="theme">
<!-- Custom stylesheet to make reveal work with our playgrounds -->
<link rel="stylesheet" href="https://lucademenego99.github.io/icp-bundle/base/custom-style.css">
<!-- Bundle containing the code playground web components -->
<script src="https://lucademenego99.github.io/icp-bundle/base/full.iife.js"></script>
<style>
pre code {
padding: min(1vw, 2vh) !important;
}
.code {
padding: 0 min(1vw, 2vh);
background-color: rgb(215, 237, 255);
font-family: monospace;
}
.code-2 {
padding: 0 min(0.8vw, 1.5vh);
background-color: rgb(234, 246, 255);
font-family: monospace;
}
.error {
color: red;
}
.ok {
color: green;
}
.underline {
text-decoration: underline;
}
.warning {
color: rgb(218, 141, 0);
}
.bold {
font-weight: bold;
}
.row {
width: min(80vw, 160vh);
gap: min(1.5vw, 2.8vh);
}
.big {
font-size: min(2vw, 4vh) !important;
}
.xbig {
font-size: min(2.5vw, 5vh) !important;
}
.xxsmall {
font-size: min(0.9vw, 1.8vh);
}
.mt {
margin-top: min(1vw, 2vh) !important;
}
.ml {
margin-left: min(1vw, 2vh) !important;
}
.mt2 {
margin-top: min(3vw, 6vh) !important;
}
.mb {
margin-bottom: min(1vw, 2vh) !important;
}
.mb2 {
margin-bottom: min(3vw, 6vh) !important;
}
.ml {
margin-left: min(1vw, 2vh) !important;
}
.ml2 {
margin-left: min(3vw, 6vh) !important;
}
li {
margin-bottom: min(1vw, 1.8vh) !important;
}
.key__button {
box-sizing: border-box;
line-height: min(2vw, 4vh);
font-size: min(1.4vw, 2.8vh);
text-align: center;
color: #555;
cursor: pointer;
margin: 0 min(0.5vw, 1vh);
min-width: min(2.3vw, 4.6vh);
height: min(2.3vw, 4.6vh);
padding: 0 min(0.5vw, 1vh);
border-color: #f2f2f2;
border-style: solid;
text-shadow: 0 0.5px 1px #777, 0 2px 6px #f2f2f2;
border-width: 1px;
border-radius: 10px;
background: -webkit-linear-gradient(top, #f9f9f9 0%, #D2D2D2 80%, #c0c0c0 100%);
font-family: sans-serif;
display: inline-block;
transition: box-shadow 0.3s ease, transform 0.15s ease;
box-shadow: 0 0 1px #888, 0 1px 0 #fff, 0 6px 0 #C0C0C0, 0 8px 17px rgba(#444, 0.4), 2px 1px 4px rgba(#444, 0.25), -2px 1px 4px rgba(#444, 0.25), 0 9px 16px rgba(#444, 0.1);
}
</style>
</head>
<!-- For more information on reveal.js: https://revealjs.com/ -->
<body class="h-screen full-page-demo reveal-viewport" data-page="icp" style="transition: transform 0.8s ease 0s;">
<div class="reveal slide focused has-horizontal-slides ready" role="application" data-transition-speed="default"
data-background-transition="fade">
<div class="slides">
<!-- Each <section> is a slide -->
<section>
<!-- title class: custom style for titles -->
<h3 class="title">Interactive Code Playgrounds</h3>
<!-- subtitle class: custom style for subtitles -->
<p class="subtitle">Rethinking the user experience of slideshows in programming classes</p>
<div>
<p class="xsmall">An interactive demo of the <a href="https://github.com/lucademenego99/icp-bundle"
target="_blank">Interactive Code
Playgrounds</a> project</p>
<div class="row mt2" style="gap: min(0.6vw, 1.2vh); align-items: center">
<p class="xsmall bold">Recommended browser:</p>
<a href="https://www.google.com/intl/it_it/chrome/" target="_blank" style="display: flex;">
<svg xmlns="http://www.w3.org/2000/svg"
style="width: min(1.5vw, 3vh); height: min(1.5vw, 3vh);" viewBox="0 0 190.5 190.5"
xmlns:v="https://vecta.io/nano">
<g transform="translate(90.669 -507.469)">
<path
d="M4.583 650.342c26.304 0 47.627-21.324 47.627-47.628s-21.323-47.628-47.627-47.628-47.627 21.324-47.627 47.628 21.323 47.628 47.627 47.628z"
fill="#fff" clip-path="none" mask="none" />
<path
d="M-36.664 626.539l-41.24-71.43c-8.362 14.479-12.765 30.904-12.765 47.625s4.401 33.146 12.762 47.625 20.387 26.503 34.868 34.86 30.908 12.755 47.628 12.75l41.24-71.43v-.011c-4.177 7.244-10.188 13.26-17.428 17.443a47.62 47.62 0 0 1-47.632.007 47.62 47.62 0 0 1-17.433-17.437z"
fill="#229342" clip-path="none" mask="none" />
<path
d="M45.826 626.536l-41.239 71.43c16.72.003 33.146-4.398 47.626-12.757s26.504-20.384 34.863-34.865a95.24 95.24 0 0 0 12.755-47.627c-.003-16.72-4.408-33.145-12.772-47.623H4.58l-.01.007a47.62 47.62 0 0 1 23.819 6.372c7.243 4.179 13.257 10.19 17.439 17.431a47.62 47.62 0 0 1-.001 47.633z"
fill="#fbc116" clip-path="none" mask="none" />
<path
d="M4.583 640.43c20.824 0 37.705-16.881 37.705-37.706s-16.881-37.705-37.705-37.705-37.705 16.881-37.705 37.705 16.881 37.706 37.705 37.706z"
fill="#1a73e8" clip-path="none" mask="none" />
<path
d="M4.583 555.097h82.479c-8.358-14.481-20.381-26.507-34.861-34.868a95.23 95.23 0 0 0-47.625-12.76c-16.72.001-33.145 4.404-47.623 12.767a95.23 95.23 0 0 0-34.856 34.872l41.24 71.43.011.006a47.62 47.62 0 0 1-.015-47.633c4.179-7.242 10.193-13.256 17.434-17.436s15.456-6.381 23.818-6.379z"
fill="#e33b2e" clip-path="none" mask="none" />
</g>
</svg>
</a>
</div>
</div>
</section>
<section>
<h5>Learning to code isn't easy.</h5>
<p class="fragment">Especially if you're a beginner.</p>
</section>
<section>
<p>Your university probably teaches programming through a lab course.</p>
</section>
<section>
<p>One of the first steps in lab courses is to make students install a coding environment.</p>
<p class="fragment">Without the coding environment, you can't start coding.</p>
<p class="fragment">Often, the installation is quite complex.</p>
</section>
<section>
<p>Starting out should be simpler.</p>
</section>
<section>
<p>We want to propose a solution <br />
that rethinks one of the staples of programming classes.</p>
</section>
<section>
<p>The humble slide deck.</p>
</section>
<section>
<section>
<div class="row">
<div class="col">
<p>A typical slide in a programming class looks like this.</p>
<p>Go down to analyse some of the issues this creates, or go right to continue.</p>
</div>
<img src="assets/codeSample.png"
style="max-width: 50%; object-fit: contain; max-height: 80vh; margin: min(1vw, 2vh);" />
</div>
</section>
<section>
<div class="row">
<div class="col">
<ul style="list-style-type: none;">
<li>The code to your right is an image.</li>
<li class="fragment">You can't select text from it.</li>
<li class="fragment">Even when you can, if it's on a PDF file, it often doesn't select
properly.</li>
<li class="fragment">If you try copying and pasting from it, the output might be,
frankly, garbage.</li>
<li class="fragment">Also, as a teacher, if you need to change something, you need to
re-make the image.</li>
<li class="fragment">To make matters worse, there is also a problem of <span
class="emph">accessibility</span>: <br />
an image is hardly usable for a screen reader user.</li>
<li class="fragment">And finally, even when you can see them, images often render ugly!
Look at those compression artifacts!</li>
</ul>
</div>
<img src="assets/codeSample.png"
style="max-width: 50%; object-fit: contain; max-height: 80vh; margin: min(1vw, 2vh);" />
</div>
</section>
</section>
<section>
<div class="row">
<div class="col">
<ul style="list-style-type: none;">
<li>But the biggest problem is this:</li>
<li class="fragment">Are you studying, and curious to know what this bit of code does?</li>
</ul>
<div class="fragment">
<h4>Tough <span class="fragment">luck.</span></h4>
</div>
</div>
<img src="assets/codeSample.png"
style="max-width: 50%; object-fit: contain; max-height: 80vh; margin: min(1vw, 2vh);" />
</div>
</section>
<section>
<section>
<p class="big">Okay, that was maybe a bit excessive.</p>
<p>You can actually do that, but it'll take jumping through a few hoops. <br />
Find out by going down, or just skip ahead to the right.</p>
</section>
<section>
<p>
Alright, there was some interesting code on that slide! <br />
Let's assume you want to run a bit of Python code...
</p>
</section>
<section>
<p>
You'll just need to...
</p>
</section>
<section>
<p>Open the Python interpreter</p>
<p class="fragment">Open a text editor</p>
<p class="fragment">Select the code on the slide (if you can!)</p>
<p class="fragment">Copy and paste it in the text editor (or transcribe it manually!)</p>
<p class="fragment">Check for copy/paste mistakes</p>
<p class="fragment">Run the code in the interpreter</p>
<p class="fragment">Whew!</p>
</section>
<section>
<p>Can't we do better?</p>
</section>
</section>
<section>
<!-- row class: custom class to set up a two-columns layout - you need to use row + two columns -->
<div class="row" style="width: 100%">
<!-- col class: first column of the row defined before -->
<div class="col" style="text-align: left; margin-left: min(2vw, 4vh)">
<p class="fragment semi-fade-out big" data-fragment-index="1">What if code on slides could look
like...</p>
<div class="fragment" data-fragment-index="2">
<h4>this?</h4>
</div>
<p class="fragment" data-fragment-index="4">Go ahead and try clicking that "Run Code!" button.
</p>
<p class="fragment" data-fragment-index="5">Did you see what happened in the "Output" box?</p>
<p class="fragment" data-fragment-index="6">The code was run <span class="emph">directly on the
slide</span>!</p>
<p class="fragment" data-fragment-index="7">What's more, you can edit the code directly in the
text box!</p>
<p class="fragment" data-fragment-index="8">Why don't you make some changes, run the code again,
and see what happens?</p>
<p class="fragment" data-fragment-index="9">Move on when you're done playing.</p>
</div>
<!-- col class: second column of the row defined before -->
<!-- Note: the editor takes the size of the parent, so it must be specified -->
<!-- in this case the parent is 100% width, 60vh height -->
<div class="col fragment" data-fragment-index="2"
style="height: min(30vw, 60vh); margin: min(1vw, 2vh)">
<!-- Normal editor, set the language and the code inside it -->
<!-- to create editable parts, just use <EDITABLE>...</EDITABLE> -->
<!-- for more info: https://github.com/lucademenego99/icp-bundle -->
<!-- Note: for reveal.js to work we need to set content editable to true -->
<python-editor contenteditable="true" theme="dark" code="elements = [39,12,18,85,72,10,2,18]
print('Unsorted list is\n', elements)
# Sort the list (with bubblesort)
for n in range(len(elements)-1, 0, -1):
for i in range(n):
if elements[i] > elements[i+1]:
elements[i], elements[i+1] = elements[i+1], elements[i]
print('\nSorted list is\n', elements)" />
</div>
</section>
<section>
<p class="big">
You just saw what we call an <span class="emph">Interactive Code Playground</span> (or ICP for
short).<br />
And there's more they can do...
</p>
</section>
<section>
<div class="row" style="width: 100%">
<div class="col">
<p>You can restrict the editable parts of the code. It may be useful for guided exercises!</p>
</div>
<div class="col" style="height: min(30vw, 60vh); margin: min(1vw, 2vh)">
<python-editor contenteditable="true" type="vertical" theme="dark"
code="print('Hello, <EDITABLE>world</EDITABLE>!')" />
</div>
</section>
<section>
<div class="row" style="width: 100%">
<div class="col">
<p style="margin-bottom: min(1vw, 2vh)">Clicking on the settings, you can find buttons to:</p>
<ul>
<li>copy the code snippet</li>
<li>cancel all your changes</li>
<li>enable the 'tabs' handling in the editor</li>
</ul>
</div>
<div class="col" style="height: min(30vw, 60vh); margin: min(1vw, 2vh)">
<python-editor contenteditable="true" type="vertical" code="print('Hello, world!')" />
</div>
</section>
<section>
<div class="row" style="width: 100%">
<div class="col">
<p style="margin-bottom: min(1vw, 2vh)">ICP is compatible with other languages!</p>
<ul>
<li>Javascript</li>
<li>Typescript</li>
<li>Python</li>
<li>Java</li>
<li>C/C++</li>
<li>SQL</li>
<li>Standard-ML</li>
<li>p5.js</li>
<li>Processing</li>
</ul>
<p>On the right, for instance, you can execute some Java code!</p>
</div>
<div class="col" style="height: min(30vw, 60vh); margin: min(1vw, 2vh)">
<java-editor contenteditable="true" theme="dark" id='test' code='public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}' />
</div>
</section>
<section>
<p>We hope the ICPs can make learning to code more *creative*, and based on *fast tinkering*.</p>
<p class="fragment">Thanks for following this demo.</p>
</section>
<!-- <section>
And how did we do this? This is a very simple, "tape-and-glue", MVP.
</section>
<section>
Illustrate here the tech stack, vertically, or allow skipping right.
</section>
<section>
One day, we would like to simplify this quite a bit, but this is promising for a quick prototype!
For now, we can make use of all the nice features that you might expect from the components we used.
</section>
<section>
And this is all front-end code! Which means this works even if you are offline (encourage to try).
Or, more realistically, this means you can integrate ICPs in pretty much any LMS or platform without
installing complex components.
</section>
<section>
But since we want these to replace slides, you can also download them as a single file.
</section>
<section>
Pedagogical implications
</section>
<section>
Accessibility implications
</section>
<section>
(Edtech) policy implications
</section>
<section>
Who are we?
</section> -->
</div>
</div>
<!-- Import the main reveal script -->
<script src=" https://cdn.jsdelivr.net/npm/reveal.js@4.1.0/dist/reveal.js">
</script>
<!-- Initialize reveal -->
<script>
Reveal.initialize({
// Display an help overlay when ? is pressed
help: false,
// Display controls in the bottom right corner
controls: true,
// Display a presentation progress bar
progress: true,
// Push each slide change to the browser history
history: true,
// Enable keyboard shortcuts for navigation
keyboard: true,
// Enable the slide overview mode
overview: true,
// Vertical centering of slides
center: true,
// Loop the presentation
loop: false,
// Enables touch navigation on devices with touch input
touch: true,
// Apply a 3D roll to links on hover
rollingLinks: true,
// Transition style for full page slide backgrounds
backgroundTransition: 'fade', // none/fade/slide/convex/concave/zoom
// Select a theme
theme: 'blood',
// Select the type of slides transition
transition: 'fade',
// IMPORTANT: disable the default layout (centering and scaling) to make the code editors work correctly
disableLayout: true
});
</script>
<!-- If the user asks for the pdf version, set section height to auto -->
<!-- Otherwise reveal.js breaks if the section height is set to 100% -->
<script>
if (window.location.href.indexOf('?print-pdf') > -1) {
// Create a new css element setting the height of .section to none
var css = document.createElement("style");
// Modify section height to fix the layout
// Modify .reveal .slides>section.stack pointer events, otherwise the code editors won't work
// Hide the slide context (the slide number)
css.innerHTML = "section { height: auto; } .reveal .slides>section.stack {pointer-events: all !important;} .slide-context {display: none;}";
// Append the css to the head
document.head.appendChild(css);
const printVersionText = document.getElementById('print-version-text');
printVersionText.innerHTML = `<a href="?">Clicca qui</a> per tornare alle slide`;
}
</script>
</body>
</html>