diff --git a/_freeze/til-r/asciicast/index/execute-results/html.json b/_freeze/til-r/asciicast/index/execute-results/html.json new file mode 100644 index 00000000..5966a42f --- /dev/null +++ b/_freeze/til-r/asciicast/index/execute-results/html.json @@ -0,0 +1,15 @@ +{ + "hash": "dffbc2f3ac6dbb7fa66abbc7bbb18bb1", + "result": { + "engine": "knitr", + "markdown": "---\ntitle: \"How to create a GIF of code and its output\"\ndate: '2022-05-10'\ncategory: Other\n---\n\n\n\n\n\nWe can create a GIF of code and its output using [asciicast](https://github.com/r-lib/asciicast). \n\nInstall the development version:\n\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nremotes::install_github('r-lib/asciicast', ref = remotes::github_pull(24)) \n```\n:::\n\n\n\n\n\nCreate a file called `nzchar.R` with specifications for the GIF and the code to run.\n\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n#' Title: Using nzchar\n#' Columns: 60\n#' Rows: 18\n\n# This is not empty\nSys.getenv(\"R_LIBS_USER\")\n\n# This is empty\nSys.getenv(\"test\")\n\n# This returns TRUE\nnzchar(Sys.getenv(\"R_LIBS_USER\"))\n\n# This returns FALSE\nnzchar(Sys.getenv(\"test\"))\n```\n:::\n\n\n\n\n\nCreate another file that creates the GIF:\n\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n#' Title: Using nzchar\n\nsrc <- \"nzchar.R\"\ncast <- asciicast::record(src)\n\n# <<\n# `cast` is an `asciicast` object, which has some metadata and the\n# recording itself:\n# <<\n\ncast\n\n# <<\n# You can write `cast` to a GIF file with the version installed above.\n# <<\n\nsvg <- tempfile(fileext = \"gif\")\nasciicast::write_gif(cast, svg, theme = \"monokai\")\n```\n:::\n\n\n\n\n\nReally fun for adding to tweets!\n\n![](example.gif){fig-alt=\"An animation created with asciicast that shows that nzchar() returns TRUE when a string is nonempty and FALSE when a string is empty, using Sys.getenv() to query existing 'R_LIBS_USER' and nonexisting 'test' environment variables.\"}\n", + "supporting": [], + "filters": [ + "rmarkdown/pagebreak.lua" + ], + "includes": {}, + "engineDependencies": {}, + "preserve": {}, + "postProcess": true + } +} \ No newline at end of file diff --git "a/images/Screenshot 2025-02-18 at 3.24.41\342\200\257PM.png" "b/images/Screenshot 2025-02-18 at 3.24.41\342\200\257PM.png" new file mode 100644 index 00000000..002058e7 Binary files /dev/null and "b/images/Screenshot 2025-02-18 at 3.24.41\342\200\257PM.png" differ diff --git "a/images/Screenshot 2025-02-18 at 3.25.06\342\200\257PM-01.png" "b/images/Screenshot 2025-02-18 at 3.25.06\342\200\257PM-01.png" new file mode 100644 index 00000000..3186e2fa Binary files /dev/null and "b/images/Screenshot 2025-02-18 at 3.25.06\342\200\257PM-01.png" differ diff --git "a/images/Screenshot 2025-02-18 at 3.25.06\342\200\257PM.png" "b/images/Screenshot 2025-02-18 at 3.25.06\342\200\257PM.png" new file mode 100644 index 00000000..3186e2fa Binary files /dev/null and "b/images/Screenshot 2025-02-18 at 3.25.06\342\200\257PM.png" differ diff --git "a/images/Screenshot 2025-02-18 at 3.30.52\342\200\257PM.png" "b/images/Screenshot 2025-02-18 at 3.30.52\342\200\257PM.png" new file mode 100644 index 00000000..826e1775 Binary files /dev/null and "b/images/Screenshot 2025-02-18 at 3.30.52\342\200\257PM.png" differ diff --git "a/images/Screenshot 2025-02-18 at 3.34.26\342\200\257PM.png" "b/images/Screenshot 2025-02-18 at 3.34.26\342\200\257PM.png" new file mode 100644 index 00000000..623ca3b6 Binary files /dev/null and "b/images/Screenshot 2025-02-18 at 3.34.26\342\200\257PM.png" differ diff --git a/til-other/gitkeep/index.qmd b/til-other/gitkeep/index.md similarity index 100% rename from til-other/gitkeep/index.qmd rename to til-other/gitkeep/index.md diff --git a/til-other/quarto-github-codespaces/images/1.png b/til-other/quarto-github-codespaces/images/1.png new file mode 100644 index 00000000..3186e2fa Binary files /dev/null and b/til-other/quarto-github-codespaces/images/1.png differ diff --git a/til-other/quarto-github-codespaces/images/2.png b/til-other/quarto-github-codespaces/images/2.png new file mode 100644 index 00000000..002058e7 Binary files /dev/null and b/til-other/quarto-github-codespaces/images/2.png differ diff --git a/til-other/quarto-github-codespaces/images/3.png b/til-other/quarto-github-codespaces/images/3.png new file mode 100644 index 00000000..826e1775 Binary files /dev/null and b/til-other/quarto-github-codespaces/images/3.png differ diff --git a/til-other/quarto-github-codespaces/images/4.png b/til-other/quarto-github-codespaces/images/4.png new file mode 100644 index 00000000..f03172e7 Binary files /dev/null and b/til-other/quarto-github-codespaces/images/4.png differ diff --git a/til-other/quarto-github-codespaces/images/5.png b/til-other/quarto-github-codespaces/images/5.png new file mode 100644 index 00000000..623ca3b6 Binary files /dev/null and b/til-other/quarto-github-codespaces/images/5.png differ diff --git a/til-other/quarto-github-codespaces/index.md b/til-other/quarto-github-codespaces/index.md new file mode 100644 index 00000000..bf645f02 --- /dev/null +++ b/til-other/quarto-github-codespaces/index.md @@ -0,0 +1,37 @@ +--- +title: "How to open a Quarto project in GitHub Codespaces" +date: '2025-02-18' +category: Other +output: html_document +--- + +I recently received a question on [YouTube](https://www.youtube.com/watch?v=uLGe9zuuNl0) about running a Quarto project in GitHub Codespaces. This was new to me, so I did some research (thanks to [Mickaël Canouil](https://github.com/mcanouil) and others for their help!). The key takeaway is that everything needs to be containerized: Quarto, Jupyter, the Quarto extension, R, Python, etc. Simply installing the VS Code Quarto extension is not enough. The easiest way to achieve this is by using the [quarto-codespaces](https://github.com/mcanouil/quarto-codespaces) repository. + +1. Fork Mickaël's `quarto-codespaces` repo: +2. Click the green "Code" button, select "Codespaces," and then "Create codespace on main." + +![](images/1.png) + +3. Click "Authorize" and continue. Creating the codespace may take a few minutes. + +![](images/2.png) + +4. Once the codespace is ready, clone your Quarto project into it. For example, to clone the `water-insecurity-dashboard` project, run the following in the terminal: + +```bash +git clone https://github.com/ivelasq/water-insecurity-dashboard.git +``` + +5. Navigate to the project directory: `cd water-insecurity-dashboard` + +6. Create a new Python environment. In the Command Palette (Ctrl+Shift+P or Cmd+Shift+P), select "Python: Create Environment...". Choose "Venv" and the appropriate Python interpreter. **Very importantly,** make sure you check the box to install dependencies from `requirements.txt`. + +![](images/3.png) + +7. Open your `.qmd` file (e.g., `final.qmd`) and click the "Preview" button in the top right. + +![](images/4.png) + +That's it! Your Quarto project should now be running in GitHub Codespaces. + +![](images/5.png) diff --git a/til-other/asciicast/example.gif b/til-r/asciicast/example.gif similarity index 100% rename from til-other/asciicast/example.gif rename to til-r/asciicast/example.gif diff --git a/til-other/asciicast/index.Rmd b/til-r/asciicast/index.Rmd similarity index 100% rename from til-other/asciicast/index.Rmd rename to til-r/asciicast/index.Rmd