Skip to content

Instantly share code, notes, and snippets.

@trafficonese
trafficonese / app.R
Last active January 29, 2020 12:18
shinytree custom contextmenu delete only last level
library(shiny)
library(shinyTree)
library(shinyjs)
shinyApp(
ui = fluidPage(
useShinyjs(),
actionButton("run", "Change Contextmenu"),
hr(),
shinyTree("tree", contextmenu = TRUE)
@trafficonese
trafficonese / pickerSelectOptions versions
Last active September 30, 2019 19:08
pickerSelectOptions optimizations / benchmarks
## functions ##############
pickerSelectOptions <- function(choices, selected = NULL, choicesOpt = NULL, maxOptGroup = NULL) {
if (is.null(choicesOpt))
choicesOpt <- list()
l <- sapply(choices, length)
if (!is.null(maxOptGroup))
maxOptGroup <- rep_len(x = maxOptGroup, length.out = sum(l))
m <- matrix(data = c(c(1, cumsum(l)[-length(l)] + 1), cumsum(l)), ncol = 2)
html <- lapply(seq_along(choices), FUN = function(i) {
label <- names(choices)[i]
@trafficonese
trafficonese / shinyTree optimization
Created August 22, 2019 12:20
shinyTree optimization and benchmarks
## Libs ###################
library(rjson)
library(jsonlite)
## Tree Data ####################
treelist <- rep(list(
root1 = rep(list(
SubListA = list(leaf1 = "", leaf2 = ""),
SubListB = structure(list(leafA = "", leafB = ""))
),100),
@trafficonese
trafficonese / gist:e0c695d617f412ff31ead9688ba6b80a
Created July 4, 2019 12:16
actionButton change color/icon
library(shiny)
library(shinyjs)
ui <- fluidPage(
useShinyjs(),
sliderInput("slide","", 1,100,1,1),
actionButton("act", "Init label", icon = icon("check"), width = "300px")
)
server <- function(input, output, session) {
@trafficonese
trafficonese / app.R
Created April 18, 2019 07:01
shinyTrees
library(shiny)
library(shinyTree)
ui <- fluidPage(
shinyTree("tree"),
hr(),
shinyTree("tree1")
)
server <- function(input, output, session) {
@trafficonese
trafficonese / app.R
Last active April 16, 2019 10:01
ERROR: [uv_write] broken pipe - ShinyApp
library(shiny)
library(plotly)
library(shinyjqui)
library(shinyTree)
ui <- fluidPage(
shinyTree("tree", dragAndDrop=TRUE),
jqui_resizable(plotlyOutput("histo", width="100%", height="420px")),
verbatimTextOutput("str")
@trafficonese
trafficonese / nginx-conf
Created March 29, 2019 12:07 — forked from seabbs/nginx-conf
Nginx conf generated by nginx auto proxy
# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the
# scheme used to connect to this server
map $http_x_forwarded_proto $proxy_x_forwarded_proto {
default $http_x_forwarded_proto;
'' $scheme;
}
# If we receive X-Forwarded-Port, pass it through; otherwise, pass along the
# server port the client connected to
map $http_x_forwarded_port $proxy_x_forwarded_port {
default $http_x_forwarded_port;
@trafficonese
trafficonese / jqfp.js
Created October 24, 2018 14:12 — forked from srvanderplas/jqfp.js
Shiny user fingerprint (md5 hash of browser characteristics) and ip address demo. The .R files are in the working directory ("./"), the .js files must be placed in ./www/js/ to be accessible. I wrote the R code, which I will release under the same WTF license as the jqfp.js library is released under.
// Browser fingerprinting is a technique to "mark" anonymous users using JS
// (or other things). To build an "identity" of sorts the browser is queried
// for a list of its plugins, the screen size and several other things, then
// hashes them. The idea is that these bits of information produce an unique
// "fingerprint" of sorts; the more elaborate the list of data points is, the
// more unique this fingerprint becomes. And you wouldn't even need to set a
// cookie to recognize this user when she visits again.
//
// For more information on this topic consult
// [Ars Technica](http://arstechnica.com/tech-policy/news/2010/05/how-your-web-browser-rats-you-out-online.ars)