Skip to content

Commit

Permalink
hello, world!
Browse files Browse the repository at this point in the history
  • Loading branch information
gadenbuie committed Nov 8, 2019
0 parents commit 636fbfd
Show file tree
Hide file tree
Showing 31 changed files with 3,252 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
^xaringanExtra\.Rproj$
^\.Rproj\.user$
^docs$
75 changes: 75 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# ---- Default .gitignore From grkmisc ----
.Rproj.user
.Rhistory
.RData
.DS_Store

# Directories that start with _
_*/

## https://github.com/github/gitignore/blob/master/R.gitignore
# History files
.Rhistory
.Rapp.history

# Session Data files
.RData

# Example code in package build process
*-Ex.R

# Output files from R CMD build
/*.tar.gz

# Output files from R CMD check
/*.Rcheck/

# RStudio files
.Rproj.user/

# produced vignettes
vignettes/*.html
vignettes/*.pdf

# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
.httr-oauth

# knitr and R markdown default cache directories
/*_cache/
/cache/

# Temporary files created by R markdown
*.utf8.md
*.knit.md

# Shiny token, see https://shiny.rstudio.com/articles/shinyapps.html
rsconnect/

## https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
24 changes: 24 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Package: xaringanExtra
Title: Extras And Addons for Xaringan Slides
Version: 0.0.1
Authors@R:
c(person(given = "Garrick",
family = "Aden-Buie",
role = c("aut", "cre"),
email = "garrick@aden-buie.com",
comment = c(ORCID = "0000-0002-7111-0077")),
person(given = "Yotam",
family = "Mann",
role = "ctb",
comment = "tone.js"))
Description: Extra addons for xaringan slides.
License: MIT + file LICENSE
Imports:
htmltools,
utils
Suggests:
xaringan
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 6.1.1
6 changes: 6 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Generated by roxygen2: do not edit by hand

export(xaringan_slide_tone)
export(xaringan_slide_tone_dependency)
export(xaringan_tile_view)
export(xaringan_tile_view_dependency)
41 changes: 41 additions & 0 deletions R/slide-tone.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#' Slide Tone
#'
#' Slide tone plays a subtle sound when you change slides.The tones increase in
#' pitch for each slide from a low C to a high C note. The tone pitch stays the
#' same for incremental slides.
#'
#' @return An [htmltools::tagList] with the slide tone dependencies, or an
#' [htmltools::htmlDependency].
#' @section Usage: To add slide tone to your xaringan presentation, add the
#' following code chunk to your slides' R Markdown file.
#'
#' ````markdown
#' ```{r xaringan-slide-tone, echo=FALSE}
#' xaringanExtra::xaringan_slide_tone()
#' ```
#' ````
#'
#' @references [tone.js](https://tonejs.github.io/)
#' @name slide_tone
NULL

#' @describeIn slide_tone Adds slide tone to your xaringan slides.
#' @export
xaringan_slide_tone <- function() {
htmltools::tagList(
xaringan_slide_tone_dependency()
)
}

#' @describeIn slide_tone Returns an [htmltools::htmlDependency] with the tile
#' view dependencies. Most users will want to use `xaringan_slide_tone()`.
#' @export
xaringan_slide_tone_dependency <- function() {
htmltools::htmlDependency(
name = "slide-tone",
version = utils::packageVersion("xaringanExtra"),
package = "xaringanExtra",
src = "slide-tone",
script = c("tone.js", "slide-tone.js")
)
}
42 changes: 42 additions & 0 deletions R/tile-view.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#' Tile View
#'
#' Tile view gives you a way to quickly jump between slides. Just press `T` at
#' any point in your slideshow and the tile view appears. Click on a slide to
#' jump to the slide, or press `T` to exit tile view.
#'
#' @return An [htmltools::tagList] with the tile view dependencies, or an
#' [htmltools::htmlDependency].
#' @section Usage: To add tile view to your xaringan presentation, add the
#' following code chunk to your slides' R Markdown file.
#'
#' ````markdown
#' ```{r xaringan-tile-view, echo=FALSE}
#' xaringanExtra::xaringan_tile_view()
#' ```
#' ````
#'
#' @name tile_view
NULL

#' @describeIn tile_view Adds tile view to your xaringan slides.
#' @export
xaringan_tile_view <- function() {
htmltools::tagList(
xaringan_tile_view_dependency()
)
}

#' @describeIn tile_view Returns an [htmltools::htmlDependency] with the tile
#' view dependencies. Most users will want to use `xaringan_tile_view()`.
#' @export
xaringan_tile_view_dependency <- function() {
htmltools::htmlDependency(
name = "tile-view",
version = utils::packageVersion("xaringanExtra"),
package = "xaringanExtra",
src = "tile-view",
script = "tile-view.js",
stylesheet = "tile-view.css"
)
}

7 changes: 7 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

# use y if x is.null
`%||%` <- function(x, y) if (is.null(x)) y else x

xe_file <- function(...) {
system.file(..., package = "xaringanExtra", mustWork = TRUE)
}
67 changes: 67 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@

# xaringanExtra

<!-- badges: start -->
<!-- badges: end -->

<!-- Links -->
[xaringan]: https://slides.yihuie.name/xaringan

`xaringanExtra` is a playground of enhancements and addins for [xaringan] slides.

## Installation

You can install the current version of xaringanExtra from GitHub.

``` r
# install.packages("devtools")
devtools::install_github("gadenbuie/xaringanExtra")
```

## &#x1F5FA; Tile View

#### &#x1F4FA; [Tile View Demo](https://gadenbuie.github.io/xaringanExtra/tile-view)

Tile view gives you a way to quickly jump between slides.
Just press <kbd>T</kbd> at any point in your slideshow and the tile view appears.
Click on a slide to jump to the slide, or press <kbd>T</kbd> to exit tile view.

![](man/figures/tile-view.png)

To add tile view to your xaringan presentation,
add the following code chunk to your slides' R Markdown file.

````markdown
```{r xaringan-tile-view, echo=FALSE}
xaringanExtra::xaringan_tile_view()
```
````

Tile view is heavily inspired by
(and is essentially a port to Vanilla JavaScript of)
[a jQuery remarkjs hook](https://github.com/StephenHesperus/remark-hook/)
by the same name by [Stephen Hesperus](https://github.com/StephenHesperus).

## &#x1F50A; Slide Tone

#### &#x1F4FA; [Slide Tone Demo](https://gadenbuie.github.io/xaringanExtra/slide-tone)

Slide tone plays a subtle sound when you change slides.
It was
[requested by a blind R user](https://github.com/yihui/xaringan/issues/214)
and enables users to hear an auditory signal of their progress through the slides.

The tones increase in pitch for each slide from a low C to a high C note.
The tone pitch stays the same for incremental slides.

Visit the
[slide tone demo slides](https://gadenbuie.github.io/xaringanExtra/slide-tone)
to experience it yourself.
Or include slide tone in your next xaringan presentation
by adding the following code chunk to your slides' R Markdown.

````markdown
```{r xaringan-slide-tone, echo=FALSE}
xaringanExtra::xaringan_slide_tone()
```
````
89 changes: 89 additions & 0 deletions docs/slide-tone/index.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
title: "xaringan<br/>slide-change sounds<br/>using tone.js"
subtitle: "&#x1F50A;"
author: "<a href='https://www.garrickadenbuie.com/'>Garrick Aden-Buie<a>"
date: 'xaringanExtra'
output:
xaringan::moon_reader:
css: [robot-fonts, robot]
lib_dir: libs
---

```{r slide-tone, echo=FALSE}
options(htmltools.dir.version = FALSE)
xaringanExtra::xaringan_slide_tone()
```

## tone.js demo

<iframe height="450" style="width: 100%;" scrolling="no" title="tone-js-single-note-demo" src="https://codepen.io/grrrck/embed/abogWXm?height=265&theme-id=light&default-tab=html,result" frameborder="no" allowtransparency="true" allowfullscreen="true">
See the Pen <a href='https://codepen.io/grrrck/pen/abogWXm'>tone-js-single-note-demo</a> by garrick
(<a href='https://codepen.io/grrrck'>@grrrck</a>) on <a href='https://codepen.io'>CodePen</a>.
</iframe>

---

class: center middle

## But wait...

--

This
--
slide
--
builds
--
suspense...

---

class: center middle
layout: true

```{r results='asis', echo = FALSE}
# Create 26 place-holder slides with giant letters
glue::glue("
---
# {LETTERS}
"
)
```

---
layout: false
class: center middle

<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="25%" />

### [gadenbuie/xaringanExtra](https://github.com/gadenbuie/xaringanExtra)


```{css echo=FALSE}
/* Fancy Giant Letters */
.remark-slide-content h1 {
margin: 0;
background: -webkit-linear-gradient(#0cbaba, #01baef);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.remark-slide-content:not(.title-slide) h1 {
font-size: 30em;
line-height: 1;
text-shadow: 1px 4px 6px rgba(255,255,255,0.3);
}
a {
color: #01baef;
}
a:hover {
color: #0cbaba;
}
.remark-slide .title-slide h3 {
color: #8d9597;
}
```
Loading

0 comments on commit 636fbfd

Please sign in to comment.