Skip to content

Instantly share code, notes, and snippets.

View ColinFay's full-sized avatar
🦷
Because why not

Colin Fay ColinFay

🦷
Because why not
View GitHub Profile
cli::cat_rule("[.Rprofile] Sourcing user-wide rprofile")
options(
usethis.description = list(
`Authors@R` = 'person("Colin", "Fay",
email = "contact@colinfay.me",
role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-7343-1846"))',
License = "MIT + file LICENSE"
),
usethis.full_name = "Colin Fay",
library(shiny)
library(xfun)
library(cli)
# Define UI
ui <- fluidPage(
titlePanel("what"),
tags$code(
h3("Sys.getenv()"),
verbatimTextOutput("sysgetenv")
),
com <- git2r::commits() |> purrr::map_chr("message") |> tolower()
n_feat <- com |>
grepl("^feat", .) |>
sum()
n_fix <- com |>
grepl("^fix", .) |>
sum()
alert("hey there")
@ColinFay
ColinFay / parismarathon.R
Created April 7, 2022 07:19
Get all Paris Marathon Data
r <- httr::GET("https://resultscui.active.com/api/results/events/SchneiderElectricMarathondeParis2022/participants?groupId=943954&routeId=170393&offset=34357&limit=100") |>
httr::content() |>
rawToChar() |>
jsonlite::fromJSON()
base <- 0
r <- list()
continue <- TRUE
offset <- 0
r <- httr::GET(
library(shiny)
library(ggplot2)
ui <- function(request){
tagList(
h2("Click on the plot to download it"),
tags$button(
"Click here to download the plot",
onclick = 'var a = document.createElement("a"); a.href = $("#plop").find("img").attr("src"); a.download = "Image.png"; a.click(); '
),
plotOutput("plop")
@ColinFay
ColinFay / filled_template.html
Created March 24, 2021 08:04
html_template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<style>body{background-color:white;}</style>
</head>
<html>
<head>
<title>Title</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
library(tidyverse)
raw_data <- read_csv("https://www.data.gouv.fr/fr/datasets/r/eb672d49-7cc7-4114-a5a1-fa6fd147406b")
df <- raw_data %>%
filter(
date == as.character(
Sys.Date() - 1
)
)
library(purrr)
list.files(
pattern = ".Store$",
recursive = TRUE,
full.names = TRUE,
all.files = TRUE
) %>%
map(unlink, TRUE, TRUE)
library(shiny)
ui <- fluidPage()
server <- function(input, output, session) {
}
# Creating the shiny object
res <- shinyApp(ui, server)