-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
254 lines (227 loc) · 9.15 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
<!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/[email protected]/dist/reveal.css">
<!-- Blood Reveal Theme Stylesheet -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/theme/blood.css" id="theme">
<!-- Custom stylesheet to make reveal work with our playgrounds -->
<link rel="stylesheet" href="sample-style.css">
<!-- 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");
css.innerHTML = "section { height: auto; }";
// Append the css to the head
document.head.appendChild(css);
}
</script>
<!-- Bundle containing the code playground web components -->
<script type="module" src="/src/exports/full.ts"></script>
</head>
<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">
<section>
<h3 class="title">Interactive Code Playgrounds</h3>
<p class="subtitle">Developed Code Editors</p>
<div>
<p><small>The code is available in <a href="https://github.com/lucademenego99/icp-bundle" target="_blank">this
github repository</a></small></p>
</div>
</section>
<section>
<h3 class="title">Introduction</h3>
<p>The following <span class="emph">web components</span> are exposed by the library</p>
<ul style="padding-bottom: 30px;">
<li><javascript-editor /></li>
<li><python-editor /></li>
<li><cpp-editor /></li>
<li><typescript-editor /></li>
<li><java-editor /></li>
<li><standardml-editor /></li>
<li><sql-editor /></li>
<li><p5-editor /></li>
<li><processing-editor /></li>
</ul>
</section>
<section>
<p class="subtitle"><javascript-editor /></p>
<div class="big-code">
<javascript-editor contenteditable="true" code="console.log('Hello World!')"></javascript-editor>
</div>
</section>
<section>
<p class="subtitle"><python-editor <span class="emph">theme</span>="dark" /></p>
<div class="big-code">
<python-editor contenteditable="true" theme="dark" code="# This program adds two numbers
num1 = 1.5
num2 = 6.3
sum = num1 + num2
print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))">
</python-editor>
</div>
</section>
<section>
<p class="subtitle"><cpp-editor <span class="emph">theme</span>="dark" /></p>
<div class="big-code">
<cpp-editor contenteditable="true" downloadable="true" id="cpp-example-dev" save="true" theme="dark" code='#include <iostream>
using namespace std;
int main() {
cout << "Hello World!" << endl;
return 0;
}'>
</cpp-editor>
</div>
</section>
<section>
<p class="subtitle"><typescript-editor <span class="emph">type</span>="vertical" /></p>
<div class="big-code">
<typescript-editor contenteditable="true" type="vertical" code="class Greeter {
greeting: string;
constructor(message: string) {
this.greeting = message;
}
greet() {
return 'Hello ' + this.greeting;
}
}
let greeter = new Greeter('World!');
greeter.greet();"></typescript-editor>
</div>
</section>
<section>
<p class="subtitle"><java-editor <span class="emph">theme</span>="dark" /></p>
<div class="big-code">
<java-editor contenteditable="true" theme="dark" code='public class HelloWorld {
public static void main(String[] args) {
System.out.println("<EDITABLE>Hello, World</EDITABLE>!");
}
}'></java-editor>
</div>
</section>
<section>
<p class="subtitle"><standardml-editor <span class="emph">theme</span>="dark" /></p>
<div class="big-code">
<standardml-editor contenteditable="true" theme="dark" code='fun fact n = if n = 0 then 1 else n * fact(n - 1);
fact 5;'></standardml-editor>
</div>
</section>
<section>
<p class="subtitle"><sql-editor <span class="emph">type</span>="vertical" /></p>
<div class="big-code">
<sql-editor contenteditable="true" type="vertical" code="DROP TABLE IF EXISTS employees;
-- Create the table
CREATE TABLE employees( id integer, name text,
designation text, manager integer,
hired_on date, salary integer,
commission float, dept integer);
-- Insert some data
INSERT INTO employees VALUES (1,'JOHNSON','ADMIN',6,'1990-12-17',18000,NULL,4);
INSERT INTO employees VALUES (2,'HARDING','MANAGER',9,'1998-02-02',52000,300,3);
INSERT INTO employees VALUES (3,'TAFT','SALES I',2,'1996-01-02',25000,500,3);
INSERT INTO employees VALUES (4,'HOOVER','SALES I',2,'1990-04-02',27000,NULL,3);
INSERT INTO employees VALUES (5,'LINCOLN','TECH',6,'1994-06-23',22500,1400,4);
INSERT INTO employees VALUES (6,'GARFIELD','MANAGER',9,'1993-05-01',54000,NULL,4);
INSERT INTO employees VALUES (7,'POLK','TECH',6,'1997-09-22',25000,NULL,4);
INSERT INTO employees VALUES (8,'GRANT','ENGINEER',10,'1997-03-30',32000,NULL,2);
INSERT INTO employees VALUES (9,'JACKSON','CEO',NULL,'1990-01-01',75000,NULL,4);
INSERT INTO employees VALUES (10,'FILLMORE','MANAGER',9,'1994-08-09',56000,NULL,2);
INSERT INTO employees VALUES (11,'ADAMS','ENGINEER',10,'1996-03-15',34000,NULL,2);
INSERT INTO employees VALUES (12,'WASHINGTON','ADMIN',6,'1998-04-16',18000,NULL,4);
INSERT INTO employees VALUES (13,'MONROE','ENGINEER',10,'2000-12-03',30000,NULL,2);
INSERT INTO employees VALUES (14,'ROOSEVELT','CPA',9,'1995-10-12',35000,NULL,1);
-- Select
SELECT designation,COUNT(*) AS nbr, (AVG(salary)) AS avg_salary FROM employees GROUP BY designation ORDER BY avg_salary DESC;
SELECT name,hired_on FROM employees ORDER BY hired_on;"></sql-editor>
</div>
</section>
<section>
<p class="subtitle"><p5-editor <span class="emph">type</span>="vertical" /></p>
<div class="big-code">
<p5-editor contenteditable="true" type="vertical" code="function setup() {
createCanvas(400, 400);
}
function draw() {
if (mouseIsPressed) {
fill(0);
} else {
fill(255);
}
ellipse(mouseX, mouseY, 80, 80);
}"></p5-editor>
</div>
</section>
<section>
<p class="subtitle"><processing-editor <span class="emph">type</span>="vertical" /></p>
<div class="big-code">
<processing-editor contenteditable="true" type="vertical" code="float xoff = 0.0;
float xincrement = 0.01;
void setup() {
size(640, 360);
background(0);
noStroke();
}
void draw() {
// Create an alpha blended background
fill(0, 10);
rect(0,0,width,height);
//float n = random(0,width); // Try this line instead of noise
// Get a noise value based on xoff and scale it according to the window's width
float n = noise(xoff)*width;
// With each cycle, increment xoff
xoff += xincrement;
// Draw the ellipse at the value produced by perlin noise
fill(200);
ellipse(n,height/2, 64, 64);
}"></processing-editor>
</div>
</section>
</div>
</div>
<!-- Import the main reveal script -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/reveal.js"></script>
<!-- Initialize reveal -->
<script>
Reveal.initialize({
// 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,
// Set the width of the slides
width: "90%",
// Set the height of the slides
height: "90%",
// 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: 'slide',
// IMPORTANT: disable the default layout (centering and scaling) to make the code editors work correctly
disableLayout: true
});
</script>
</body>
</html>