Skip to content

Instantly share code, notes, and snippets.

@timelyportfolio
timelyportfolio / Readme.md
Last active February 20, 2021 12:48
svg as reactiveValue in Shiny used with uiOutput

Just playing around with svg from svglite, and I wondered if the svg output would work as reactiveValue in Shiny. Of course, it does. Then, I wanted to confirm that functions could be used for render*Output, and yes they can.

useful?

Is this useful? svg works really well in responsive contexts, so this might be helpful in that situation. Also, we could dynamically render svg spinners or animations on load or for other feedback. Let me know if you think of use cases.

functions for render*Output can help immensely.

library(htmltools)
@randy3k
randy3k / nginx.conf
Last active August 26, 2018 15:26
jupyterhub and rstudio server setups
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
@CSaratakij
CSaratakij / .tmux.conf
Last active June 22, 2024 08:10
Tmux's Config that's very close to i3wm (Setting with an idea of using tmux without x-server)
# Config that is very close to a i3 window manager's keybinding.
set -s escape-time 0
setw -g aggressive-resize on
# First remove *all* keybindings
unbind-key -a
# List keys
bind-key ? list-keys
@tushortz
tushortz / UNICODE to ASCII python replace
Created April 6, 2016 22:14
Function to replace some annoying characters
def unicodetoascii(text):
TEXT = (text.
replace('\\xe2\\x80\\x99', "'").
replace('\\xc3\\xa9', 'e').
replace('\\xe2\\x80\\x90', '-').
replace('\\xe2\\x80\\x91', '-').
replace('\\xe2\\x80\\x92', '-').
replace('\\xe2\\x80\\x93', '-').
replace('\\xe2\\x80\\x94', '-').
@blahah
blahah / print_code.Rmd
Last active May 4, 2022 15:42
Print marked-up, unevaluated code from another file using Rmarkdown / knitr
---
title: "test"
author: "Richard Smith-Unna"
date: "21 May 2015"
output: html_document
---
Demo of reading an R file and dumping it raw into the HTML produced by knitr from RMarkdown, to get syntax highlighting.
Put the code you want to display in `import.R`.
library(dplyr); library(httr); library(rvest)
addr <- "Big Ben"
GET("http://maps.google.com/maps/api/geocode/xml",
query = list(address = addr)) %>%
content() %>%
html_nodes(xpath = "//location//lat | //location//lng") %>%
html_text() %>%
setNames(c("lng", "lat"))
@leeper
leeper / read.qualtrics.csv.R
Created April 13, 2015 10:54
Function read data from a Qualtrics-generated CSV file
read.qualtrics.csv <- function(filename, stringsAsFactors = FALSE, ...) {
n <- read.csv(filename, nrows = 1, stringsAsFactors = FALSE)
dat <- read.csv(filename, header = FALSE, skip = 2, stringsAsFactors = stringsAsFactors, ...)
names(dat) <- names(n)
names(dat)[1:10] <- n[1,1:10]
for(i in seq_along(dat)) {
attr(dat[,i], "question") <- n[1,i]
}
dat
}