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
@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/[email protected]/dist/leaflet.css"
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 / 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(
alert("hey there")
com <- git2r::commits() |> purrr::map_chr("message") |> tolower()
n_feat <- com |>
grepl("^feat", .) |>
sum()
n_fix <- com |>
grepl("^fix", .) |>
sum()
library(shiny)
library(xfun)
library(cli)
# Define UI
ui <- fluidPage(
titlePanel("what"),
tags$code(
h3("Sys.getenv()"),
verbatimTextOutput("sysgetenv")
),
cli::cat_rule("[.Rprofile] Sourcing user-wide rprofile")
options(
usethis.description = list(
`Authors@R` = 'person("Colin", "Fay",
email = "[email protected]",
role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-7343-1846"))',
License = "MIT + file LICENSE"
),
usethis.full_name = "Colin Fay",
library(future)
library(future.apply)
plan(
strategy = multisession,
workers = 3
)
future_lapply(
c("1", 12, NA),
\(x){
# Mimicking some computational time