-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathslide.html
More file actions
406 lines (348 loc) · 12.1 KB
/
Copy pathslide.html
File metadata and controls
406 lines (348 loc) · 12.1 KB
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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
slidez
</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="slide.css" rel="stylesheet" />
<script src="slide.js" ></script>
</head>
<body>
<div class="content" id="content">
<div class="slide visible-slide">
<h1 style="font-size: 64px; margin-top: 120px">
Two Problems
</h1>
<h2>
Regular Expressions for Revolutionaries
</h2>
</div>
<div class="slide" style="font-size: 24px;">
<h3 class="white-text" style="margin-top: 20vh;">
Who's talking?
</h3>
<h2 style-"font-size: 48px;">
Sarah Saltrick Meyer
</h2>
<h4>
Twitter: @meyerini
<span style="font-size: 36px;">
💁
</span>
</h4>
<h4>
BuzzFeed
</h4>
</div>
<div class="slide">
<h2 style="margin-top: 120px">
Some people, when confronted with a problem, think,
</h2>
<h1 style="font-size: 64px; margin-top: 120px">
“I know, I'll use regular expressions.”
</h1>
<h2 style="margin-top: 120px">
Now they have two problems.
</h2>
<p class="quote-author">
The person sitting next to you at your first job
</p>
</div>
<div class="slide">
<h2 style="margin-top: 120px">
Some people, when confronted with a problem, think,
</h2>
<h1 style="font-size: 64px; margin-top: 120px">
“I know, I'll use regular expressions.”
</h1>
<h2 style="margin-top: 120px">
Now they have two problems.
</h2>
<p class="quote-author">
Jamie Zawinski, 1997
</p>
</div>
<div class="slide">
<div class="code">
^(\([0-9]{3}\) |[0-9]{3}-)[0-9]{3}-[0-9]{4}$
</div>
</div>
<div class="slide">
<div class="code">
^(\([0-9]{3}\) |[0-9]{3}-)[0-9]{3}-[0-9]{4}$
</div>
<div class="emoji">
💩
</div>
</div>
<div class="slide">
<h2 style="margin-top: 120px">
But that's not all that regular expressions can do.
</h2>
</div>
<div class="slide" style="background-image: url('images/structure_of_a_comment.png'); background-size: 85%; background-position: center;">
</div>
<div class="slide" style="background-image: url('images/structure_of_a_comment.png'); background-size: 85%; background-position: center;">
<div class="emoji">
🤔
</div>
</div>
<!-- w whitespace -->
<div class="slide">
<div class="code">
\s( |\t|(\/(\/.*[\r\n])|(\*((\/*[^\/\*]+)|(\/*\**[^\/\*])*\/))))?
</div>
</div>
<div class="slide">
<h2 style="margin-top: 120px">
Regular expressions were defined as regular sets by Stephen Cole Kleene in the 1950s.
</h2>
</div>
<div class="slide">
<h2 style="margin-top: 120px">
Regular expressions were defined as regular sets by Stephen Cole Kleene in the 1950s.
</h2>
<div class="code" style="font-size: 64px;">
*.js
</div>
</div>
<div class="slide">
<h2 style="margin-top: 120px">
Regular expressions were defined as regular sets by Stephen Cole Kleene in the 1950s.
</h2>
<div class="code" style="font-size: 64px;">
*.js
</div>
<div class="emoji">
😍
</div>
</div>
<div class="slide" >
<div style="text-align: left; width: 800px; margin-right: auto; margin-left: auto; font-size: 48px;">
<h3>
What makes a regular expression?
</h3>
<ol style="text-align: left;">
<li>Boolean “or”:
<span class="inline-code">
a|b
</span>
</li>
<li>
Grouping:
<span class="inline-code">
abcd|axyd
</span>
~
<span class="inline-code">
a(bc|xy)d
</span>
</li>
<li>
Quantification:
<span class="inline-code">
a?
</span>
<span class="inline-code">
a*
</span>
<span class="inline-code">
a+
</span>
</li>
</ol>
</div>
</div>
<div class="slide" >
<div style="text-align: left; width: 800px; margin-right: auto; margin-left: auto; font-size: 48px;">
<h3>
What makes a regular expression?
</h3>
<ol style="text-align: left;">
<li>Boolean “or”:
<span class="inline-code">
a|b
</span>
</li>
<li>
Grouping:
<span class="inline-code">
abcd|axyd
</span>
~
<span class="inline-code">
a(bc|xy)d
</span>
</li>
<li>
Quantification:
<span class="inline-code">
a?
</span>
<span class="inline-code">
a*
</span>
<span class="inline-code">
a+
</span>
</li>
</ol>
</div>
<div class="emoji">
👍
</div>
</div>
<div class="slide" style="background-image: url('images/Noam_Chomsky_Toronto_2011.jpg'); background-size: cover; background-position: center;">
</div>
<div class="slide" style="background-color: white; background-image: url('images/714px-Chomsky-hierarchy.svg.png'); background-size: 75%; background-position: center; background-repeat: no-repeat;">
<p class="quote-author">
image credit J. Finkelstein
</p>
</div>
<div class="slide">
<h2 style="margin-top: 120px">
Type-0 grammars (unrestricted grammars) ~ Turing machine
</h2>
</div>
<div class="slide" style="background-image: url('images/lego_turing_machine.jpg'); background-size: cover; background-position: center;">
</div>
<div class="slide" style="background-image: url('images/lego_turing_machine.jpg'); background-size: cover; background-position: center;">
<p style="font-style: italic;">
...an unlimited memory capacity obtained in the form of an infinite tape marked out into squares, on each of which a symbol could be printed. At any moment there is one symbol in the machine; it is called the scanned symbol. The machine can alter the scanned symbol, and its behavior is in part determined by that symbol, but the symbols on the tape elsewhere do not affect the behavior of the machine. However, the tape can be moved back and forth through the machine, this being one of the elementary operations of the machine. Any symbol on the tape may therefore eventually have an innings.
</p>
<p class="quote-author">
Alan Turing
</p>
</div>
<div class="slide" style="background-image: url('images/Dr-Alan-Turing-2956483.jpg'); background-size: cover; background-position: center;">
<h2 style="margin-top: 120px">
Alan Turing died for not fitting a pattern, though.
</h2>
<div class="emoji">
😰
</div>
</div>
<div class="slide">
<h2 style="margin-top: 120px">
Type-1 grammars (context-sensitive grammars) generate the context-sensitive languages.
</h2>
<img style="max-width: 100%;" src="images/type-1.png">
</div>
<div class="slide">
<h2 style="margin-top: 120px">
Type-1 grammars (context-sensitive grammars) generate the context-sensitive languages.
</h2>
<img style="max-width: 100%;" src="images/type-1.png">
<div class="emoji">
😐
</div>
</div>
<div class="slide">
<h2 style="margin-top: 120px">
Type-2 grammars (context-free grammars) generate the context-free languages
</h2>
<img style="max-width: 100%;" src="images/type-2.png">
</div>
<div class="slide">
<h2 style="margin-top: 120px">
Type-2 have something very important: a stack!
</h2>
<img style="max-width: 100%; padding: 10px; background-color: white;" src="images/pushdown_automaton.png">
</div>
<div class="slide">
<h2 style="margin-top: 120px">
Type-3 grammars Regular expressions ~ finite state automaton
</h2>
</div>
<div class="slide" style="background-image: url('images/turnstiles.jpg'); background-size: cover; background-position: center;">
</div>
<div class="slide" style="background-image: url('images/turnstile_fsm.png'); background-size: contain; background-color: white; background-position: center;">
<div class="quote-author" style="position: absolute; bottom: 100px; right: 100px;">
image credit Wikipedia contributor Chetvorno
</div>
</div>
<div class="slide">
<h2 style="margin-top: 120px">
“You can’t parse HTML with a regular expression.”
</h2>
</div>
<div class="slide">
<h2 style="margin-top: 120px; margin-left: 200px; margin-right: 200px;">
A "regex" or "regexp" is not a regular expression!
</h2>
</div>
<div class="slide">
<p style="font-style: italic;">
"Regular expressions" […] are only marginally related to real regular expressions. Nevertheless, the term has grown with the capabilities of our pattern matching engines, so I'm not going to try to fight linguistic necessity here. I will, however, generally call them "regexes" (or "regexen", when I'm in an Anglo-Saxon mood).
</p>
<p class="quote-author">
Larry Wall
</p>
</div>
<div class="slide">
<h2 style="margin-top: 120px">
What's the difference, really?
</h2>
<h3> A deterministic finite automaton (equivalent to regular expressions) meets the following criteria:</h3>
<ul style="list-style: none; font-size: 24px;">
<li> each of its transitions is uniquely determined by its source state and input symbol, and </li>
<li>reading an input symbol is required for each state transition.</li>
</ul>
<h3> A "regex" does not.</h3>
</div>
<div class="slide">
<h2 style="margin-top: 120px">
A regex only has its state. A Turing machine has memory.
</h2>
</div>
<div class="slide">
<div class="code">
var re = /ab+c/;
</div>
<p>
For a value that will not change.
</p>
<div class="code">
var re = new RegExp("ab+c");
</div>
<p>
These are evaluated at runtime.
</p>
<p class="quote-author">
Mozilla Developer's Network
</p>
</div>
<div class="slide">
<h2>
Cool things you could do with regular expressions
</h2>
<ul style="list-style: none; font-size: 24px;">
<li>
Validate application state
</li>
<li>
Write a game
</li>
<li>
Make web art
</li>
<li>
Write a chat bot
</li>
<li>
Learn more!
</li>
</ul>
</div>
<div class="slide">
<h1 style="font-size: 64px; margin-left: 60px;">
Thanks for listening!
</h1>
<img style="max-width: 100%; width: 300px;" src="images/bad_sith_do_it_well.jpg">
<h2> <span style="color: yellow"> @meyerini </span> </h2>
</div>
</div>
</body>
</html>