Skip to content

Instantly share code, notes, and snippets.

#+BEGIN_COMMENT
Build wiki.html with:
emacs wiki.org --batch -f org-html-export-to-html --kill
#+END_COMMENT
#+OPTIONS: toc:nil
#+BEGIN_SRC emacs-lisp :exports none
(defun hyperorg/sort ()
(save-excursion
(goto-char (point-min))
(goto-char (1- (search-forward "*")))
library(promises)
library(future)
library(shiny)
library(testthat)
plan(multiprocess)
adderModule <- function(id, sleepFor, n) {
moduleServer(id, function(input, output, session) {
output$sum <- renderText({

testServer QA Notes

testServer() is a new function for testing the behavior of reactives inside of Shiny server functions and modules.

Server and module functions

Server functions define the reactive behavior of Shiny applications. Together with UI functions, server functions define a Shiny application. Server functions are R functions such as the following:

server &lt;- function(input, output, session) {
;; in JACL package; use JACL from COMMON-LISP and switch to COMMON-LISP
(%let ((cl-pkg (\. (%js "Package") (|get| (\. '#:common-lisp |name|)))))
(\. cl-pkg (|usePackage| cl:*package*))
(%setq cl:*package* cl-pkg))
(\. *package* (|exportSymbol| (\. 'defmacro |name|)))
(%js "(~{}.setMacro().fvalue = ~{})"
'defmacro
(%lambda (env form name params &rest body)
;; TODO Use %PROGN instead of %LET
---
title: "Promises/Future Test"
runtime: shiny
output: html_document
---
```{r, include=FALSE}
library(promises)
library(future)
knitr::opts_chunk$set(echo = TRUE)
```
#!/usr/bin/env Rscript
library(chromote)
library(jsonlite)
muffle <- function(expr) {
if (.Platform$OS.type == "unix") {
sink("/dev/null")
} else {
sink("NUL")
> options(warn=2)
> shinyloadtest_report(slt_demo_data_1)
shinyloadtest_report - demo1 Session Duration [=======>--------------------------------------------------------------------------------------------] 5/64 eta:10s
Error: (converted from warning) Removed 1 rows containing missing values (geom_vline).
37.
doWithOneRestart(return(expr), restart)
36.
withOneRestart(expr, restarts[[1L]])
35.
withRestarts({
@alandipert
alandipert / topo-sort-dfs.lisp
Last active December 4, 2019 14:09
Depth-first topological sort in Common Lisp
;; some graphs for testing
(setq g1 '((b a d)
(d e)
(e a)
(f d)
(g d a e c)))
(setq g2 '((c a)
(d a)
(b d z)))
#' \describe{
#' \item{run}{Name of the run}
#' \item{session_id}{simulated session identifier, 0-based}
#' \item{user_id}{simulated user identifier, 0-based}
#' \item{iteration}{user session identifier, 0-based}
#' \item{input_line_number}{recording line number associated with event}
#' \item{event}{type of the event}
#' \item{start}{time the event started, in seconds, relative to the time at which all simulated users were running.}
#' \item{end}{time the event ended, in seconds, relative to the time at which all simulated users were running}
#' \item{time}{event duration, in seconds}
ops <- list('+' = `+`, '-' = `-`, '*' = `*`, '/' = `/`)
eval_expr <- function(f1, f2, f3) {
f2(f1(2, .5), f3(1.5, 4)) == -6.25
}
find <- function() {
m <- gtools::permutations(4, 3, 1:4)
for (r in 1:nrow(m)) {
if (do.call(eval_expr, setNames(ops[m[r,]], NULL))) {