brew install gperftools
LDFLAGS=`pkg-config libprofiler --libs`
# Clone the happy-git-with-r repository locally | |
# List the current remotes | |
# Hint: use `git remote -v` for more information | |
# Fork the repository on GitHub | |
# Add your forked remote (call it 'mine') | |
# Hint: `git remote add` |
# Start a new git project | |
# Hint: (`git init`) or in RStudio `File -> New Project -> check Create a git repository` | |
# All students, Pick up your wands | |
# Hint: Open a text file add 'pick up wand' to it, and commit the result | |
# Have Ron (try) to cast wingardium leviosa | |
# Remember: Ron pronounces this 'Wingardium Leviosaaaaaaaa' | |
# Hint: create the Ron branch and check it out, then commit Ron's spell on a new line |
# find . -name 'NAMESPACE' -type f | xargs -P 8 rg 'export\(.*<-' -i -l | perl -pe 's!/NAMESPACE!!' | |
abind | |
adegenet | |
ade4 | |
AMModels | |
analyz | |
apex | |
arrayhelpers | |
arsenal | |
assertive.base |
# On macOS Anki media files are stored in ~/Library/Application Support/Anki2/Username/collection.media/ | |
# https://apps.ankiweb.net/docs/manual.html#file-locations | |
# get images from Unconf repo, resize them and write them to the new path | |
# Code assumes it is being run on macOS from the checkout of the conference repo, e.g. `git clone https://github.com/ropensci/unconf18 && cd unconf18` | |
library(fs) | |
library(magick) | |
imgs <- dir_ls("images/participants") | |
for (f in imgs) { | |
f %>% | |
image_read() %>% |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <Rcpp.h> | |
// From https://en.m.wikipedia.org/wiki/Boyer%E2%80%93Moore_string_search_algorithm | |
#define ALPHABET_LEN 256 | |
#define NOT_FOUND patlen | |
#define max(a, b) ((a < b) ? b : a) | |
// delta1 table: delta1[c] contains the distance between the last |
getOptionOld <- function(x, default = NULL) { | |
## To avoid always performing the %in%, | |
## we use the original code if default is not specified. | |
## if(missing(default)) return(options(x)[[1L]]) | |
if(missing(default) || x %in% names(.Options)) | |
.Internal(getOption(x)) | |
else | |
default | |
} |
library(tidyverse) | |
library(httr) | |
library(jsonlite) | |
library(glue) | |
library(lubridate) | |
# JSON friendly version of glue | |
jlue <- function(..., .envir = parent.frame()) { | |
glue(..., .envir = .envir, .open = "<", .close = ">") | |
} |
# foo() just calls sample | |
foo <- function() invisible(sample(1)) | |
# foo2() sets a new seed | |
foo2 <- function() set.seed(42) |
enum <- function(...) { | |
nms <- eval(substitute(alist(...))) | |
x <- as.list(setNames(seq_along(nms), nms)) | |
f <- tempfile() | |
attach(x, name = f) | |
# Cleanup the enum if when the parent frame exists | |
# unless we are in the global environment. | |
if (!identical(parent.frame(), globalenv())) { | |
withr::defer(detach(name = f), parent.frame()) | |
} |