-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from alexandergerber/master
added .js for terminal style code highlighting
- Loading branch information
Showing
6 changed files
with
83 additions
and
18 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,8 @@ output: | |
highlightStyle: github | ||
highlightLines: true | ||
countIncrementalSlides: false | ||
includes: | ||
after_body: terminal_highlight.html | ||
# ratio: "16:9" | ||
--- | ||
|
||
|
@@ -304,11 +306,16 @@ background-size: cover | |
|
||
|
||
--- | ||
class: center, middle | ||
|
||
# xaringan | ||
### xaringan | ||
|
||
### /ʃæ.'riŋ.ɡæn/ | ||
```terminal | ||
josh@brick ~/repos/aha $ git log -2 | ||
<span style="color:olive;">commit 36b0a3af174e204c8d0a7a993ad467cd7be39bca</span> | ||
Author: Ziz <[email protected]> | ||
Date: Fri Aug 3 10:29:43 2012 +0200 | ||
Small version changes, make clean, merging, etc. | ||
... | ||
``` | ||
|
||
--- | ||
class: inverse, center, middle | ||
|
@@ -842,3 +849,6 @@ class: center, middle | |
Slides created via the R package [**xaringan**](https://github.com/yihui/xaringan). | ||
|
||
The chakra comes from [remark.js](https://remarkjs.com), [**knitr**](http://yihui.name/knitr), and [R Markdown](https://rmarkdown.rstudio.com). | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
<meta charset="utf-8" /> | ||
<meta name="author" content="Martin Arnold" /> | ||
<meta name="author" content="Alexander Gerber" /> | ||
<meta name="date" content="2019-05-27" /> | ||
<meta name="date" content="2019-06-12" /> | ||
<script src="libs/htmlwidgets/htmlwidgets.js"></script> | ||
<script src="libs/jquery/jquery.min.js"></script> | ||
<link href="libs/leaflet/leaflet.css" rel="stylesheet" /> | ||
|
@@ -31,7 +31,7 @@ | |
# Advanced R for Econometricians | ||
### Martin Arnold | ||
### Alexander Gerber | ||
### 2019-05-27 | ||
### 2019-06-12 | ||
|
||
--- | ||
|
||
|
@@ -75,7 +75,7 @@ | |
|
||
- We are (mostly) happy to accept the slower speed for the time saved from not having to reinvent the wheel each time we want to implement a new function that, e.g., computes a test statistic. | ||
|
||
(meanwhile there are 14290 packages available on [CRAN](https://cran.r-project.org/) with many useful functions waiting to be discovered by you!) | ||
(meanwhile there are 14354 packages available on [CRAN](https://cran.r-project.org/) with many useful functions waiting to be discovered by you!) | ||
|
||
--- | ||
### (Why) is R slow? | ||
|
@@ -220,9 +220,9 @@ | |
``` | ||
## Unit: nanoseconds | ||
## expr min lq mean median uq max neval | ||
## g(x) 585 629 1437.214 665 803 17877928 1e+05 | ||
## h(x) 584 633 1408.318 669 805 16350847 1e+05 | ||
## i(x) 586 629 1265.127 666 804 17243079 1e+05 | ||
## g(x) 577 612 1466.433 636 784 19869745 1e+05 | ||
## h(x) 584 619 1256.307 642 781 18067517 1e+05 | ||
## i(x) 577 615 1405.510 639 783 17562108 1e+05 | ||
``` | ||
|
||
--- | ||
|
@@ -317,8 +317,8 @@ | |
``` | ||
## Unit: nanoseconds | ||
## expr min lq mean median uq max neval | ||
## f1() 108 123 169.6690 131 139 637484 1e+05 | ||
## f2() 179 202 381.2106 214 292 3332593 1e+05 | ||
## f1() 107 125 190.1854 135 153 1337392 1e+05 | ||
## f2() 177 205 378.1311 229 312 2745651 1e+05 | ||
``` | ||
|
||
Arguments trigger promises each time the function is *called*. Superflous arguments mean unecessary overhead. | ||
|
@@ -347,11 +347,16 @@ | |
|
||
|
||
--- | ||
class: center, middle | ||
|
||
# xaringan | ||
|
||
### /ʃæ.'riŋ.ɡæn/ | ||
### xaringan | ||
|
||
```terminal | ||
josh@brick ~/repos/aha $ git log -2 | ||
<span style="color:olive;">commit 36b0a3af174e204c8d0a7a993ad467cd7be39bca</span> | ||
Author: Ziz <[email protected]> | ||
Date: Fri Aug 3 10:29:43 2012 +0200 | ||
Small version changes, make clean, merging, etc. | ||
... | ||
``` | ||
|
||
--- | ||
class: inverse, center, middle | ||
|
@@ -536,7 +541,7 @@ | |
``` | ||
|
||
``` | ||
# [1] "地爆天星" "天照" | ||
# character(0) | ||
``` | ||
|
||
--- | ||
|
@@ -1035,6 +1040,19 @@ | |
deleted = true; | ||
}); | ||
})();</script> | ||
<script type="text/javascript"> | ||
var hljs = remark.highlighter.engine; | ||
</script> | ||
<script src="terminal.language.js" type="text/javascript"></script> | ||
<script type="text/javascript"> | ||
var slideshow = remark.create({}); | ||
// extract the embedded styling from ansi spans | ||
var highlighted = document.querySelectorAll("code.terminal span.hljs-ansi"); | ||
Array.prototype.forEach.call(highlighted, function(next) { | ||
next.insertAdjacentHTML("beforebegin", next.textContent); | ||
next.parentNode.removeChild(next); | ||
}); | ||
</script> | ||
|
||
<script> | ||
(function() { | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
Language: terminal console | ||
Author: Josh Bode <[email protected]> | ||
*/ | ||
|
||
hljs.registerLanguage('terminal', function() { | ||
return { | ||
contains: [ | ||
{ | ||
className: 'string', | ||
begin: '^([\\w.]+)@([\\w.]+)' | ||
}, | ||
{ | ||
className: 'constant', | ||
begin: ' (.*) \\$ ' | ||
}, | ||
{ | ||
className: 'ansi', | ||
begin: '<span style\\="([^"]+)">', | ||
end: '<\\/span>' | ||
} | ||
] | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<script type="text/javascript"> | ||
var hljs = remark.highlighter.engine; | ||
</script> | ||
<script src="terminal.language.js" type="text/javascript"></script> | ||
<script type="text/javascript"> | ||
var slideshow = remark.create({}); | ||
// extract the embedded styling from ansi spans | ||
var highlighted = document.querySelectorAll("code.terminal span.hljs-ansi"); | ||
Array.prototype.forEach.call(highlighted, function(next) { | ||
next.insertAdjacentHTML("beforebegin", next.textContent); | ||
next.parentNode.removeChild(next); | ||
}); | ||
</script> |