forked from gdicbusjs/gdicbusjs.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
class6.html
398 lines (353 loc) · 16.1 KB
/
class6.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Class 6 ~ Javascript ~ Girl Develop IT</title>
<meta name="description" content="This is the official Girl Develop It Core Intro Javascript course. Material based on original material by Sara Chipps, Pamela Fox, Alexis Goldstein, Izzy Johnston and Leo Newball.
The course is meant to be taught in 4 two-hour sections. Each of the slides and practice files are customizable according to the needs of a given class or audience.">
<meta name="author" content="Girl Develop It">
<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="reveal/css/reveal.css">
<link rel="stylesheet" href="reveal/css/theme/gdidefault.css" id="theme">
<!-- For syntax highlighting -->
<!-- light editor<link rel="stylesheet" href="lib/css/light.css">-->
<!-- dark editor--><link rel="stylesheet" href="reveal/lib/css/dark.css">
<!-- If use the PDF print sheet so students can print slides-->
<link rel="stylesheet" href="reveal/css/print/pdf.css" type="text/css" media="print">
<!--[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">
<!-- Opening slide -->
<section>
<img src = "images/gdi_logo_badge.png">
<h3>Beginning Javascript</h3>
<h4>Class 6</h4>
</section>
<!-- Welcome-->
<section>
<h3>Welcome!</h3>
<div class = "left-align">
<p>Girl Develop It is here to provide affordable and accessible programs to learn software through mentorship and hands-on instruction.</p>
<p class ="green">Some "rules"</p>
<ul>
<li>We are here for you!</li>
<li>Every question is important</li>
<li>Help each other</li>
<li>Have fun</li>
</ul>
</div>
</section>
<section>
<h3>Warning</h3>
<div style ="font-size=1.2em" class = "yellow">
The following few slides have lots of acronyms and jargon.
</div>
<div>On behalf of developers everywhere, we apologize</div>
</section>
<!-- What is an API-->
<section>
<h3>What is an API?</h3>
<ul>
<li class = "fragment"><span class = "yellow">A</span>pplication <span class = "yellow">P</span>rogramming <span class = "yellow">I</span>nterface</li>
<li class = "fragment">Data structure and rules for accessing a web-based application</li>
<li class = "fragment">How we can access information from sites that are not our own (Twitter, Meetup, Facebook, Foursquare)</li>
</ul>
</section>
<section>
<h3>What is an API?</h3>
<ul>
<li class = "fragment">Primary role: a channel for applications to work together
<ul>
<li class = "fragment">Your website and the Twitter API</li>
<li class = "fragment">Twitter's mobile app and the Twitter API</li>
<li class = "fragment">Hootsuite's mobile app and the Twitter API</li>
</li>
</ul>
</section>
<!-- What is AJAX-->
<section>
<h3>What is AJAX?</h3>
<ul>
<li class = "fragment"><span class = "yellow">A</span>synchronous <span class = "yellow">J</span>avaScript <span class = "yellow">a</span>nd <span class = "yellow">X</span>ML</li>
<li class = "fragment">Method to communicate to a server or API</li>
<li class = "fragment">Asynchronous means:
<ul>
<li class = "fragment">I ask Twitter for all the tweets ever!</li>
<li class = "fragment">That will take a while</li>
<li class = "fragment">My <span class = "green">whole website</span> could be <span class = "green">locked up</span> while I wait!</li>
<li class = "fragment">Or, my call can be <span class = "blue">'asynchronous'</span> and my website will just <span class = "blue">listen for Twitter's response</span> with one ear, but go about <span class = "blue">normal business until the response arrives</span>.
</ul>
</li>
<li class = "fragment">Requests and results can be in JavaScript or XML</li>
</ul>
</section>
<!-- What is REST-->
<section>
<h3>What is REST?</h3>
<ul>
<li class = "fragment"><span class = "yellow">Re</span>presentational <span class = "yellow">S</span>tate <span class = "yellow">T</span>ransfer</li>
<li class = "fragment">REST is a way to ask an API for information by using a URL.</li>
<li class = "fragment">REST Urls are created with the following syntax:
<ul>
<li class = "fragment">http://ApiSite.com/method?parameter=value&parameter=value</li>
<li class = "fragment"><span class = "blue">Method</span> -- what you want from the API. Defined by API documentations</li>
<li class = "fragment"><span class = "blue">Parameter</span> -- a type of filter or restraint. Defined by API documentations</li>
<li class = "fragment"><span class = "blue">Value</span> -- value for parameter. Defined by you!</li>
</ul>
</li>
</ul>
</section>
<section>
<h3>Where do I learn about an API?</h3>
<p>All (good) APIs have documentation</p>
<ul>
<li>Facebook (<a href = "https://developers.facebook.com/" target = "_blank">https://developers.facebook.com/</a>)</li>
<li>Twitter (<a href = "https://dev.twitter.com/" target = "_blank">https://dev.twitter.com/</a>)</li>
<li>Meetup (<a href = "http://www.meetup.com/meetup_api/" target = "_blank">http://www.meetup.com/meetup_api/</a>)</li>
<li>FourSquare (<a href = "https://developer.foursquare.com/">https://developer.foursquare.com/</a>)</li>
</section>
<!-- What is JSON-->
<section>
<h3>What is JSON?</h3>
<ul>
<li class = "fragment"><span class = "yellow">J</span>ava<span class = "yellow">S</span>cript <span class = "yellow">O</span>bject <span class = "yellow">N</span>otation</li>
<li class = "fragment">Format for data returned from APIs</li>
<li class = "fragment">You've seen it before!</li>
<li class = "fragment">JavaScript objects</li>
</ul>
</section>
<!-- Getting started!-->
<section>
<h3>Getting started!</h3>
<p>Get an API Key</p>
<p class = "fragment green">A what?</p>
<ul>
<li class = "fragment">Api Key or Developer Key is a way for an API to identify you</li>
<li class = "fragment">More secure for an API (Know who is using their API)</li>
<li class = "fragment">More secure for you -- people can't pretend to be your website</li>
</ul>
</section>
<!-- Meetup-->
<section>
<h3>Meetup API</h3>
<p>We will be using the Meetup API</p>
<p><a href = "http://www.meetup.com/meetup_api/" target = "_blank">Documentation</a></p>
<img src = "images/meetup.png" />
</section>
<section>
<h3>Meetup API</h3>
<p>We will be finding interesting Meetups near us</p>
<p><a href = "http://www.meetup.com/meetup_api/docs/2/open_events/" target = "_blank">Open Events</a></p>
<img src = "images/meetup_open.png"/>
</section>
<section>
<h3>Meetup API</h3>
<p>Try it in the meetup console</p>
<p><a href = "http://www.meetup.com/meetup_api/console/?path=/2/open_events" target = "_blank">Open Events Console</a></p>
<img src = "images/meetup_console.png"/>
</section>
<section>
<h3>Meetup API</h3>
<p>Try it in the meetup console</p>
<img src = "images/meetup_results.png"/>
</section>
<!-- jQuery Ajax-->
<section>
<h3>jQuery Ajax</h3>
<p>jQuery method to perform an AJAX call</p>
<div class = "fragment">
<pre><code contenteditable class = "javascript">
$.ajax({
url: 'http://site.com',
data: {
parameter: 'value',
parameter: 'value'
},
crossDomain: true,
dataType: 'jsonp',
type: "GET",
success: function (data) {
// code with data returned
},
error: function(data) {
// code with error returned
}
});
</code></pre>
</div>
</section>
<section>
<h3>jQuery Ajax</h3>
<div class = "fragment">
<pre><code contenteditable class = "javascript">
$.ajax({
url: 'http://site.com',
...
});
</code></pre>
</div>
<ul>
<li class = "fragment"> $.ajax() -- jQuery method for sending AJAX requests</li>
<li class = "fragment">Takes one parameter -- a JavaScript object</li>
<li class = "fragment">Note the {}</li>
<li class = "fragment"><span class = "blue">url</span> -- first property, the url where you will send the AJAX request</li>
</ul>
</section>
<section>
<h3>jQuery Ajax</h3>
<div class = "fragment">
<pre><code contenteditable class = "javascript">
...
data: {
parameter: 'value',
parameter: 'value'
},
...
</code></pre>
</div>
<ul>
<li class = "fragment"><span class = "blue">data</span> -- a JavaScript object with all the parameters for the AJAX request</li>
<li class = "fragment">Some parameters in the <a href = "http://www.meetup.com/meetup_api/docs/2/open_events/" target = "_blank">Meetup open events</a>
<ul>
<li>key (refers to api key)</li>
<li>city</li>
<li>country</li>
<li>topic</li>
</ul>
</li>
</ul>
</section>
<section>
<h3>jQuery Ajax</h3>
<div class = "fragment">
<pre><code contenteditable class = "javascript">
...
crossDomain: true,
dataType: 'jsonp',
type: "GET",
...
</code></pre>
</div>
<ul>
<li class = "fragment"><span class = "blue">crossDomain</span> -- are you sending the request to a domain that is not your own?</li>
<li class = "fragment"><span class = "blue">dataType</span> -- how will you evaluate the data returned</li>
<li class = "fragment"><span class = "blue">type</span> -- what type of request is it?
<ul>
<li>GET -- retrieve data</li>
<li>POST -- post new data</li>
</ul>
</li>
</ul>
</section>
<section>
<h3>jQuery Ajax</h3>
<div class = "fragment">
<pre><code contenteditable class = "javascript">
...
success: function (data) {
// code with data returned
},
error: function(data) {
// code with error returned
}
...
</code></pre>
</div>
<ul>
<li class = "fragment"><span class = "blue">success</span> -- code that will execute if results are sent back successfully</li>
<li class = "fragment"><span class = "blue">error</span> -- code that will execute if results return an error</li>
</ul>
</section>
<!-- Exercise-->
<section>
<h3>Let's Develop It!</h3>
<ul>
<li>Create a new div with the id "events"</li>
<li>Create a new function in your javascript that calls <a href = "http://www.meetup.com/meetup_api/docs/2/open_events/" target = "_blank">Meetup open events</a> method</li>
<li>Add parameters such as city, state or lat, lon to find meetups near you</li>
<li>Add a parameter such as category or topic to find meetups that you would be interested in</li>
<li>For now, just look at the results in the console.log()</li>
<li>Call this new function in document ready</li>
</ul>
</section>
<section>
<h3>Let's Develop It!</h3>
<img src = "images/console.png"/>
</section>
<section>
<h3>Let's Develop It!</h3>
<ul>
<li>Create a new function that can parse results.</li>
<li>Remember that the results will be an array of objects</li>
<li>Loop through your results</li>
<li>For each result, create a new div</li>
<li>Get the name, description, group name, and url of each event</li>
<li>Append them to your new div</li>
<li>Append the new div to the div "events"</li>
</ul>
</section>
<section>
<h3>Let's Develop It!</h3>
<ul>
<li>Create a form for users to enter in their location and a topic of their choosing</li>
<li>On submit, call the same Meetup open events method, but with the user's values</li>
</ul>
</section>
<section>
<h3>Bonus</h3>
<p class = "blue">Still have time? Can't stop learning?</p>
<div class = "left-align">
<p>One of the best things about jQuery is the developer community</p>
<p>They love to build!</p>
<p>Check out some great plugins:</p>
<ul>
<li><a href = "http://jqueryui.com/" target = "_blank">jQuery UI</a> -- accordions, drag and drop, resize, sort</li>
<li><a href = "http://leandrovieira.com/projects/jquery/lightbox/" target = "_blank">jQuery Lightbox</a> -- Pop up gallery of images!</li>
<li><a href = "http://www.jqueryplugins.com/" target = "_blank">And so many more!</a></li>
</ul>
</div>
</section>
<!-- -->
<section>
<h2>Questions?</h2>
<div style = "font-size:1200%; height:100%; margin-top:40%" class ="blue">?
<div class ="clear"></div></div>
</section>
</div>
<footer>
<div class="copyright">
Javascript ~ Girl Develop It ~
<a rel="license" href="http://creativecommons.org/licenses/by-nc/3.0/deed.en_US"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc/3.0/80x15.png" /></a>
</div>
</footer>
</div>
<script src="reveal/lib/js/head.min.js"></script>
<script src="reveal/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,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/zoom/linear/none
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'reveal/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'reveal/plugin/markdown/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'reveal/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'reveal/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'reveal/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'reveal/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
]
});
</script>
</body>
</html>