-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
325 lines (282 loc) · 13.1 KB
/
index.html
File metadata and controls
325 lines (282 loc) · 13.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Web Dev Crash Course</title>
<meta name="description" content="A framework for easily creating beautiful presentations using HTML">
<meta name="author" content="Sal Testa, Andrew Capshaw">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<link rel="stylesheet" href="css/reveal.min.css">
<link rel="stylesheet" href="css/theme/sky.css" id="theme">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- If the query includes 'print-pdf', use the PDF print sheet -->
<script>
document.write( '<link rel="stylesheet" href="css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<section>
<h1>Web Dev</h1>
<h3>Coding for the Interwebs</h3>
<p>
<small>Created by <a href="http://saltesta.com">Sal Testa</a> and <a href="http://capshaw.me">Andrew Capshaw</a></small>
</p>
</section>
<section>
<h2>What this covers</h2>
<ul>
<li class='fragment'><strong>HTML</strong> for content</li>
<li class='fragment'><strong>CSS</strong> for styling</li>
<li class='fragment'><strong>Javascript</strong> for scripting</li>
<li class='fragment'><strong>PHP</strong> for backend</li>
</ul>
</section>
</section>
<!-- ====================================================== -->
<!-- <section data-state="soothe"> -->
<section>
<section>
<h1>HTML5</h1>
<h3>Defines Structure</h3>
</section>
<section>
<h3>Very Simple Site</h3>
<pre><code class="xml"><span class="doctype"><!DOCTYPE html></span>
<span class="tag"><html></span>
<span class="tag"><head></span>
<span class="tag"><title></span>HackRice 2013 Project<span class="tag"></title></span>
<span class="tag"></head></span>
<span class="tag"><body></span>
<span class="tag"><h1></span>Hello, world!<span class="tag"></h1></span>
<span class="tag"></body></span>
<span class="tag"></html></span>
</code></pre>
</section>
<section>
<h3>Including CSS and Javascript</h3>
<pre><code class="xml"><span class="doctype"><!DOCTYPE html></span>
<span class="tag"><html></span>
<span class="tag"><head></span>
<span class="tag"><title></span>HackRice 2013 Project<span class="tag"></title></span>
...
<span class="tag"><link href="css/bootstrap.css" rel="stylesheet"></span>
<span class="tag"></head></span>
<span class="tag"><body></span>
...
<span class="tag"><script src="http://code.jquery.com/jquery.js"></span><span class="tag"></script></span>
<span class="tag"><script src="js/bootstrap.js"></span><span class="tag"></script></span>
<span class="tag"></body></span>
<span class="tag"></html></span>
</code></pre>
<h6>Later listings take precedence</h6>
</section>
<section>
<h3>#id and .class</h3>
<pre><code class="xml"><span class="tag"><div id="welcome-text"></span>Welcome!<span class="tag"></div></span>
<span class="tag"><div class="container"></span>
<span class="tag"><button class="button button-red" id="cancel"></span>No<span class="tag"></button></span>
<span class="tag"><button class="button button-blue" id="accept"></span>Yes<span class="tag"></button></span>
<span class="tag"><button class="button button-yellow" id="not-sure"></span>Maybe<span class="tag"></button></span>
<span class="tag"></div></span>
</code></pre>
Ids and classes are used by css and javascript to reference specific indvidual or groups of elements.
</section>
</section>
<!-- ====================================================== -->
<section>
<section>
<h1>CSS3</h1>
<h3>Provides Style</h3>
</section>
<section>
<h2>Tag types</h2>
<pre><code class="css"><span class="tag">body</span> <span class="rules">{<span class="rule"><span class="attribute">width</span>:<span class="value"> <span class="number">500</span>px;</span></span><span class="rule">}</span></span>
<span class="tag">.tag-class</span> <span class="rules">{<span class="rule">
<span class="attribute">padding</span>:<span class="value"> <span class="number">20</span>px <span class="number">40</span>px;</span>
<span class="attribute">width</span>:<span class="value"> <span class="number">auto</span>;</span></span>
<span class="rule">}</span></span>
<span class="tag">#tag-id</span> <span class="rules">{<span class="rule">
<span class="attribute">height</span>:<span class="value"> <span class="number">100</span>px;</span>
<span class="attribute">float</span>:<span class="value"> <span class="number">left</span>;</span></span>
<span class="rule">}</span></span></code></pre>
Notice that "#" delimites an id and "." a class.
</section>
<section>
<h2>Spacing Tags</h2>
<img src="img/css_explanation.gif" title="Source: http://webdevelopmenttutorials.com/tutorialimage2.gif">
<pre><code class="css"><span class="tag">.tag-class</span> <span class="rules">{<span class="rule">
<span class="attribute">padding-top</span>:<span class="value"> <span class="number">40</span>px;</span>
<span class="attribute">width</span>:<span class="value"> <span class="number">auto</span>;</span></span>
<span class="rule">}</span></code></pre>
</section>
</section>
<!-- ====================================================== -->
<section data-state="soothe">
<section>
<h1>Javascript</h1>
<h3>Builds Functionality</h3>
</section>
<section>
<h2>Basic Javascript</h2>
<pre><code class="javascript">function biggest (numbers) {
var current = numbers[0];
for (var i = 0; i < numbers.length; i++) {
if (numbers[i] > current) {
current = numbers[i];
}
};
return current;
}</code></pre>
</section>
<section>
<h2>JQuery</h2>
<pre><code class="javascript">/* Run when the document is finished loading. */
$(document).ready(function() {
$("#messageButton").click(function() {
var name = $("#name").val();
alert("Hello "+name+", it's nice to meet you!");
}
});</code></pre>
</section>
<section>
<h2>AJAX via JQuery</h2>
<pre><code class="javascript">function storeName(userName) {
$.ajax({
url:'./process_name.php', // destination
type:'POST', // sending via POST or GET
data: {
'name':userName
}
});
}
</code></pre>
</section>
<section>
<h2>AJAX with Response</h2>
<pre><code class="javascript">function storeName(userName) {
$.ajax({
url:'./process_name.php',
type:'POST',
data: {
'name':userName
}
}).done(function(data){
var response = JSON.parse(data); // makes a map out of the data
if(response['status'] == 'success') {
alert("Everything is dandy!");
} else {
alert("Today is a dark day indeed!");
}
});
}
</code></pre>
</section>
</section>
<!-- ====================================================== -->
<section>
<section>
<h1>PHP</h1>
<h3>Move Data</h3>
</section>
<section data-state="blackout">
<h2>Suggested Tools</h2>
<a href="www.wampserver.com/en/" class="image"><img src="img/wamp.png"></a>
<a href="http://www.lamphowto.com/" class="image"><img src="img/lamp.jpg"></a>
<a href="http://www.mamp.info/en/index.html" class="image"><img src="img/mamp.png"></a>
</section>
<section>
<h2>Simple PHP function</h2>
<pre><code class="php"><?php
function biggest($numbers) {
$current = $numbers[0];
for ($i=0; $i < count($numbers); $i++) {
if(numbers[$i] > $current) {
$current = numbers[$i];
}
}
return $current;
}
?></code></pre>
</section>
<section>
<h2>Example Config File</h2>
<pre><code class="php"><?php /* config.php */
define( 'DB_HOST', 'localhost' );
define( 'DB_DATABASE', 'hackrice' );
define( 'DB_USER', 'root' );
define( 'DB_PASSWORD', 'password' );
?></code></pre>
<pre><code class="php"><?php /* other_thing.php */
require_once( 'config.php' );
...
?></code></pre>
</section>
<section>
<h2>Database Retrieval</h2>
<pre><code class="php"><?php
function get_user_by_id($uid) {
$DB = new mysqli( DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE );
$query = 'SELECT name FROM users WHERE uid = "'.$uid.'"';
$result = $DB->query($query);
$row = $result->fetch_assoc();
return $row['name'];
}
?></code></pre>
</section>
<section>
<h2>Database Insertion</h2>
<pre><code class="php"><?php
/* process_name.php */
$name = $_POST['name'];
$DB = new mysqli( DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE );
$query = 'INSERT INTO users VALUES "'.$name.'"';
$DB->query($query);
$response = array();
$response['status'] = 'success';
echo json_encode($response);
?></code></pre>
</section>
</section>
<!-- ====================================================== -->
<section>
<h3>Happy hacking this weekend!</h3>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.min.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
rollingLinks: false,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
// transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/zoom/linear/fade/none
transition: 'concave',
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
// { src: 'plugin/remotes/remotes.js', async: true, condition: function() { return !!document.body.classList; } }
]
});
</script>
</body>
</html>