Skip to content

Instantly share code, notes, and snippets.

View mgei's full-sized avatar

Martin Geissmann mgei

View GitHub Profile
library(shiny)
library(tidyverse)
# data <- readRDS("persistent_data/data.RDS")
data <- as_tibble(mtcars) %>% head()
ui <- fluidPage(
tableOutput("mytable"),
actionButton("go", "filter it"),
actionButton("save", "save it")

What I've done thus far

Install QMKL

But before:

Install Py-videocore

Increase video memory!

# to install the latest version 0.53 of Hugo on Ubuntu:
# releases are here: https://github.com/gohugoio/hugo/releases
export VER="0.55.5"
wget https://github.com/gohugoio/hugo/releases/download/v0.55.5/hugo_${VER}_Linux-64bit.deb
sudo dpkg -i hugo_${VER}_Linux-64bit.deb
# check if right version is installed
hugo version
# make a new website (don't do that if you already have one)
@mgei
mgei / localurl.R
Created April 2, 2019 10:27
R function to build a local URL for RMarkdown
library(tidyverse)
localurl <- function(document, path = ""){
path <- str_remove_all(path, "/$|^/")
document <- str_remove_all(document, "/$|^/")
path <- file.path(path, document) %>%
str_remove_all("/$|^/")
document <- last(str_split(path, pattern = "/", simplify = T))
@mgei
mgei / open_closing_hours.R
Created February 21, 2019 10:24
R create tibble for open close hours to be used for timevis with type = "range"
library(tidyverse)
library(lubridate)
days <- tibble(date = seq(date("2018-01-01"), by = "days", length.out = 730)) %>%
mutate(day = weekdays(date))
hours <- tibble(daytype = c("weekday", "weekday", "weekday", "weekday", "weekday", "weekend"),
time_from = c("00:00", "08:00", "12:00", "13:00", "17:00", "00:00" ),
time_to = c("08:00", "12:00", "13:00", "17:00", "23:59", "23:59" ),
state = c("closed", "open", "closed", "open", "closed", "closed"))