This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
png( | |
"~/Desktop/qr_test.png", | |
width = 5, | |
height = 5, | |
units = "cm", | |
res = 1200 | |
) | |
qrcode::qr_code("https://www.matt-dray.com") |> plot() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This became a blogpost here: https://www.rostrum.blog/2021/11/27/long-fns/ | |
base_names <- sessionInfo()$basePkgs | |
base_names | |
base_fns <- lapply(base_names, \(x) ls(getNamespace(x), all.names=TRUE)) |> | |
setNames(base_names) |> | |
lapply(\(object) as.data.frame(object)) |> | |
(\(x) do.call(rbind, x))() # the balls ()() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See blogpost for details: | |
# https://www.rostrum.blog/2022/07/08/rproj-dupes/ | |
check_rproj_dupes <- function(speak = FALSE) { | |
os <- .Platform$OS.type | |
if (os == "unix") { | |
ps_out <- system("ps -e", intern = TRUE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using {isocubes}, {eventloop} and {r.oguelike} to move a cube around an | |
# isometric 'dungeon', featuring an enemy that chases you down | |
# Matt Dray, June 2022 | |
# Builds on an earlier Gist that doesn't include an enemy: | |
# https://gist.github.com/matt-dray/dcbd5cd2f4bdc471921e5c741a1233c0 | |
# Move actors ------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using {isocubes}, {eventloop} and {r.oguelike} to move a cube around an | |
# isometric 'dungeon', featuring an enemy that chases you down | |
# Matt Dray, June 2022 | |
# Builds on an earlier Gist that doesn't include an enemy: | |
# https://gist.github.com/matt-dray/dcbd5cd2f4bdc471921e5c741a1233c0 | |
# Move actors ------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a procedural dungeon with {r.oguelike}, either in isometric | |
# with {isocubes} or oblique with {oblicubes} | |
# Matt Dray, August 2022 | |
# See blogpost: | |
# https://www.rostrum.blog/2022/06/28/isometric-dungeon/ | |
# Prompt for WASD keys (i.e. up, left, down, right) | |
accept_keypress <- function() { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Testing the {isocube} package by coolbutuseless (mikefc) | |
# Package on GitHub: https://github.com/coolbutuseless/isocubes | |
# Matt Dray, June 2022 | |
# Attach generally-needed packages | |
library(grid) # installed with base R | |
library(purrr) # install from CRAN | |
library(isocubes) # remotes::install_github("coolbutuseless/isocubes") | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(haven) | |
library(labelled) | |
x <- tibble( | |
A01 = c(1, 2, 1), | |
A02 = c(2, 3, 1) | |
) | |
var_label(x) <- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
demo_script <- " | |
1 | |
| | |
v | |
x | |
2 | |
| | |
v | |
y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
library(ggsvg) | |
td_1_url <- "https://upload.wikimedia.org/wikipedia/commons/d/d0/Trommeltrocknen.svg" | |
td_2_url <- "https://upload.wikimedia.org/wikipedia/commons/0/0c/Trommeltrocknen_1.svg" | |
td_3_url <- "https://upload.wikimedia.org/wikipedia/commons/1/14/Trommeltrocknen_2.svg" | |
td_4_url <- "https://upload.wikimedia.org/wikipedia/commons/3/38/Nicht_trommeltrocknen.svg" | |
td_1 <- paste(readLines(td_1_url), collapse = "\n") | |
td_2 <- paste(readLines(td_2_url), collapse = "\n") |