Skip to content

Instantly share code, notes, and snippets.

library(stringr)
library(purrr)
match_multiple <- function(strings, patterns){
match_fns <- map(
as.list(patterns),
~ partial(str_detect, pattern = ., .lazy = FALSE, .first = FALSE))
reduce(invoke_map(match_fns, list(list(strings))), `|`)
}
@arbelt
arbelt / gist:781c43ef581928ab6260dacaf443f274
Created December 23, 2016 23:52 — forked from debasishg/gist:8172796
A collection of links for streaming algorithms and data structures
  1. General Background and Overview
@arbelt
arbelt / init.lua
Created October 2, 2016 20:55
Hammerspoon config to send escape on short ctrl press
ctrl_table = {
sends_escape = true,
last_mods = {}
}
control_key_timer = hs.timer.delayed.new(0.15, function()
ctrl_table["send_escape"] = false
-- log.i("timer fired")
-- control_key_timer:stop()
end
[[ -x /usr/local/bin/zsh ]] && \
grep '^/usr/local/bin/zsh' /etc/shells && \
sudo sh -c 'echo /usr/local/l/bin/zsh >> /etc/shells'
#!/usr/bin/env Rscript
if (!require(pacman, quiet = TRUE)) install.packages("pacman")
pacman::p_load(docopt, dplyr, stringr, purrr)
"
Usage:
package.r [options] <pkgname>
package.r <pkgname> [-i <import>...]
@arbelt
arbelt / 00_theme_mods.R
Last active March 22, 2016 16:14 — forked from hrbrmstr/orig.png
Supreme Annotations - moar splainin here: http://rud.is/b/2016/03/16/supreme-annotations/ - NOTE: this requires the github version of ggplot2
# CAVEATS:
#
# 1. This requires nonstandard fonts. Showtext is the best way to handle this portably, BUT
# it doesn't work within the RStudio viewer pane. Exported files (and knitr) are fine, also
# interactive sessions without RStudio (e.g., using XQuartz).
#
# When working in RStudio, I generally don't change the font and preview an "ugly" version
# of the chart. Just make sure all the elements are set when exporting.
#
# To set up showtext:
;; Usage Example:
;;
;; <!-- BEGIN RECEIVE ORGTBL ${1:YOUR_TABLE_NAME} -->
;; <!-- END RECEIVE ORGTBL $1 -->
;;
;; <!--
;; #+ORGTBL: SEND $1 orgtbl-to-gfm
;; | $0 |
;; -->
## ----, include=FALSE-----------------------------------------------------
library(knitr)
## ------------------------------------------------------------------------
source("pre_azw.R")
## ------------------------------------------------------------------------