This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# purge_merged_branches is a BASH function to delete branches that have been merged into the current branch. | |
# It excludes branch names that are probably the primary branch of the source code. | |
# Specifically, it excludes develop, main, and master. | |
# Please review these choices carefully and adapt the script to your needs before using. | |
purge_merged_branches() { | |
# purge merged branches | |
## locally | |
git branch --merged | grep -v develop | grep -v main | grep -v master | xargs -i git branch -d {} | |
## on origin | |
git remote prune origin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Draft the next ChangeLog.md / NEWS.md entry when releasing via gitflow | |
# by enumerating all the commits since the last release and displaying | |
# them below release header. It formats everything in a markdown-friendly | |
# syntax | |
# | |
# **Caveats** - so many caveats | |
# This command requires releases to be tagged with version numbers | |
# that conform to "sort --version-sort". | |
# | |
# This function produces better results if you use gitflow and are on the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# gfrc - Git Flow Release Commit | |
# Expedite updates to a CHANGELOG.md or NEWS.md file, | |
# R Package DESCRIPTION file, and CITATION.cff | |
# during a `git flow release` | |
# Thanks to Kyle Chesney for some great ideas. | |
gfrc() { | |
if [ -f 'CHANGELOG.md' ]; then | |
CL_FILENAME=CHANGELOG.md | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -eq 0 ]; then | |
echo "sync.sh: a REDCap module sync script" | |
echo "Use:" | |
echo "./sync.sh my_module_v0.0.0 my_host.ini" | |
echo "Optional flags (place after other arguments)" | |
echo "--version=x.y.z: change the version on the target server, defaults to contents of VERSION" | |
echo "USER: override the USER set in your ini file" | |
echo "HOST: override the HOST set in your ini file" | |
echo "PATH_TO_MODULES_DIR: override the PATH_TO_MODULES_DIR set in your ini file" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to make a grid of labeled hyperlinks in an XLSX with tidyverse and openxlsx | |
# An example for adaptation to the ADRC NACC error report | |
library(tidyverse) | |
library(openxlsx) | |
library(lubridate) | |
ptid <- c("310011", "310012") | |
visitnum <- c(2, 1) | |
visit_date <- ymd(c("2024-01-02", "2024-02-02")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pick_a_categorical_field_response <- function(metadata) { | |
response_codes <- | |
metadata |> | |
dplyr::filter(.data$field_type %in% c("checkbox", "radio", "dropdown")) |> | |
dplyr::select(c("field_name", "field_type", "select_choices_or_calculations")) |> | |
tidyr::separate_longer_delim("select_choices_or_calculations", delim = " | ") |> | |
tidyr::separate_wider_delim("select_choices_or_calculations", delim = ", ", names = c("response_code", "response_label"), too_many = "merge") | |
single_value_responses <- response_codes |> | |
filter(field_type != "checkbox") |> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# make_rdc_instance.sh | |
# This is a helper script for https://github.com/123andy/redcap-docker-compose | |
usage() { | |
echo "Usage: $0 [-v <redcap_version_number_sans_periods>] [-m <modules_directory>] [-s <suffix>] [-g]" 1>&2 | |
echo " " 1>&2 | |
echo " -v: Please provide a 3 or 4-digit REDCap version number without periods." 1>&2 | |
echo " Using this number, this script will copy the rdc folder to a new folder and configure the environment" 1>&2 | |
echo " with unique port numbers and instance name." 1>&2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(lubridate) | |
library(dotenv) | |
library(redcapcustodian) # devtools::install_github("ctsit/redcapcustodian") | |
library(DBI) | |
library(RMariaDB) | |
script_name <- "identify_log_event_consumers" | |
connect_to_redcap_with_schema <- function(schema = NULL) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Convert keep-a-change-log format to match pkgdown standards | |
library(tidyverse) | |
fs::file_copy("NEWS.md", "NEWS.md.orig") | |
line <- readr::read_lines("NEWS.md") | |
tibble(line) %>% | |
mutate(release = str_match(line, "^## \\[(.+)\\] - ([0-9]{4}-[0-9]{2}-[0-9]{2})")) %>% | |
mutate(version = release[,2], | |
release_date = release[,3] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "My Awesome Document" | |
author: "Philip Chase" | |
date: "`r Sys.Date()`" | |
output: html_document | |
--- | |
```{r global_options, echo=FALSE} | |
knitr::opts_chunk$set(fig.path="Figs/", message=FALSE, warning=FALSE, | |
echo=FALSE, results="hide", fig.width=11) |
NewerOlder