Skip to content

Instantly share code, notes, and snippets.

@jhollist
jhollist / bibify_pkgs.R
Last active March 14, 2018 21:49
An R function to turn a vector of package names into a bibliorgraphy
#' Generate a bibliography of packages
#'
#' This function creates an output bibliography from an input character vector
#' of package names. The primary use case for this function is when working
#' with other authors and you need to provide a reference list of packages used.
#'
#' @param pkgs A character vector of packages
#' @param csl A csl file used to format the output bibliography. Good place to
#' look for these is \url{https://github.com/citation-style-language/styles}
#' @param append_bib Existing \code{.bib} file to append package citations to.
@thomasp85
thomasp85 / particles.R
Created February 26, 2018 19:33
Particles on CRAN
library(tidygraph)
library(particles)
library(jsonlite)
library(magick)
# Prepare text polygons
text <- read_json('text.json')
par_text <- text$layers[[3]]$paths
on_text <- text$layers[[2]]$paths
cran_text <- text$layers[[1]]$paths
library(magick)
library(reshape2)
library(dplyr)
library(tidygraph)
library(particles)
library(animation)
plot_fun <- function(sim) {
df <- as_tibble(sim)
plot(df$x, df$y, col = df$color, pch = '.', axes = FALSE, xlim = c(-100, 317), ylim = c(-268, 100), xlab = NA, ylab = NA)
@gaborcsardi
gaborcsardi / Pkgdown deploy from Travis.md
Last active November 17, 2021 13:41
Walkthrough: deploy a pkgdown site from Travis

Run usethis::use_pkgdown_travis()

usethis::use_pkgdown_travis()
✔ Setting active project to '/Users/gaborcsardi/works/ps'Adding 'docs/' to '.gitignore'Set up deploy keys by running `travis::use_travis_deploy()`Insert the following code in '.travis.yml'
  before_cache: Rscript -e 'remotes::install_cran("pkgdown")'
@jb510
jb510 / ReadMe.md
Last active January 20, 2022 15:42 — forked from boogah/ale.bash
Auto Update Brew: OS X Launchd job and script to automatically update homebrew
  1. Place homebrewupdate.sh where ever you like, I use ~/bin/homebrewupdate.sh
  2. Place the .plist file in ~/Library/LaunchAgents and update the path to your bash script
  3. run launchctl load ~/Library/LaunchAgents/com.jb510.homebrewupdate.plist or whatever you've named your plist file.
  4. check launchctl list | grep jb510 to see that it's running

Note: You might need to chmod +x homebrewupdate.sh

Note 2: you can run this manually to test your script ~/bin/homebrewupdate.sh

Future: Update this to also update casks https://github.com/buo/homebrew-cask-upgrade or using brew cask list | xargs brew cask reinstall

@aronatkins
aronatkins / install-rstudio-daily.sh
Last active February 10, 2022 08:54
Install RStudio daily build on OSX/macOS or Ubuntu Linux
#!/bin/bash
#
# Installs the latest RStudio daily desktop build for OSX/macOS and Ubuntu(amd64)
#
# https://support.rstudio.com/hc/en-us/articles/203842428-Getting-the-newest-RStudio-builds
set -e
install_macos_daily() {
REDIRECT_URL="https://www.rstudio.org/download/latest/daily/desktop/mac/RStudio-latest.dmg"
@hrbrmstr
hrbrmstr / do_rpt.r
Last active March 16, 2023 21:51
parallel, parameterized knitr reports
library(doParallel)
rpts <- list(list(out="one.html", params=list(some_var="One")),
list(out="two.html", params=list(some_var="Two")),
list(out="three.html", params=list(some_var="Three")),
list(out="four.html", params=list(some_var="Four")))
do_rpt <- function(r) {
require(rmarkdown)

App Install Plan

Critical