Skip to content

Instantly share code, notes, and snippets.

View gadenbuie's full-sized avatar

Garrick Aden-Buie gadenbuie

View GitHub Profile
@gadenbuie
gadenbuie / git-remotes-https.R
Created August 20, 2024 12:36
git, convert remotes from ssh to https
library(dplyr)
remotes <- gert::git_remote_list()
remotes |>
mutate(
url = sub("[email protected]:", "https://github.com/", url, fixed = TRUE),
url = sub(".git", "", url, fixed = TRUE)
) |>
purrr::pwalk(function(name, url) {
alias_input_from_shiny <- function(
input = "actionLink",
update = NULL,
new_input = NULL,
new_update = NULL
) {
if (is.null(update)) {
update <- paste0("update", toupper(substr(input, 1, 1)), substring(input, 2))
}
@gadenbuie
gadenbuie / cities.json
Created April 16, 2024 12:45
World-wide cities with population 15k+
This file has been truncated, but you can view the full file.
[
{
"name": "les Escaldes",
"state": "Escaldes-Engordany",
"country": "Andorra",
"latitude": 42.5073,
"longitude": 1.5341,
"timezone": "Europe/Andorra"
},
{
@gadenbuie
gadenbuie / utpr.R
Last active March 14, 2024 14:30
usethis pr command line helper
#! /usr/bin/env Rscript
if (!requireNamespace("rlang", quietly = TRUE)) {
stop("`utpr` requires `{usethis}`: install.packages('usethis')")
}
rlang::check_installed(c("usethis", "cli", "docopt"))
'
A command-line wrapper for `pr_*` helper functions from {usethis}.
@gadenbuie
gadenbuie / bslib-function-prefixes.md
Last active July 13, 2023 14:16
bslib function prefixes
library(tidyverse)

bsf <- pkgnet::FunctionReporter$new()
bsf$set_package("bslib")
bsf$calculate_default_measures()
bslib_fns <-
@gadenbuie
gadenbuie / 01-hello-dashboards.R
Last active July 16, 2024 10:42
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")
Installing package into ‘/Users/garrick/Library/R/arm64/4.3/library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/httpuv_1.6.10.tar.gz'
Content type 'application/x-gzip' length 1875497 bytes (1.8 MB)
==================================================
downloaded 1.8 MB
* installing *source* package ‘httpuv’ ...
** package ‘httpuv’ successfully unpacked and MD5 sums checked
** using staged installation
---
title: Reading a YAML chunk
output: github_document
---
Here's a simple YAML chunk (with the label `config`):
```{yaml config}
default:
user: "garrick"
@gadenbuie
gadenbuie / pkgdown-watch.R
Last active May 11, 2023 03:40
Watch a package and rebuild pkgdown docs when they change
#!/usr/bin/env -S Rscript --vanilla
rlang::check_installed(c("docopt", "pkgdown", "servr", "fs", "pkgload"))
'usage:
pkgdown-watch [--port=<port> --rebuild --no-sound]
pkgdown-watch -h | --help
options:
--port=<port> Port to use for the server [default: 4323]