Description Usage Arguments Details Value
View source: R/utils-usethis.R
Create the files for an Advent of Code day
1 2 3 4 5 | use_day(day, year = 2020, open = interactive(), cookie = TRUE)
download_part2_to_roxygen_md(day, year = 2020, cookie = TRUE)
convert_clipboard_html_to_roxygen_md(input = clipr::read_clip())
|
day |
integer giving the day |
year |
year of Advent of Code containing the day. Defaults to 2020. |
open |
whether to open the created files. Defaults to |
cookie |
whether to try to download personalized page results using an Advent of Code cookie |
input |
html code copied from the Advent of Code website |
Creates a file for writing the functions to solve the problem: R/dayxx.R
.
The text of the challenge is downloaded and inserted into the roxygen block.
One caveat is that you will have to manually add the markdown text for Part
Two yourself. You can use convert_clipboard_html_to_roxygen_md()
to make
this easier. Once you can read the description, view the page source, copy
the html for that part of the problem. Run this function to create a Roxygen
version of the HTML.
Also, creates a placeholder file for the problem input: inst/inputxx.txt
.
Paste your input here.
Also, creates a file for unit tests: tests/testthat/test-dayxx.R
. This is
good place to test that the examples in the problem description work.
Finally, creates a solution file: inst/run-dayxx.R
. You should download
your personalized challenge input as inst/inputxx.txt
. Your solution file
should read in this file and apply your functions to it. Once your solution
passes on the site, store it in R/data-solutions.R
. Then the solution file
can load in your previous answer, rerun your solution, and check whether your
code no longer obtains the same solution.
use_day()
returns NULL
. convert_clipboard_html_to_roxygen_md()
invisibly returns the Roxygen markdown block. It also copies Roxygen
markdown block onto the clipboard.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.