Skip to content

Instantly share code, notes, and snippets.

@martinamorris
Created October 5, 2018 17:34
Show Gist options
  • Save martinamorris/669275b840507474c38ea92fa8cf2a68 to your computer and use it in GitHub Desktop.
Save martinamorris/669275b840507474c38ea92fa8cf2a68 to your computer and use it in GitHub Desktop.
my solution
# Create a GitHub PAT
# Hint: use the usethis package
usethis::browse_github_pat()
# generate a new token
# Add it to .Renviron
# Hint: use the usethis package
usethis::edit_r_environ()
# GITHUB_PAT = <paste token>
# RESTART R
# check that the PAT is set
Sys.getenv("GITHUB_PAT")
# Upload your solution as a gist using the GitHub API
# https://developer.github.com/v3/gists/#create-a-gist
# Hint: use the gh package
# Hint: for POST requests, use named parameters, for the files object use a
# named list e.g. `list(filename = list(content = xyz))`
gh::gh("POST /gists",
description = "my solution",
public = TRUE,
files = list(
"gistTest.R" = list(content =
readr::read_file("C:/Users/morrism/Desktop/RWTF/Day2/12-startup-01mm.R"))
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment