-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.html
283 lines (259 loc) · 7.6 KB
/
template.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
<!--
Google IO 2012 HTML5 Slide Template
Authors: Eric Bidelman <[email protected]>
Luke Mahé <[email protected]>
URL: https://code.google.com/p/io-2012-slides
-->
<!DOCTYPE html>
<html>
<head>
<title>PHP, U Craz</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<!--<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">-->
<!--<meta name="viewport" content="width=device-width, initial-scale=1.0">-->
<!--This one seems to work all the time, but really small on ipad-->
<!--<meta name="viewport" content="initial-scale=0.4">-->
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" media="all" href="theme/css/default.css">
<link rel="stylesheet" media="only screen and (max-device-width: 480px)" href="theme/css/phone.css">
<base target="_blank"> <!-- This amazingness opens all links in a new tab. -->
<script data-main="js/slides" src="js/require-1.0.8.min.js"></script>
</head>
<body style="opacity: 0">
<slides class="layout-widescreen">
<slide class="logoslide nobackground">
<article class="flexbox vcenter">
<span><img src="images/logo.png"></span>
</article>
</slide>
<slide class="title-slide segue nobackground">
<aside class="gdbar"><img src="images/logo_128.png"></aside>
<!-- The content of this hgroup is replaced programmatically through the slide_config.json. -->
<hgroup class="auto-fadein">
<h1 data-config-title><!-- populated from slide_config.json --></h1>
<h2 data-config-subtitle><!-- populated from slide_config.json --></h2>
<p data-config-presenter><!-- populated from slide_config.json --></p>
</hgroup>
</slide>
<slide>
<hgroup>
<h2>P.P.P. PHP</h2>
</hgroup>
<article>
<ol>
<li>PHP will treat undefined constants as bar word (but throws a notice)</li>
<li>You can silence everything (notices included) with @</li>
</ol>
<pre class="prettyprint larger" data-lang="php">
@print(hello);
@print(PHPはありえへん);</pre>
</article>
</slide>
<slide>
<hgroup>
<h2>PHP: Never Say NO</h2>
</hgroup>
<article>
<p>NO: Variables that start with a number</p>
<pre class="prettyprint larger" data-lang="php">
$1 = "fish";
var_dump($1);
// PHP Parse error: syntax error, unexpected
// T_LNUMBER, expecting T_VARIABLE
// or '$' in ...</pre>
</article>
</slide>
<slide>
<hgroup>
<h2>PHP: Never Say NO</h2>
</hgroup>
<article>
<p>YES: Variables that start with a number</p>
<pre class="prettyprint larger" data-lang="php">
// ${'a'} is same as $a,
${'1'} = 'wat';
var_dump(${'1'});
// string(3) "wat"</pre>
</article>
</slide>
<slide>
<hgroup>
<h2>Neither P in PHP is Parser</h2>
</hgroup>
<article>
<p>here are some <s>functions</s></p>
<pre class="prettyprint larger" data-lang="php">
list()
empty()
array()
isset()</pre>
</article>
</slide>
<slide>
<hgroup>
<h2>Neither P in PHP is Parser</h2>
</hgroup>
<article>
<p><em>These are handled in the parser</em></p>
<pre class="prettyprint medium" data-lang="php">
empty($var1 || $var2)
// Parse error: syntax error, unexpected
// T_BOOLEAN_OR, ...
</pre>
<pre class="prettyprint medium" data-lang="php">
$b = 'empty';
$b($a);
// Fatal error: Call to undefined function empty()</pre>
</article>
</slide>
<slide>
<hgroup>
<h2>Neither P in PHP is Parser</h2>
</hgroup>
<article>
<p>So they can't be defined as class methods</p>
<pre class="prettyprint medium" data-lang="php">
class SadPanda {
function list(){}
function empty(){}
function array(){}
function isset(){}
}
// all are parse errors</pre>
</article>
</slide>
<slide>
<hgroup>
<h2>Neither P in PHP is Parser</h2>
</hgroup>
<article>
<p>But can be called as class methods</p>
<pre class="prettyprint larger" data-lang="php">
$f = new NotSadPanda();
$f->list();
$f->empty();
$f->array();
$f->isset();
// are NOT parse errors</pre>
</article>
</slide>
<slide>
<hgroup>
<h2>Neither P in PHP is Parser</h2>
</hgroup>
<article>
<p>But can be called as class methods</p>
<pre class="prettyprint medium" data-lang="php">
class NotSadPanda {
function __call($method, $args) {
var_dump($method);
}
}</pre>
</article>
</slide>
<slide>
<hgroup>
<h2>PHP: Plz Haz Private?</h2>
</hgroup>
<article>
<p>OK, so Private is Private?</p>
<pre class="prettyprint medium" data-lang="php">
class Secure {
private $secret = 'wat';
}
$s = new Secure();
var_dump($s->secret); // NO</pre>
</article>
</slide>
<slide>
<hgroup>
<h2>PHP: Plz Haz Private?</h2>
</hgroup>
<article>
<p>Professional Hacks: PHP</p>
<pre class="prettyprint medium" data-lang="php">
class Secure {
private $secret = 'wat';
}
$s = new Secure();
$wat = (array) $s; // cast to array
var_dump($wat);
// array(1) { ["Securesecret"]=> string(3) "wat" }</pre>
</article>
</slide>
<slide>
<hgroup>
<h2>PHP: Plz Haz Private?</h2>
</hgroup>
<article>
<p>OK, how about Private methods?</p>
<pre class="prettyprint" data-lang="php">
class Secure {
private function get_password() { return 'hunter2'; }
}</pre>
<pre class="prettyprint medium" data-lang="php">
$s = new Secure();
$ref = new ReflectionClass(get_class($s));
$haha = $ref->getMethod('get_password');
$haha->setAccessible(true);
var_dump($haha->invoke($s));
// string(7) "hunter2"</pre>
</article>
</slide>
<slide>
<hgroup>
<h2>PHP Haz Pride</h2>
</hgroup>
<article>
<p>Add any of the following to a php powered server</p>
<pre class="medium">
?=PHPE9568F34-D428-11d2-A769-00AA001ACF42
?=PHPE9568F35-D428-11d2-A769-00AA001ACF42
?=PHPE9568F36-D428-11d2-A769-00AA001ACF42
?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000</pre>
</article>
</slide>
<slide>
<hgroup>
<h2>PHP Haz Pride</h2>
</hgroup>
<article>
<p>Examples</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Main_Page?=PHPE9568F36-D428-11d2-A769-00AA001ACF42">
http://en.wikipedia.org/wiki/Main_Page?=PHPE9568F36-D428-11d2-A769-00AA001ACF42</a></li>
<li><a href="http://www.colourlovers.com/?=PHPE9568F36-D428-11d2-A769-00AA001ACF42">
http://www.colourlovers.com/?=PHPE9568F36-D428-11d2-A769-00AA001ACF42</a></li>
<li><a href="http://digg.com/?=PHPE9568F36-D428-11d2-A769-00AA001ACF42">
http://digg.com/?=PHPE9568F36-D428-11d2-A769-00AA001ACF42</a></li>
<li><a href="http://ikayzo.com/about/?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000">
http://ikayzo.com/about/?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000</a></li>
<li><a href="http://www.tetrisonline.com/?=PHPE9568F35-D428-11d2-A769-00AA001ACF42">
http://www.tetrisonline.com/?=PHPE9568F35-D428-11d2-A769-00AA001ACF42</a></li>
</ul>
</article>
</slide>
<slide class="thank-you-slide segue nobackground">
<aside class="gdbar right"><img src="images/logo_128.png"></aside>
<article class="flexbox vleft auto-fadein">
<h2><Thank You!></h2>
<p>Friends don't let friends write bad parsers</p>
</article>
<p class="auto-fadein" data-config-contact>
<!-- populated from slide_config.json -->
</p>
</slide>
<slide class="logoslide dark nobackground">
<article class="flexbox vcenter">
<span><img src="images/logo.png"></span>
</article>
</slide>
<slide class="backdrop"></slide>
</slides>
<!--[if IE]>
<script src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
<script>CFInstall.check({mode: 'overlay'});</script>
<![endif]-->
</body>
</html>