This file contains hidden or 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
library(purrr) | |
l1 <- list(a = list(a1 = 1:10)) | |
l2 <- list(a = list(a2 = 10:20)) | |
list_merge(l1, l2) | |
#' But both `l1` and `l2` are named... so arguments should be named? | |
list_merge(x = l1, y = l2) | |
#' Oh, l2 is implicitly unnamed because it's in dots | |
list_merge(l1, y = l2) | |
#' But what I *really* wanted was this | |
list_modify(l1, rlang::splice(l2)) |
This file contains hidden or 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
--- | |
output: github_document | |
--- | |
# magick  | |
##### *Advanced Image-Processing in R* | |
[](https://travis-ci.org/ropensci/magick) | |
[](https://ci.appveyor.com/project/jeroen/magick) |
This file contains hidden or 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
#!/usr/bin/env Rscript | |
# License: CC0 (just be nice and point others to where you got this) | |
# Author: Robert M Flight <[email protected]>, github.com/rmflight | |
# | |
# This is a post-commit hook that after a successful commit subsequently increments the package version in DESCRIPTION | |
# and commits that. Analogous to the pre-commit at https://gist.github.com/rmflight/8863882, but useful if you only have | |
# good reasons for not doing it on the pre-commit. | |
# | |
# To install it, simply copy this into the ".git/hooks/post-commit" file of your git repo, change /path/2/Rscript, and make |
This file contains hidden or 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
#' Render Table of Contents | |
#' | |
#' A simple function to extract headers from an RMarkdown or Markdown document | |
#' and build a table of contents. Returns a markdown list with links to the | |
#' headers using | |
#' [pandoc header identifiers](http://pandoc.org/MANUAL.html#header-identifiers). | |
#' | |
#' WARNING: This function only works with hash-tag headers. | |
#' | |
#' Because this function returns only the markdown list, the header for the |
This file contains hidden or 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
--- | |
title: regextest notes | |
output: | |
html_document: | |
css: inst/style.css | |
keep_md: yes | |
--- | |
```{r setup, include=FALSE} | |
library(purrr) |
This file contains hidden or 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
#!/bin/sh | |
palette="/tmp/palette.png" | |
filters="fps=6,scale=720:-1:flags=bicubic" | |
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette | |
ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2 |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>{{title}}</title> | |
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700,400italic,700italic' rel='stylesheet' type='text/css'> | |
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro' rel='stylesheet' type='text/css'> | |
<!-- <link rel="stylesheet" href="https://unpkg.com/[email protected]/build/base-min.css"> --> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<style type="text/css"> | |
body { |
This file contains hidden or 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
#' Basic miniUI Gadget Function | |
#' | |
#' Single view with button row along the bottom | |
basic_miniUI_gadget <- function() { | |
require(shiny) | |
require(miniUI) | |
ui <- miniPage( | |
gadgetTitleBar("Shiny gadget example"), | |
miniContentPanel( |
This file contains hidden or 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
#' Create a public Github gist and send to carbon.now.sh, then browse to both. | |
#' | |
#' Create a public Github gist and browse to it, then open the gist in | |
#' [carbon.now.sh](https://carbon.now.sh), for easily Tweeting a saucy code pic. | |
#' The gist will contain the active text selection or the active RStudio tab. | |
#' Gist file is named: `RStudio_<project>_<filename or file_id>`. `file_id` is | |
#' a unique id for untitled files. It does not relate to the untitled number. | |
#' @return nothing. | |
#' @export | |
gistfoc <- function() gistfo_base(mode = "carbon") |
This file contains hidden or 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
find_used_libraries <- function(path = getwd(), include_rmd = FALSE, by_file = FALSE) { | |
library(tidyverse) | |
if (!requireNamespace('sessioninfo', quietly = TRUE)) { | |
install.packages("sessioninfo") | |
library(sessioninfo) | |
} | |
library_pattern <- paste( | |
"(?:library|require)\\((.+?)\\)", # pkgs via library, require, etc. | |
"requireNamespace\\(['\"](.+?)['\"].+?\\)", | |
"([[:alnum:]_]+):{2,3}[[:alnum:]_]+", # pkgs via pkgname::function() |