Skip to content

Instantly share code, notes, and snippets.

View permute.js
const removeAt = (xs, i) => xs.filter((x, j) => j !== i);
const permute = xs => xs.length
? xs.flatMap((x, i) => permute(removeAt(xs, i)).map(ys => [x, ...ys]))
: [[]];
View mv.lisp
(defconstant mv-limit 20)
(defparameter *mv-expected* 1)
(defparameter *mv* (make-array mv-limit))
(defun mv (&rest vals)
(do ((i 0 (1+ i))
(vs vals (cdr vs)))
((or (eql i *mv-expected*) (null vs))
View mv.clj
(def mv-limit 20)
(def ^:dynamic *mv-arr*)
(def ^:dynamic *values-expected* 1)
(defn values [& vals]
(when (thread-bound? #'*values-expected*)
(dotimes [i (set! *values-expected*
(min *values-expected* (count vals)))]
View wiki.org
#+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 "*")))
View promise_test.R
library(promises)
library(future)
library(shiny)
library(testthat)
plan(multiprocess)
adderModule <- function(id, sleepFor, n) {
moduleServer(id, function(input, output, session) {
output$sum <- renderText({
View testServer_app_QA.md

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 <- function(input, output, session) {
View boot.lisp
;; 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
View future_error.Rmd
---
title: "Promises/Future Test"
runtime: shiny
output: html_document
---
```{r, include=FALSE}
library(promises)
library(future)
knitr::opts_chunk$set(echo = TRUE)
```
View jacl-client.R
#!/usr/bin/env Rscript
library(chromote)
library(jsonlite)
muffle <- function(expr) {
if (.Platform$OS.type == "unix") {
sink("/dev/null")
} else {
sink("NUL")
View gist:508c8ab67296012e8dd182e5c95c3968
> 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({
You can’t perform that action at this time.