Skip to content

Instantly share code, notes, and snippets.

View mnazarov's full-sized avatar

Maxim Nazarov mnazarov

View GitHub Profile
# Load data and create base plot
mtcars$names <- rownames(mtcars)
p <- ggplot(mtcars, aes(x=wt, y=mpg)) +
geom_point(aes(size = disp, color = as.factor(carb))) +
scale_color_brewer(palette="Set1") +
scale_size(range=c(1,20)) +
scale_x_continuous(limits=c(1,4.5)) +
theme_minimal() +
theme(legend.position = "none")
@jcheng5
jcheng5 / README.md
Last active June 21, 2024 22:36
Accepting POST requests from Shiny

Accepting POST requests from Shiny

(This post was motivated by a talk by @jnolis at CascadiaRConf 2021)

Recent versions of Shiny have an undocumented feature for handling POST requests that are not associated with any specific Shiny session. (Note that this functionality is missing our normal level of polish; it's a fairly low-level hook that I needed to make some things possible, but doesn't make anything easy.)

In a nutshell, it works by replacing your traditional ui object with a function(req), and then marking that function with an attribute indicating that it knows how to handle both GET and POST:

library(shiny)