Skip to content

Instantly share code, notes, and snippets.

View gadenbuie's full-sized avatar
💭
sending beep-boops back to the Snarfus

Garrick Aden-Buie gadenbuie

💭
sending beep-boops back to the Snarfus
View GitHub Profile
@gadenbuie
gadenbuie / create-worktree
Last active February 6, 2026 20:43
tiny bash script to quickly spin up a new worktree and open a new ide session
#!/usr/bin/env bash
#
# Source: https://gist.github.com/gadenbuie/6a9d1b8088f6bc9154b6c534896bbd25
set -e
# ==============================================================================
# Color and formatting setup (respects NO_COLOR)
# ==============================================================================
@gadenbuie
gadenbuie / update-rstudio
Last active February 4, 2026 21:55 — forked from wch/update-rstudio
Script for updating to latest RStudio daily build
#!/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
#
# Source: https://gist.github.com/gadenbuie/7bb14b245a45e08173e54bc75ec38790
set -e
# These functions were borrowed from klmr/box
# https://github.com/klmr/box/tree/5e411d47/scripts
#+
verify_function_has_value = function (file) {
rd = tools::parse_Rd(file)
type = find_tag(rd, 'docType')
(length(type) != 0L && type != 'function') || length(find_tag(rd, 'value')) != 0L
}
@gadenbuie
gadenbuie / render_toc.R
Last active April 24, 2025 09:54
Generate Manual Table of Contents in (R)Markdown Documents
#' 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
@gadenbuie
gadenbuie / gh_contributors.R
Last active April 22, 2025 14:17
Investigate contributions to a repo
# Install and load required packages
# install.packages("gh")
library(gh)
library(dplyr)
library(purrr)
# Get all contributors to a GitHub repository
get_repo_contributors <- function(owner, repo) {
contributors <- gh::gh(
"GET /repos/{owner}/{repo}/contributors",
@gadenbuie
gadenbuie / 01-hello-dashboards.R
Last active April 14, 2025 22:05
Example apps using bslib v0.5.0
# https://shiny.posit.co/blog/posts/bslib-dashboards/#hello-dashboards
library(shiny)
library(bslib)
library(ggplot2)
# Setup -------------------------------------------------------------------
data(penguins, package = "palmerpenguins")
@gadenbuie
gadenbuie / app.R
Created March 6, 2025 21:30
shiny cows
library(shiny)
library(bslib)
library(dplyr)
library(ggplot2)
# Sample cow data
cow_data <- data.frame(
name = c("Bessie", "Daisy", "Buttercup", "Molly", "Clover", "Rosie", "Bella", "Penny", "Lulu", "Mabel"),
breed = c("Holstein", "Jersey", "Angus", "Hereford", "Guernsey", "Simmental", "Holstein", "Jersey", "Angus", "Guernsey"),
milk_per_day = c(28, 25, 0, 0, 27, 0, 30, 24, 0, 26),

App Install Plan

Critical

---
title: "Presentation Ninja"
subtitle: "⚔<br/>with xaringan"
author: "Yihui Xie"
date: "2016/12/12 (updated: `r Sys.Date()`)"
output:
xaringan::moon_reader:
lib_dir: libs
css:
- default
snps <-
list(r = "~/.config/rstudio/snippets/r.snippets") %>%
purrr::map(readLines, warn = FALSE) %>%
purrr::map(paste, collapse = "\n") %>%
purrr::map(trimws) %>%
purrr::map(strsplit, split = "(^|\n)snippet ") %>%
purrr::map_depth(2, ~ .x[.x != ""]) %>%
purrr::map_depth(2, ~ {
nm <- gsub("^([^\n\t ]+).*", "\\1", .x)
names(.x) <- nm