forked from UnseenWizzard/git_training
-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathslides.html
19158 lines (17745 loc) · 867 KB
/
slides.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
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Professional Practice: Git Seminar</title>
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
h1, h2, h3 {
font-weight: 400;
margin-bottom: 0;
}
.remark-slide-content h1 { font-size: 3em; }
.remark-slide-content h2 { font-size: 2em; }
.remark-slide-content h3 { font-size: 1.6em; }
.footnote {
position: absolute;
bottom: 3em;
}
li p { line-height: 1.25em; }
.red { color: #fa0000; }
.large { font-size: 2em; }
a, a > code {
color: rgb(249, 38, 114);
text-decoration: none;
}
code {
background: none repeat scroll 0 0 #F8F8FF;
border: 1px solid #DEDEDE;
border-radius: 3px ;
padding: 0 0.2em;
}
.remark-code, .remark-inline-code { font-family: "Bitstream Vera Sans Mono", "Courier", monospace; }
.remark-code-line-highlighted { background-color: #373832; }
.pull-left {
float: left;
width: 47%;
}
.pull-right {
float: right;
width: 47%;
}
.pull-right ~ p {
clear: both;
}
#slideshow .slide .content code {
font-size: 0.8em;
}
#slideshow .slide .content pre code {
font-size: 0.9em;
padding: 15px;
}
.main-title, .title {
background: #272822;
color: #777872;
text-shadow: 0 0 20px #333;
}
.title h1, .title h2, .main-title h1, .main-title h2 {
color: #f3f3f3;
line-height: 0.8em;
}
/* Custom */
.remark-code {
display: block;
padding: 0.5em;
}
</style>
</head>
<body>
<textarea id="source">
class: center, middle, main-title
# Professional Practice: Git Seminar
*Adapted from Nice Reidman's interactive Git tutorial*
["Learn git concepts, not commands"](https://dev.to/unseenwizzard/learn-git-concepts-not-commands-4gjc)
[](https://gitpod.io#snapshot/10b5498d-ec6a-4ff6-a80b-d03376d487cb)
---
## Resources
- [Pro Git Book](https://git-scm.com/book/en/v2)
- [Introduction to GitHub course](https://github.com/skills/introduction-to-github)
- [This tutorial in more depth](./TUTORIAL.md)
---
class: center, middle, main-title
# Local Version Control
<img src="./images/localVCS.png" height="400"/>
---
class: center, middle, main-title
# Centralised Version Control
<img src="./images/cvcs.png" height="400"/>
---
class: center, middle, main-title
# Distributed Version Control
<img src="./images/dvcs.png" height="500"/>
---
## Git Overview
<!--  -->
<img src="./images/teachingGit/1-dvcs.png" width="700"/>
---
## Getting a Remote Repository
- Fork https://github.com/john-french/git_training
- creates your own remote copy of a repository
- Get your copy of the remote repo onto your machine
```sh
git clone https://github.com/{YOUR USERNAME}/git_training.git
```
- creates a new directory called `git_training` on your machine
---
## Cloning a repository
<img src="./images/teachingGit/2-clone.png" width="700"/>
---
## Adding new things
- Move to the repo directory and add a new file
```sh
cd git_training
echo "This is Bob" > Bob.txt
```
- Check the status of your working directory and view changes
```sh
git status
git diff
```
<img src="./images/teachingGit/3-tracked-untracked.png" width="500"/>
---
## Adding Changes
<img src="./images/teachingGit/4-add-commit-push.png" width="700"/>
---
## Adding Changes
- Add changes to the staging area
```sh
git add Bob.txt
git diff --staged
```
- Commit changes to the local repo
```sh
git commit -m "Added Bob"
```
- Push changes to the remote
```sh
git push
```
<!-- ## Reviewing Change History -->
---
## Commit Messages: Bad
<img src="https://imgs.xkcd.com/comics/git_commit.png" class="center" width="600"/>
---
## Commit Messages: Good
<div class="highlighter-rouge"><pre class="highlight"><code>$ git log --oneline -5 --author pwebb --before "Sat Aug 30 2014"
5ba3db6 Fix failing CompositePropertySourceTests
84564a0 Rework @PropertySource early parsing logic
e142fd1 Add tests for ImportSelector meta-data
887815f Update docbook dependency and generate epub
ac8326d Polish mockito usage
</code></pre>
</div>
---
class: center, middle, main-title
# Branching
---
## Branching

---
## Branching
- Create a new branch called `updateAlice`
```sh
git branch updateAlice
```
- Switch to the branch we just created
```sh
git checkout updateAlice
```
- Switch back to master
```sh
git checkout master
git branch
```
---
### Branching
- **Undo and use a shortcut instead**
- Delete branch `updateAlice`
```sh
git branch -d updateAlice
```
- Create and update branch in one go
```sh
git checkout -b updateAlice
git branch
```
---
### Creating a branch
<img src="./img/add_branch.png" height="500"/>
---
### Checking out a branch
<img src="./img/checkout_branch.png" height="500"/>
---
## Making Changes on a Branch
- Make a change to `Alice.txt` by adding more text
```sh
echo "More content added" >> Alice.txt
```
- Add and commit this change
```sh
git add Alice.txt
git commit -m "Updated Alice"
```
- Push these changes to the remote repository
```sh
git push
fatal: The current branch updateAlice has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin updateAlice
```
- List remote branches
```sh
git branch -a
```
---
class: center, middle, main-title
# Merging
---
## Merging
**Fast-Forward Merge**
- When **no new commits** have been added to the base branch
**3 Way Merge**
- When **new commits** have been added to the base branch<!--  -->
---
## Fast Forward Merge: Before

---
## Fast Forward Merge: After

---
## Fast Forward Merge
- See the `Updated Alice` in commit history on `updateAlice` branch
```sh
git log
```
- Checkout master, notice that commit isn't on the master branch
```sh
git checkout master
git log
```
- Merge the `updateAlice` branch into `master`
```
git merge updateAlice
git log
```
---
## 3 Way Merge: Before

---
## 3 Way Merge: After

---
## 3 Way Merge
- Create new branch
```sh
git branch newAlice
```
- Make changes on master
```sh
echo "Some more stuff" >> Bob.txt
git add Bob.txt
git commit -m "Updated Bob"
```
- Checkout `newAlice` branch and make changes there
```sh
git checkout newAlice
echo "Even more stuff" >> Alice.txt
git add Alice.txt
git commit -m "Updated Alice again"
```
---
### 3 Way Merge
- **`master` and `updateAlice` have now diverged**
- Switch back to `master` and merge `newAlice`
```sh
git checkout master
git merge newAlice
```
- Notice new merge commit `Merge branch newAlice`
```sh
git log --pretty=short
commit 5296df5d5e21747385eed68b1195b05dfce99cfc (HEAD -> master)
Merge: 0c34535 e849430
Author: John French <john.french@gmit.ie>
Merge branch 'newAlice'
```
---
## Merge Conflicts
- Create and checkout a new branch and make some changes on it
```sh
git checkout -b fixBob
echo "Hi! I'm Bob. I've been here for a while now." > Bob.txt
git add Bob.txt
git commit -m "Bob's here for a while"
```
- Checkout master and make changes to the same file
```sh
git checkout master
echo "Hi! I'm new here." > Bob.txt
git add Bob.txt
git commit -m "Bob's new here"
```
---
## Merge Conflicts
- Merging `fixBob` won't work, files have conflicting changes
```sh
git merge fixBob
Auto-merging Bob.txt
CONFLICT (content): Merge conflict in Bob.txt
Automatic merge failed; fix conflicts and then commit the result.
```
- View contents of `Bob.txt`
```
cat Bob.txt
<<<<<<< HEAD
Hi! I'm new here.
=======
Hi! I'm Bob. I've been here for a while now.
>>>>>>> fixBob
```
---
### Merge Conflicts
- Open file in text editor and fix conflict manually (or using a tool)
- Add and commit fixed file
```sh
git add Bob.txt
git commit
```
- Too messy! Cancel the merge
```sh
git merge --abort
```
---
class: center, middle, main-title
# Getting Remote Changes
Keeping your copy of the repository up-to-date
---
## Fetch
<img src="./images/teachingGit/fetch.png" width="700"/>
---
## Pull
<img src="./images/teachingGit/pull.png" width="700"/>
---
## Stashing
- Save work in progress that's not ready to commit
```sh
git stash
```
- List stashes
```sh
git stash list
```
- View a stash
```sh
git stash show
```
- Apply a stash (retrieve the changes)
```
git stash apply
```
<!-- ## Rebasing -->
---
class: center, middle, main-title
# Useful Git Commands
- Keep notes of new commands you learn
- Build up a library of handy commands
---
## My Command Library
| Action | Git Syntax |
|--|--|
| List tags and commit ids | `git show-ref --tags` |
| Squash last 4 commits into one commit with new message | `git reset --soft HEAD~4` |
| Amend last commit message | `git commit —amend` |
| Force push to remote (overwrites history, **Don't do this!**) | `git push -f origin` |
| List tags | `git tag -l` |
| Check out tag | `git checkout tags/<TAG>` |
| Show history in format [short SHA1] [message] | `git log --oneline` |
| Show sha1, author and message of a single commit | `git log --pretty=short -n 1 <SHA1>` |
| Check if object is present in repo and return its type | `git cat-file -t [SHA1]` |
| Get last common ancestor of two branches | `git merge-base branch1 branch2` |
| Abort a merge | `git merge --abort` |
| Create a new branch and check it out | `git checkout -b branch_name` |
| List remotes | `git remote -v` |
| Show details of remote | `git remote show remote_name` |
| Delete branch from remote | `git push origin :branch_name` |
| Resolve all conflicting files below a directory with the remote side of the merge (use ours for the local side) | `grep -lr '<<<<' . | xargs git checkout --theirs --` |
| Resolve conflics in specific file/directory | `git mergetool <file/directory>` |
| Reset resolved merge conflict to conflicted state | `git checkout -m <file>` |
| Remove local branches no longer present on remote | `git remote prune origin` |
| Reset local repo to nth commit behind current HEAD | `git reset --hard HEAD~n` |
| Revert commit without committing | `git revert -n <sha1>` |
| Stage changes interactively | `git add -p` |
| Checkout previously checked-out branch | `git checkout -` |
| Search in git command history | `CTRL-R` |
| Check out file from another branch | `git checkout <branch_name> -- <paths>` |
| Cherry pick a merge commit, appending a line saying “cherry picked from commit” | `git cherry-pick -x -m 1 <sha1>` |
---
# So you have a mess on your hands
<img src="./images/git-pretty.png"/>
</textarea>
<script>require=(function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0].call(u.exports,function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;s<n.length;s++)i(n[s]);return i})({"components/printing":[function(require,module,exports){
module.exports=require('yoGRCZ');
},{}],"yoGRCZ":[function(require,module,exports){
var EventEmitter = require('events').EventEmitter
, styler = require('components/styler')
;
var LANDSCAPE = 'landscape'
, PORTRAIT = 'portrait'
, PAGE_HEIGHT = 681
, PAGE_WIDTH = 908
;
function PrintComponent () {}
// Add eventing
PrintComponent.prototype = new EventEmitter();
// Sets up listener for printing
PrintComponent.prototype.init = function () {
var self = this;
this.setPageOrientation(LANDSCAPE);
if (!window.matchMedia) {
return false;
}
window.matchMedia('print').addListener(function (e) {
self.onPrint(e);
});
};
// Handles printing event
PrintComponent.prototype.onPrint = function (e) {
var slideHeight;
if (!e.matches) {
return;
}
this.emit('print', {
isPortrait: this._orientation === 'portrait'
, pageHeight: this._pageHeight
, pageWidth: this._pageWidth
});
};
PrintComponent.prototype.setPageOrientation = function (orientation) {
if (orientation === PORTRAIT) {
// Flip dimensions for portrait orientation
this._pageHeight = PAGE_WIDTH;
this._pageWidth = PAGE_HEIGHT;
}
else if (orientation === LANDSCAPE) {
this._pageHeight = PAGE_HEIGHT;
this._pageWidth = PAGE_WIDTH;
}
else {
throw new Error('Unknown print orientation: ' + orientation);
}
this._orientation = orientation;
styler.setPageSize(this._pageWidth + 'px ' + this._pageHeight + 'px');
};
// Export singleton instance
module.exports = new PrintComponent();
},{"events":1,"components/styler":"syTcZF"}],"components/slide-number":[function(require,module,exports){
module.exports=require('GSZq7a');
},{}],"GSZq7a":[function(require,module,exports){
module.exports = SlideNumberViewModel;
function SlideNumberViewModel (slide, slideshow) {
var self = this;
self.slide = slide;
self.slideshow = slideshow;
self.element = document.createElement('div');
self.element.className = 'remark-slide-number';
self.element.innerHTML = formatSlideNumber(self.slide, self.slideshow);
}
function formatSlideNumber (slide, slideshow) {
var format = slideshow.getSlideNumberFormat()
, slides = slideshow.getSlides()
, current = getSlideNo(slide, slideshow)
, total = getSlideNo(slides[slides.length - 1], slideshow)
;
if (typeof format === 'function') {
return format.call(slideshow, current, total);
}
return format
.replace('%current%', current)
.replace('%total%', total);
}
function getSlideNo (slide, slideshow) {
var slides = slideshow.getSlides(), i, slideNo = 0;
for (i = 0; i <= slide.getSlideIndex() && i < slides.length; ++i) {
if (slides[i].properties.count !== 'false') {
slideNo += 1;
}
}
return Math.max(1, slideNo);
}
},{}],2:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
process.nextTick = (function () {
var canSetImmediate = typeof window !== 'undefined'
&& window.setImmediate;
var canPost = typeof window !== 'undefined'
&& window.postMessage && window.addEventListener
;
if (canSetImmediate) {
return function (f) { return window.setImmediate(f) };
}
if (canPost) {
var queue = [];
window.addEventListener('message', function (ev) {
var source = ev.source;
if ((source === window || source === null) && ev.data === 'process-tick') {
ev.stopPropagation();
if (queue.length > 0) {
var fn = queue.shift();
fn();
}
}
}, true);
return function nextTick(fn) {
queue.push(fn);
window.postMessage('process-tick', '*');
};
}
return function nextTick(fn) {
setTimeout(fn, 0);
};
})();
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.binding = function (name) {
throw new Error('process.binding is not supported');
}
// TODO(shtylman)
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
},{}],1:[function(require,module,exports){
(function(process){if (!process.EventEmitter) process.EventEmitter = function () {};
var EventEmitter = exports.EventEmitter = process.EventEmitter;
var isArray = typeof Array.isArray === 'function'
? Array.isArray
: function (xs) {
return Object.prototype.toString.call(xs) === '[object Array]'
}
;
function indexOf (xs, x) {
if (xs.indexOf) return xs.indexOf(x);
for (var i = 0; i < xs.length; i++) {
if (x === xs[i]) return i;
}
return -1;
}
// By default EventEmitters will print a warning if more than
// 10 listeners are added to it. This is a useful default which
// helps finding memory leaks.
//
// Obviously not all Emitters should be limited to 10. This function allows
// that to be increased. Set to zero for unlimited.
var defaultMaxListeners = 10;
EventEmitter.prototype.setMaxListeners = function(n) {
if (!this._events) this._events = {};
this._events.maxListeners = n;
};
EventEmitter.prototype.emit = function(type) {
// If there is no 'error' event listener then throw.
if (type === 'error') {
if (!this._events || !this._events.error ||
(isArray(this._events.error) && !this._events.error.length))
{
if (arguments[1] instanceof Error) {
throw arguments[1]; // Unhandled 'error' event
} else {
throw new Error("Uncaught, unspecified 'error' event.");
}
return false;
}
}
if (!this._events) return false;
var handler = this._events[type];
if (!handler) return false;
if (typeof handler == 'function') {
switch (arguments.length) {
// fast cases
case 1:
handler.call(this);
break;
case 2:
handler.call(this, arguments[1]);
break;
case 3:
handler.call(this, arguments[1], arguments[2]);
break;
// slower
default:
var args = Array.prototype.slice.call(arguments, 1);
handler.apply(this, args);
}
return true;
} else if (isArray(handler)) {
var args = Array.prototype.slice.call(arguments, 1);
var listeners = handler.slice();
for (var i = 0, l = listeners.length; i < l; i++) {
listeners[i].apply(this, args);
}
return true;
} else {
return false;
}
};
// EventEmitter is defined in src/node_events.cc
// EventEmitter.prototype.emit() is also defined there.
EventEmitter.prototype.addListener = function(type, listener) {
if ('function' !== typeof listener) {
throw new Error('addListener only takes instances of Function');
}
if (!this._events) this._events = {};
// To avoid recursion in the case that type == "newListeners"! Before
// adding it to the listeners, first emit "newListeners".
this.emit('newListener', type, listener);
if (!this._events[type]) {
// Optimize the case of one listener. Don't need the extra array object.
this._events[type] = listener;
} else if (isArray(this._events[type])) {
// Check for listener leak
if (!this._events[type].warned) {
var m;
if (this._events.maxListeners !== undefined) {
m = this._events.maxListeners;
} else {
m = defaultMaxListeners;
}
if (m && m > 0 && this._events[type].length > m) {
this._events[type].warned = true;
console.error('(node) warning: possible EventEmitter memory ' +
'leak detected. %d listeners added. ' +
'Use emitter.setMaxListeners() to increase limit.',
this._events[type].length);
console.trace();
}
}
// If we've already got an array, just append.
this._events[type].push(listener);
} else {
// Adding the second element, need to change to array.
this._events[type] = [this._events[type], listener];
}
return this;
};
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
EventEmitter.prototype.once = function(type, listener) {
var self = this;
self.on(type, function g() {
self.removeListener(type, g);
listener.apply(this, arguments);
});
return this;
};
EventEmitter.prototype.removeListener = function(type, listener) {
if ('function' !== typeof listener) {
throw new Error('removeListener only takes instances of Function');
}
// does not use listeners(), so no side effect of creating _events[type]
if (!this._events || !this._events[type]) return this;
var list = this._events[type];
if (isArray(list)) {
var i = indexOf(list, listener);
if (i < 0) return this;
list.splice(i, 1);
if (list.length == 0)
delete this._events[type];
} else if (this._events[type] === listener) {
delete this._events[type];
}
return this;
};
EventEmitter.prototype.removeAllListeners = function(type) {
if (arguments.length === 0) {
this._events = {};
return this;
}
// does not use listeners(), so no side effect of creating _events[type]
if (type && this._events && this._events[type]) this._events[type] = null;
return this;
};
EventEmitter.prototype.listeners = function(type) {
if (!this._events) this._events = {};
if (!this._events[type]) this._events[type] = [];
if (!isArray(this._events[type])) {
this._events[type] = [this._events[type]];
}
return this._events[type];
};
})(require("__browserify_process"))
},{"__browserify_process":2}],3:[function(require,module,exports){
var Api = require('./remark/api')
, polyfills = require('./polyfills')
, styler = require('components/styler')
;
// Expose API as `remark`
window.remark = new Api();
// Apply polyfills as needed
polyfills.apply();
// Apply embedded styles to document
styler.styleDocument();
},{"components/styler":"syTcZF","./remark/api":4,"./polyfills":5}],"components/styler":[function(require,module,exports){
module.exports=require('syTcZF');
},{}],"syTcZF":[function(require,module,exports){
var resources = require('../../resources')
, highlighter = require('../../highlighter')
;
module.exports = {
styleDocument: styleDocument
, setPageSize: setPageSize
};
// Applies bundled styles to document
function styleDocument () {
var headElement, styleElement, style;
// Bail out if document has already been styled
if (getRemarkStylesheet()) {
return;
}
headElement = document.getElementsByTagName('head')[0];
styleElement = document.createElement('style');
styleElement.type = 'text/css';
// Set title in order to enable lookup
styleElement.title = 'remark';
// Set document styles
styleElement.innerHTML = resources.documentStyles;
// Append highlighting styles
for (style in highlighter.styles) {
if (highlighter.styles.hasOwnProperty(style)) {
styleElement.innerHTML = styleElement.innerHTML +
highlighter.styles[style];
}
}
// Put element first to prevent overriding user styles
headElement.insertBefore(styleElement, headElement.firstChild);
}
function setPageSize (size) {
var stylesheet = getRemarkStylesheet()
, pageRule = getPageRule(stylesheet)
;
pageRule.style.size = size;
}
// Locates the embedded remark stylesheet
function getRemarkStylesheet () {
var i, l = document.styleSheets.length;
for (i = 0; i < l; ++i) {
if (document.styleSheets[i].title === 'remark') {
return document.styleSheets[i];
}
}
}
// Locates the CSS @page rule
function getPageRule (stylesheet) {
var i, l = stylesheet.cssRules.length;
for (i = 0; i < l; ++i) {
if (stylesheet.cssRules[i] instanceof window.CSSPageRule) {
return stylesheet.cssRules[i];
}
}
}
},{"../../resources":6,"../../highlighter":7}],"components/timer":[function(require,module,exports){
module.exports=require('GFo1Ae');
},{}],"GFo1Ae":[function(require,module,exports){
var utils = require('../../utils');