Skip to content

Commit

Permalink
Add WebR to dungeon post, note in pseudo-app post (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-dray committed Apr 9, 2024
1 parent 44f5003 commit 5de57d8
Show file tree
Hide file tree
Showing 10 changed files with 1,068 additions and 37 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions _site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ <h5 class="no-anchor card-title listing-title">
</div>
</a>
</div>
<div class="g-col-1" data-index="6" data-categories="dialga,r,webR" data-listing-date-sort="1705708800000" data-listing-file-modified-sort="1712128006274" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="5">
<div class="g-col-1" data-index="6" data-categories="dialga,r,webR" data-listing-date-sort="1705708800000" data-listing-file-modified-sort="1712699111799" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="5">
<a href="./posts/2024-01-20-webr-remote/index.html" class="quarto-grid-link">
<div class="quarto-grid-item card h-100 card-left">
<div class="card-body post-contents">
Expand Down Expand Up @@ -978,7 +978,7 @@ <h5 class="no-anchor card-title listing-title">
</div>
</a>
</div>
<div class="g-col-1" data-index="51" data-categories="gamedev,r,r.oguelike,videogames" data-listing-date-sort="1651359600000" data-listing-file-modified-sort="1712128005928" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="14">
<div class="g-col-1" data-index="51" data-categories="gamedev,r,r.oguelike,videogames" data-listing-date-sort="1651359600000" data-listing-file-modified-sort="1712699456118" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="15">
<a href="./posts/2022-05-01-dungeon/index.html" class="quarto-grid-link">
<div class="quarto-grid-item card h-100 card-left">
<div class="card-body post-contents">
Expand Down
16 changes: 10 additions & 6 deletions _site/index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2712,8 +2712,6 @@ globalThis.qwebrCreateMonacoEditorInstance = function (cellData) {


<p><img src="https://www.rostrum.blog/posts/2024-01-20-webr-remote/resources/browser.png" class="img-fluid" style="width:75.0%" alt="Meme from Super Mario Movie. Top panel is the king penguin from the start of the film labelled 'R Stats' and saying 'do you yield?' Lower panel is Bowser labelled 'the browser', laughing and saying 'I do not', except the 'not' has been censored with a black bar."></p>
<div id="qwebr-insertion-location-1"></div>
<noscript>Please enable JavaScript to experience the dynamic code cell content on this page.</noscript>
<section id="tldr" class="level2">
<h2 class="anchored" data-anchor-id="tldr">tl;dr</h2>
<p>A demo post to test out embedded <a href="https://docs.r-wasm.org/webr/latest/">WebR chunks</a> that <a href="https://jamesgoldie.dev/writing/your-new-r-package-webr">source a non-CRAN R package</a>. Readers can edit and re-run code later in this blog post, entirely within the browser.</p>
Expand Down Expand Up @@ -2748,6 +2746,8 @@ webr::install("dialga", repos = "https://matt-dray.r-universe.dev")
<h4 class="anchored" data-anchor-id="run">Run</h4>
<p>Now let’s use the {dialga} package.</p>
<p>Use <code>r2cron()</code> to convert values into a cron string. The integer values for each argument below show the full range of possibilities, which you can adjust. The output will be <code>* * * * *</code>, which means ‘every minute’. Start by running the code with the ‘Run Code’ button.</p>
<div id="qwebr-insertion-location-1"></div>
<noscript>Please enable JavaScript to experience the dynamic code cell content on this page.</noscript>
<div id="qwebr-insertion-location-2"></div>
<noscript>Please enable JavaScript to experience the dynamic code cell content on this page.</noscript>
<p>Let’s say you wanted ‘every minute past hour 12’ instead. Change the <code>hours</code> argument to <code>12</code> and press the ‘Run Code’ button again. And so on as you please.</p>
Expand All @@ -2757,6 +2757,10 @@ webr::install("dialga", repos = "https://matt-dray.r-universe.dev")
<p>In other words… if you don’t want to install {dialga} you can just visit this page and adjust the WebR chunks!</p>
<p>That, or you can use one of the already-existing, excellent sites like <a href="https://crontab.guru/">crontab.guru</a>, lol. Your call.</p>
<p>Regardless, I think this is a good indication of how a WebR post can help readers understand—or simply just use—your package in a demonstrative blog post.</p>
<div class="tip">
<p> <b>Note</b></p>
<p>As a further example, I’ve now added a WebR chunk to <a href="https://www.rostrum.blog/posts/2022-05-01-dungeon/">the ‘Simple procedural dungeons in R’ post</a> and may well add more to earlier posts that would have benefited from this technology had it existed at the time.</p>
</div>
</section>
</section>
</section>
Expand All @@ -2771,7 +2775,7 @@ Session info
</summary>
<div class="cell">
<div class="cell-output cell-output-stdout">
<pre><code>Last rendered: 2024-01-23 11:49:58 GMT</code></pre>
<pre><code>Last rendered: 2024-04-09 22:46:07 BST</code></pre>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>R version 4.3.1 (2023-06-16)
Expand All @@ -2793,9 +2797,9 @@ attached base packages:

loaded via a namespace (and not attached):
[1] htmlwidgets_1.6.2 compiler_4.3.1 fastmap_1.1.1 cli_3.6.2
[5] tools_4.3.1 htmltools_0.5.6.1 rstudioapi_0.15.0 yaml_2.3.8
[9] rmarkdown_2.25 knitr_1.45 jsonlite_1.8.7 xfun_0.41
[13] digest_0.6.33 rlang_1.1.3 evaluate_0.23 </code></pre>
[5] tools_4.3.1 htmltools_0.5.8 rstudioapi_0.16.0 yaml_2.3.8
[9] rmarkdown_2.26 knitr_1.45 jsonlite_1.8.8 xfun_0.43
[13] digest_0.6.35 rlang_1.1.3 fontawesome_0.5.2 evaluate_0.23 </code></pre>
</div>
</div>
</details>
Expand Down

0 comments on commit 5de57d8

Please sign in to comment.