Skip to content

Instantly share code, notes, and snippets.

## ----, include=FALSE-----------------------------------------------------
library(knitr)
## ------------------------------------------------------------------------
source("pre_azw.R")
## ------------------------------------------------------------------------
;; Usage Example:
;;
;; <!-- BEGIN RECEIVE ORGTBL ${1:YOUR_TABLE_NAME} -->
;; <!-- END RECEIVE ORGTBL $1 -->
;;
;; <!--
;; #+ORGTBL: SEND $1 orgtbl-to-gfm
;; | $0 |
;; -->
@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:
#!/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>...]
[[ -x /usr/local/bin/zsh ]] && \
grep '^/usr/local/bin/zsh' /etc/shells && \
sudo sh -c 'echo /usr/local/l/bin/zsh >> /etc/shells'
@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
@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
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))), `|`)
}
library(tidyverse, purrr)
df <- tribble(~a, ~b, ~c, ~d,
1, 2, NA, 1,
1, 2, 3, NA,
2, 2, 1, 1,
2, 2, 1, 2)
keys_to_merge <- df %>% group_by(a,b) %>%
summarise_each(funs(sum(unique(.) %>% is.na %>% `!`))) %>%
@arbelt
arbelt / -
Last active September 14, 2017 20:44
fish abbreviations
abbr R 'R --no-save'
abbr gst 'git status'
abbr gd 'git diff'
abbr ga 'git add'
abbr gc 'git commit'
abbr gdc 'git diff --cached'
abbr gcm 'git commit -m'
abbr gdt 'git difftool --extcmd icdiff'
abbr gl 'git pull'
abbr gco 'git checkout'