-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
941 lines (817 loc) · 25.5 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
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
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>node.js intro</title>
<style type="text/css">
body {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
color: #222;
font-size: 100%;
}
.slide {
position: absolute;
top: 0; bottom: 0;
left: 0; right: 0;
background-color: #f7f7f7;
}
.slide-content {
width: 800px;
height: 600px;
overflow: hidden;
margin: 80px auto 0 auto;
padding: 30px;
font-weight: 200;
font-size: 200%;
line-height: 1.375;
}
.controls {
position: absolute;
bottom: 20px;
left: 20px;
}
.arrow {
width: 0; height: 0;
border: 30px solid #333;
float: left;
margin-right: 30px;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.prev {
border-top-color: transparent;
border-bottom-color: transparent;
border-left-color: transparent;
border-left-width: 0;
border-right-width: 50px;
}
.next {
border-top-color: transparent;
border-bottom-color: transparent;
border-right-color: transparent;
border-left-width: 50px;
border-right-width: 0;
}
.prev:hover {
border-right-color: #888;
cursor: pointer;
}
.next:hover {
border-left-color: #888;
cursor: pointer;
}
h1 {
font-size: 300%;
line-height: 1.2;
text-align: center;
margin: 170px 0 0;
}
h2 {
font-size: 100%;
line-height: 1.2;
margin: 5px 0;
text-align: center;
font-weight: 200;
}
h3 {
font-size: 140%;
line-height: 1.2;
border-bottom: 1px solid #aaa;
margin: 0;
padding-bottom: 15px;
}
ul {
padding: 20px 0 0 60px;
font-weight: 200;
line-height: 1.375;
}
.author h1 {
font-size: 170%;
font-weight: 200;
text-align: center;
margin-bottom: 30px;
}
.author h3 {
font-weight: 100;
text-align: center;
font-size: 95%;
border: none;
}
a {
text-decoration: none;
color: #44a4dd;
}
a:hover {
color: #66b5ff;
}
pre {
font-size: 60%;
line-height: 1.3;
}
.progress {
position: fixed;
top: 0; left: 0; right: 0;
height: 3px;
}
.progress-bar {
width: 0%;
height: 3px;
background-color: #b4b4b4;
-webkit-transition: width 0.05s ease-out;
-moz-transition: width 0.05s ease-out;
-o-transition: width 0.05s ease-out;
transition: width 0.05s ease-out;
}
.hidden {
display: none;
}
@media (max-width: 850px) {
body {
font-size: 70%;
}
.slide-content {
width: auto;
}
img {
width: 100%;
}
h1 {
margin-top: 120px;
}
.prev, .prev:hover {
border-right-color: rgba(135, 135, 135, 0.5);
}
.next, .next:hover {
border-left-color: rgba(135, 135, 135, 0.5);
}
}
@media (max-width: 480px) {
body {
font-size: 50%;
overflow: hidden;
}
.slide-content {
padding: 10px;
margin-top: 10px;
height: 340px;
}
h1 {
margin-top: 50px;
}
ul {
padding-left: 25px;
}
}
@media print {
* {
-webkit-print-color-adjust: exact;
}
@page {
size: letter;
}
.hidden {
display: inline;
}
html {
width: 100%;
height: 100%;
overflow: visible;
}
body {
margin: 0 auto !important;
border: 0;
padding: 0;
float: none !important;
overflow: visible;
background: none !important;
font-size: 52%;
}
.progress, .controls {
display: none;
}
.slide {
position: static;
}
.slide-content {
border: 1px solid #222;
margin-top: 0;
margin-bottom: 40px;
height: 3.5in;
overflow: visible;
}
.slide:nth-child(even) {
/* 2 slides per page */
page-break-before: always;
}
}
/*
github.com style (c) Vasily Polovnyov <[email protected]>
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
color: #333;
background: #f8f8f8;
}
.hljs-comment,
.hljs-quote {
color: #998;
font-style: italic;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-subst {
color: #333;
font-weight: bold;
}
.hljs-number,
.hljs-literal,
.hljs-variable,
.hljs-template-variable,
.hljs-tag .hljs-attr {
color: #008080;
}
.hljs-string,
.hljs-doctag {
color: #d14;
}
.hljs-title,
.hljs-section,
.hljs-selector-id {
color: #900;
font-weight: bold;
}
.hljs-subst {
font-weight: normal;
}
.hljs-type,
.hljs-class .hljs-title {
color: #458;
font-weight: bold;
}
.hljs-tag,
.hljs-name,
.hljs-attribute {
color: #000080;
font-weight: normal;
}
.hljs-regexp,
.hljs-link {
color: #009926;
}
.hljs-symbol,
.hljs-bullet {
color: #990073;
}
.hljs-built_in,
.hljs-builtin-name {
color: #0086b3;
}
.hljs-meta {
color: #999;
font-weight: bold;
}
.hljs-deletion {
background: #fdd;
}
.hljs-addition {
background: #dfd;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}
blockquote {
padding-left: 20px;
margin-left: 0;
margin-right: 0;
background: #ddd;
border-left: 5px solid #ccc;
border-radius: 0 3px 3px 0;
}
blockquote p {
padding: .5em;
color: #272822;
}
p {
display: block;
-webkit-margin-before: 0.9em;
-webkit-margin-after: 0.9em;
-webkit-margin-start: 0px;
-webkit-margin-end: 0px;
}
pre {
font-size: 90%;
line-height: 1.2;
}
ul {
padding: 0 0 0 40px;
font-weight: 200;
line-height: 1.6;
}
.progress {
z-index: 1000;
}
.progress-bar {
height: 5px;
}
img {
width: 100%
}
#slide-1 img {
width: auto;
}
body, .slide {
background-color: #eee;
}
.slide-content {
margin-top: 20px;
width: auto;
max-width: 900px;
height: auto;
overflow: auto;
z-index: 1;
}
.arrow {
position: fixed;
bottom: 70px;
margin: 0;
padding: 0;
border: none;
opacity: 0.3;
transform: scale(0.8);
}
@media (max-width: 850px) {
.arrow {
opacity: 0.2;
bottom: 60px;
transform: scale(0.7);
}
}
@media (max-width: 480px) {
.arrow {
opacity: 0.1;
bottom: 52px;
transform: scale(0.56);
}
}
.prev {
left: 0;
border: none;
}
.prev:before {
float: left;
content: url(img/left.png);
}
.next {
right: 0;
border: none;
}
.next:before {
float: right;
content: url(img/right.png);
}
</style>
</head>
<body>
<div class="progress">
<div class="progress-bar"></div>
</div>
<div class="slide" id="slide-1">
<section class="slide-content"><h1 id="node-js-intro">node.js intro</h1>
<blockquote>
<p><a href="http://intesso.github.io/nodejs-introduction">http://intesso.github.io/nodejs-introduction</a></p>
</blockquote>
<p>feedback and pull requests welcome on <a href="https://github.com/intesso/nodejs-introduction">GitHub </a><a href="https://github.com/intesso/nodejs-introduction"><img src="img/github.png" alt="github"></a></p>
<p><em>navigate with left, right keys</em></p>
</section>
</div>
<div class="slide hidden" id="slide-2">
<section class="slide-content"><h3 id="what-is-node-js">what is node.js</h3>
<blockquote>
<p>"Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world."</p>
<p>Source: <a href="https://nodejs.org/en/">https://nodejs.org/en/</a></p>
</blockquote>
</section>
</div>
<div class="slide hidden" id="slide-3">
<section class="slide-content"><h3 id="who-uses-node-js">who uses node.js</h3>
<p><img src="img/used-by.png" alt="node rules the world">
<em>and many more ...</em></p>
</section>
</div>
<div class="slide hidden" id="slide-4">
<section class="slide-content"><h3 id="trend-jan-2014-nov-2016-">trend ( <em>jan-2014 - nov-2016</em> )</h3>
<p><img src="img/trend.png" alt="node is trendy"></p>
</section>
</div>
<div class="slide hidden" id="slide-5">
<section class="slide-content"><h3 id="use-cases">use cases</h3>
<ul>
<li>build chain <a href="http://gulpjs.com/">gulp</a>, <a href="http://gruntjs.com/">grunt</a>: compile, lint, bundle, etc...</li>
<li>website / webapp <a href="http://expressjs.com/">express</a>, <a href="http://hapijs.com/">hapijs</a></li>
<li>backend for mobile apps</li>
<li>RESTful services <a href="http://restify.com/">restify</a></li>
<li>microservices <a href="http://senecajs.org/">seneca</a></li>
<li>desktop applications <a href="http://electron.atom.io/">electron</a>, e.g. <a href="https://atom.io/">atom</a>, <a href="https://www.brave.com/">brave</a>, <a href="https://code.visualstudio.com/">visual studio code</a></li>
<li>commandline tools <a href="https://docs.npmjs.com/files/package.json#bin">npm package.json bin</a>, <a href="https://www.npmjs.com/package/commander">commander</a>, <a href="https://www.npmjs.com/package/minimist">minimist</a></li>
<li>messaging (TCP, UDP, http, https, ...) <a href="https://nodejs.org/api/">node.js api</a></li>
<li>IoT <a href="https://nodered.org/">Node-RED</a>, <a href="http://cylonjs.com/">cyclon.js</a></li>
<li>native c, c++ modules <a href="https://nodejs.org/api/addons.html">addons</a></li>
<li>basically any I/O, Network or Web Stuff that needs asynchronous/parallel processing</li>
</ul>
</section>
</div>
<div class="slide hidden" id="slide-6">
<section class="slide-content"><h3 id="runs-on">runs on</h3>
<blockquote>
<p>basically anything:</p>
<p><strong>windows, linux, mac, arm, docker</strong> ...</p>
</blockquote>
<p>download: <a href="https://nodejs.org/en/download/"><a href="https://nodejs.org/en/download/">https://nodejs.org/en/download/</a></a></p>
</section>
</div>
<div class="slide hidden" id="slide-7">
<section class="slide-content"><h3 id="what-makes-node-js-stand-out-">what makes node.js stand out?</h3>
<ul>
<li>same language on the server and the browser</li>
<li>excellent module system <a href="https://www.npmjs.com/">npm</a></li>
<li>more than <ul>
<li>230'000 npm modules (Jan 2016)</li>
<li>350'000 npm modules (Nov 2016)</li>
</ul>
</li>
<li>quite good open source communities</li>
<li>sharing spirit</li>
<li>part of the linux foundation</li>
<li>and there is more ...</li>
</ul>
</section>
</div>
<div class="slide hidden" id="slide-8">
<section class="slide-content"><h3 id="what-is-was-io-js-">what is (was) io.js?</h3>
<ul>
<li>a fork of node.js</li>
<li>because developers were not happy with the development of the stewardship of <a href="https://www.joyent.com/">joyent</a></li>
<li>that was merged in September 2015 into node.js 4.0</li>
<li>it lead to a well governed OSS projects</li>
<li>that includes everyone: developers, organizations, ...</li>
<li>under the umbrella of the linux foundation</li>
</ul>
</section>
</div>
<div class="slide hidden" id="slide-9">
<section class="slide-content"><h3 id="node-js-releases">node.js releases</h3>
<ul>
<li>LTS: long term support (even numbers)<ul>
<li>current release (Nov 2016): V6 "Boron"</li>
<li>actively maintained for 18 month, maintenance mode afterwards</li>
<li>no more than two LTS versions at the same time</li>
</ul>
</li>
<li>Stable: shorter lifespan, more updates (odd numbers)<ul>
<li>current release (Nov 2016): V7</li>
<li>when Stable release becomes the next LTS, no new features or breaking changes are added</li>
</ul>
</li>
</ul>
</section>
</div>
<div class="slide hidden" id="slide-10">
<section class="slide-content"><h3 id="how-was-node-js-started-">how was node.js started?</h3>
<p><strong>Ryan Dahls thesis</strong></p>
<blockquote>
<p>io needs to be done differently</p>
<p><a href="https://youtu.be/ztspvPYybIY?t=48">original node.js presentation by Ryan Dahl</a></p>
</blockquote>
</section>
</div>
<div class="slide hidden" id="slide-11">
<section class="slide-content"><h3 id="the-cost-of-i-o">the cost of i/o</h3>
<pre><code> L1-cache 3 cycles
L2-cache 14 cycles
RAM 250 cycles
Disk 41'000'000 cycles
Network 240'000'000 cycles</code></pre>
<blockquote>
<p>don't block on I/O access</p>
</blockquote>
<p>but how?</p>
<blockquote>
<p>Threads in combination with Object oriented programming can be really painful and error prone.</p>
</blockquote>
</section>
</div>
<div class="slide hidden" id="slide-12">
<section class="slide-content"><h3 id="event-loop">event-loop</h3>
<p><img src="img/node-threading.png" alt="single-threaded-code">
<a href="https://strongloop.com/strongblog/node-js-performance-event-loop-monitoring/">source: <a href="https://strongloop.com/strongblog/node-js-performance-event-loop-monitoring/">https://strongloop.com/strongblog/node-js-performance-event-loop-monitoring/</a></a></p>
</section>
</div>
<div class="slide hidden" id="slide-13">
<section class="slide-content"><h3 id="event-loop">event-loop</h3>
<ul>
<li>your code is single threaded, basically everything else runs in parallel</li>
<li>event-loop <a href="https://nodesource.com/blog/understanding-the-nodejs-event-loop/">event-loop explanation</a>, <a href="https://www.youtube.com/watch?v=ztspvPYybIY">ryan dahl's original presentation</a>, is based on <code>libuv</code></li>
<li>EventEmitter to interact with the event-loop</li>
<li>EventEmitter itself is synchronous</li>
</ul>
</section>
</div>
<div class="slide hidden" id="slide-14">
<section class="slide-content"><h3 id="more-node-js-building-blocks">more node.js building blocks</h3>
<ul>
<li><a href="https://nodejs.org/api/modules.html">module system</a></li>
<li><a href="https://nodejs.org/api/events.html">events</a></li>
<li><a href="https://nodejs.org/api/stream.html">streams</a></li>
</ul>
<p><strong>what's underneath</strong></p>
<blockquote>
<ul>
<li>node.js is built on top of google chrome V8</li>
<li>Microsoft submitted a <a href="https://blogs.windows.com/msedgedev/2016/01/19/nodejs-chakracore-mainline/">pull request</a> for support with it's ChakraCore in January 2016</li>
</ul>
</blockquote>
</section>
</div>
<div class="slide hidden" id="slide-15">
<section class="slide-content"><h3 id="editors">editors</h3>
<ul>
<li><a href="http://code.visualstudio.com/">visual studio code</a></li>
<li><a href="https://atom.io/">atom</a></li>
<li><a href="http://brackets.io/">brackets</a></li>
<li><a href="http://www.sublimetext.com/3">sublimetext</a></li>
<li><a href="https://github.com/moll/vim-node">vim</a></li>
<li><a href="http://www.hanselman.com/blog/WebMatrixAndNodejsTheEasiestWayToGetStartedWithNodeOnWindows.aspx">WebMatrix</a></li>
<li><a href="https://www.jetbrains.com/webstorm/download/">WebStorm</a></li>
<li><a href="http://www.nodeclipse.org/">nodeclipse</a></li>
</ul>
<p><strong>pick whatever you like!</strong></p>
</section>
</div>
<div class="slide hidden" id="slide-16">
<section class="slide-content"><h3 id="debugging">debugging</h3>
<blockquote>
<p><a href="http://spin.atomicobject.com/2015/09/25/debug-node-js/">debugging node.js</a> within IDE or with <a href="https://www.npmjs.com/package/node-inspector">node-inspector</a> or with node >= 6</p>
</blockquote>
<pre><code class="lang-sh"><span class="hljs-comment"># install once</span>
npm install -g node-inspector
<span class="hljs-comment"># use</span>
node-debug myapp.js
<span class="hljs-comment"># chrome inspector included with node >= 6.0</span>
node --inspect myapp.js</code></pre>
<blockquote>
<p><a href="https://strongloop.com/strongblog/comparison-tools-to-automate-restarting-node-js-server-after-code-changes-forever-nodemon-nodesupervisor-nodedev/">restarting node.js server on code changes</a>
use <a href="http://nodemon.io/">nodemon</a> or <a href="https://www.npmjs.com/package/forever">forever</a></p>
</blockquote>
<pre><code class="lang-sh"><span class="hljs-comment"># install once</span>
npm install -g nodemon
<span class="hljs-comment"># use</span>
nodemon myapp.js</code></pre>
</section>
</div>
<div class="slide hidden" id="slide-17">
<section class="slide-content"><h3 id="coding">coding</h3>
<blockquote>
<p>file server</p>
</blockquote>
<pre><code class="lang-js"><span class="hljs-keyword">var</span> http = <span class="hljs-built_in">require</span>(<span class="hljs-string">'http'</span>);
<span class="hljs-keyword">var</span> fs = <span class="hljs-built_in">require</span>(<span class="hljs-string">'fs'</span>);
<span class="hljs-keyword">var</span> server = http.createServer();
server.on(<span class="hljs-string">'request'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">req, res</span>) </span>{
<span class="hljs-keyword">if</span> (req.url == <span class="hljs-string">'/favicon.ico'</span>) <span class="hljs-keyword">return</span> res.end();
<span class="hljs-keyword">var</span> stream = fs.createReadStream(process.cwd() + req.url);
stream.pipe(res);
});
server.listen(<span class="hljs-number">8000</span>);
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'fileserver running at: http://localhost:8000'</span>);</code></pre>
</section>
</div>
<div class="slide hidden" id="slide-18">
<section class="slide-content"><h3 id="coding">coding</h3>
<blockquote>
<p>using EventEmitter</p>
</blockquote>
<pre><code class="lang-js"><span class="hljs-keyword">var</span> http = <span class="hljs-built_in">require</span>(<span class="hljs-string">'http'</span>);
<span class="hljs-keyword">var</span> fs = <span class="hljs-built_in">require</span>(<span class="hljs-string">'fs'</span>);
<span class="hljs-keyword">var</span> server = http.createServer();
server.on(<span class="hljs-string">'request'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">req, res</span>) </span>{
<span class="hljs-keyword">if</span> (req.url == <span class="hljs-string">'/favicon.ico'</span>) <span class="hljs-keyword">return</span> res.end();
<span class="hljs-keyword">var</span> stream = fs.createReadStream(process.cwd() + req.url, <span class="hljs-string">'utf-8'</span>);
stream.on(<span class="hljs-string">'data'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">data</span>)</span>{
res.write(<span class="hljs-string">'\n\ngot data: '</span> + data);
});
stream.on(<span class="hljs-string">'error'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">err</span>)</span>{
res.write(<span class="hljs-string">'\n\nshit happens'</span> + err);
});
stream.on(<span class="hljs-string">'end'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
res.end(<span class="hljs-string">'\n\ndone, no more data'</span>);
});
});
server.listen(<span class="hljs-number">8000</span>);
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'fileserver running at: http://localhost:8000'</span>);</code></pre>
</section>
</div>
<div class="slide hidden" id="slide-19">
<section class="slide-content"><h3 id="learning-learning-learning-">learning, learning, learning...</h3>
<ul>
<li>node.js <a href="https://nodejs.org/api/">api</a></li>
<li>web apis <a href="http://devdocs.io/">devdocs</a></li>
<li>testing node.js server + npm online <a href="https://tonicdev.com/">tonicdev</a></li>
<li>testing node.js browserified bundles <a href="http://requirebin.com/">requirebin</a></li>
</ul>
<blockquote>
<p>get some great interacitve node.js lessons:</p>
</blockquote>
<pre><code class="lang-sh">npm install learnyounode -g
npm install workshopper -g
npm install adventure -g
npm install functional-javascript-workshop -g</code></pre>
</section>
</div>
<div class="slide hidden" id="slide-20">
<section class="slide-content"><h3 id="built-with-node-js-at-intesso-http-intesso-com-">built with node.js at <a href="http://intesso.com/">intesso</a></h3>
<ul>
<li>Traffic Control System<ul>
<li>Realtime UI with WebSockets (socket.io)</li>
<li>TCP/XML Interfaces</li>
</ul>
</li>
<li>Intelligent Charging Station<ul>
<li>Communication with OSGI bundle via 0mq</li>
<li>binding with python code with zerorpc</li>
<li>SOAP WebService Interfaces</li>
<li>Proprietary Binary Interface with Charging Station</li>
<li>Admin Web UI</li>
</ul>
</li>
<li><a href="http://intesso.com/projects/remote-access">On demand Remote Access</a></li>
<li>Modular Content Management System: <a href="http://glintcms.com/">GlintCMS</a>, based on <a href="https://github.com/glintapp/glintapp">GlintApp</a></li>
<li>and many Open Source npm Modules: <a href="https://www.npmjs.com/~andineck">andineck</a></li>
</ul>
</section>
</div>
<div class="slide hidden" id="slide-21">
<section class="slide-content"><h3 id="personal-experiences-with-node-js-andineck-https-twitter-com-andineck-">personal experiences with node.js <a href="https://twitter.com/andineck">@andineck</a></h3>
<ul>
<li>started with v0.6</li>
<li>v0.8, v0.12, v4.3 in production</li>
<li>so far, I hardly ever experienced unexpected behaviour from node.js</li>
<li>when something was not working the way I thought it should be, it was most of the time, because I didn't understand JavaScript well enough</li>
</ul>
<blockquote>
<p>see also: <a href="http://intesso.github.io/javascript-obstacles">http://intesso.github.io/javascript-obstacles</a></p>
</blockquote>
</section>
</div>
<div class="slide hidden author-slide" id="slide-22">
<section class="slide-content"><div class="author">
<h1 class="name">Andi Neck</h1>
<h3 class="twitter">
<a href="http://twitter.com/@andineck">@andineck</a>
</h3>
<h3 class="url">
<a href="http://intesso.com">http://intesso.com</a>
</h3>
</div>
</section>
</div>
<div class="controls">
<div class="arrow prev"></div>
<div class="arrow next"></div>
</div>
<script type="text/javascript">
/**
* Returns the current page number of the presentation.
*/
function currentPosition() {
return parseInt(document.querySelector('.slide:not(.hidden)').id.slice(6));
}
/**
* Navigates forward n pages
* If n is negative, we will navigate in reverse
*/
function navigate(n) {
var position = currentPosition();
var numSlides = document.getElementsByClassName('slide').length;
/* Positions are 1-indexed, so we need to add and subtract 1 */
var nextPosition = (position - 1 + n) % numSlides + 1;
/* Normalize nextPosition in-case of a negative modulo result */
nextPosition = (nextPosition - 1 + numSlides) % numSlides + 1;
document.getElementById('slide-' + position).classList.add('hidden');
document.getElementById('slide-' + nextPosition).classList.remove('hidden');
updateProgress();
updateURL();
updateTabIndex();
}
/**
* Updates the current URL to include a hashtag of the current page number.
*/
function updateURL() {
try {
window.history.replaceState({} , null, '#' + currentPosition());
} catch (e) {
window.location.hash = currentPosition();
}
}
/**
* Sets the progress indicator.
*/
function updateProgress() {
var progressBar = document.querySelector('.progress-bar');
if (progressBar !== null) {
var numSlides = document.getElementsByClassName('slide').length;
var position = currentPosition() - 1;
var percent = (numSlides === 1) ? 100 : 100 * position / (numSlides - 1);
progressBar.style.width = percent.toString() + '%';
}
}
/**
* Removes tabindex property from all links on the current slide, sets
* tabindex = -1 for all links on other slides. Prevents slides from appearing
* out of control.
*/
function updateTabIndex() {
var allLinks = document.querySelectorAll('.slide a');
var position = currentPosition();
var currentPageLinks = document.getElementById('slide-' + position).querySelectorAll('a');
var i;
for (i = 0; i < allLinks.length; i++) {
allLinks[i].setAttribute('tabindex', -1);
}
for (i = 0; i < currentPageLinks.length; i++) {
currentPageLinks[i].removeAttribute('tabindex');
}
}
/**
* Determines whether or not we are currently in full screen mode
*/
function isFullScreen() {
return document.fullscreenElement ||
document.mozFullScreenElement ||
document.webkitFullscreenElement ||
document.msFullscreenElement;
}
/**
* Toggle fullScreen mode on document element.
* Works on chrome (>= 15), firefox (>= 9), ie (>= 11), opera(>= 12.1), safari (>= 5).
*/
function toggleFullScreen() {
/* Convenient renames */
var docElem = document.documentElement;
var doc = document;
docElem.requestFullscreen =
docElem.requestFullscreen ||
docElem.msRequestFullscreen ||
docElem.mozRequestFullScreen ||
docElem.webkitRequestFullscreen.bind(docElem, Element.ALLOW_KEYBOARD_INPUT);
doc.exitFullscreen =
doc.exitFullscreen ||
doc.msExitFullscreen ||
doc.mozCancelFullScreen ||
doc.webkitExitFullscreen;
isFullScreen() ? doc.exitFullscreen() : docElem.requestFullscreen();
}
document.addEventListener('DOMContentLoaded', function () {
// Update the tabindex to prevent weird slide transitioning
updateTabIndex();
// If the location hash specifies a page number, go to it.
var page = window.location.hash.slice(1);
if (page) {
navigate(parseInt(page) - 1);
}
document.onkeydown = function (e) {
var kc = e.keyCode;
// left, down, H, J, backspace, PgUp - BACK
// up, right, K, L, space, PgDn - FORWARD
// enter - FULLSCREEN
if (kc === 37 || kc === 40 || kc === 8 || kc === 72 || kc === 74 || kc === 33) {
navigate(-1);
} else if (kc === 38 || kc === 39 || kc === 32 || kc === 75 || kc === 76 || kc === 34) {
navigate(1);
} else if (kc === 13) {
toggleFullScreen();
}
};
if (document.querySelector('.next') && document.querySelector('.prev')) {
document.querySelector('.next').onclick = function (e) {
e.preventDefault();
navigate(1);
};
document.querySelector('.prev').onclick = function (e) {
e.preventDefault();
navigate(-1);
};
}
});
</script>
</body>
</html>