Skip to content

Instantly share code, notes, and snippets.

View zkamvar's full-sized avatar
🍄
has jerb

Zhian N. Kamvar zkamvar

🍄
has jerb
View GitHub Profile
#!/usr/bin/env bash
#
# This will search GitHub for hubs that use quantiles, CDF, or PMF output
# types and check if they use "optional" in their hub-config/tasks.json
# files.
echo "======== SEARCHING GITHUB ============"
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $(gh auth token)" \
-H "X-GitHub-Api-Version: 2022-11-28" \
@zkamvar
zkamvar / announcement.md
Last active August 30, 2024 19:01
Updating installation instructions and release process for R packages

Last month, I opened a discussion to formalize R package release process guidelines and it has been approved by the core devs of the Hubverse development team. The most visible change is how you will install hubverse packages. You should no longer use remotes::install_github().

To install ALL hubverse packages, you can use:

install.packages("hubverse", repos = c("https://hubverse-org.r-universe.dev", "https://cran.r-project.org"))

Timeline

@zkamvar
zkamvar / give_thanks.R
Created November 21, 2023 23:43
Give thanks to contributors of a project
#' Produce a list of all GitHub contributors to a project
#'
#' If you want a way to give thanks to specific people who have contributed to a project
#' since a given release, this will extract the GitHub user names from a given package's
#' NEWS file. This assumes that 1) the package has a `NEWS.md` file and 2) the package
#' uses level 1 headers and semantic versioning for each version in the news file.
#'
#' @param package the name of a package
#' @param since a version number (must match a version recorded in the NEWS)
#' @return a character vector with GitHub user names
@zkamvar
zkamvar / fix-file-in-repo.R
Created August 28, 2023 22:33
fix a single file in a repo
library("gh")
library("base64enc")
# get a file from a repository
get_repo_file <- function(org = "carpentries", lesson = "sandpaper-docs", file = "CONTRIBUTING.md", ...) {
gh("GET /repos/{org}/{lesson}/contents/{file}",
.params = list(
org = org,
lesson = lesson,
file = file
@zkamvar
zkamvar / maintainer-check.R
Last active August 7, 2023 20:57
Get maintainers who still need to confirm that they have reset their local repositories
#' List maintainers who still need to respond to the Workbench transition issue
#'
#' @param org the name of the github organisation
#' @param repo name of the repository
#' @return a character vector of github user names for maintainers who still need to confirm
#' transition to The Workbench
#'
#' @details The Workbench transition requires maintainers to confirm that they have re-cloned
#' their local repositories to avoid a situation where they overwrite commits with the old
#' version of the repository
@zkamvar
zkamvar / scrape-workshops.R
Created November 8, 2022 15:57
Scrape lessons from workshops and determine if they have workbench lessons
library("jsonlite")
library("polite")
library("rvest")
library("purrr")
library("dplyr")
workbench_slugs <- c(
"r-ecology-lesson",
"r-socialsci",
@zkamvar
zkamvar / renv.lock
Created December 15, 2021 18:29
renv.lock file from failing repo
{
"R": {
"Version": "4.1.0",
"Repositories": [
{
"Name": "carpentries",
"URL": "https://carpentries.r-universe.dev"
},
{
"Name": "carpentries_archive",
@zkamvar
zkamvar / keybase.md
Created September 20, 2021 16:58
Keybase proof

Keybase proof

I hereby claim:

  • I am zkamvar on github.
  • I am zkamvar (https://keybase.io/zkamvar) on keybase.
  • I have a public key ASDqVco4Xm3D5M11ckLrYgE9XyqlHFxA7MwqWszJxWvmSAo

To claim this, I am signing this object:

@zkamvar
zkamvar / README.md
Last active August 18, 2020 17:32
pandoc markdown_github with section-divs booboo

This compares the differences between pandoc's markdown and markdown_github engines when parsing <div> tags within sections.

Problem

In essence, if a <div> tag contains a header out of order with the main document, its contents will be appended to the div in the html document with markdown_github. If the following div appears after a level 3 header:

<div class='boo'>

## level 2
# test file
sample_chunk <- "
```{r hello, testing=as.logical(1), another=1 + 1}
x <- 1 + 1 # this evaluates to two
```
the value of x is `r x`"
file = "sample.Rmd"
writeLines(sample_chunk, con = file)
# delete temp Rmd file
on.exit(unlink(file))