Skip to content

Instantly share code, notes, and snippets.

View tanho63's full-sized avatar
🏈

Tan Ho tanho63

🏈
View GitHub Profile
@tanho63
tanho63 / encounters.csv
Created May 12, 2024 04:22
pokemon modern emerald romhack encounters.json parsing
base_label map_label is_modern day_night encounter_type fishing_rod species encounter_rate
gRoute101 gRoute101 FALSE Day land_mons NA Wurmple 45
gRoute101 gRoute101 FALSE Day land_mons NA Poochyena 45
gRoute101 gRoute101 FALSE Day land_mons NA Zigzagoon 10
gRoute101_Night gRoute101 FALSE Night land_mons NA Wurmple 65
gRoute101_Night gRoute101 FALSE Night land_mons NA Poochyena 35
gRoute101_DayC gRoute101 TRUE Day land_mons NA Wurmple 35
gRoute101_DayC gRoute101 TRUE Day land_mons NA Zigzagoon 30
gRoute101_DayC gRoute101 TRUE Day land_mons NA Caterpie 10
gRoute101_DayC gRoute101 TRUE Day land_mons NA Poochyena 14
@tanho63
tanho63 / fivethirtyeight_footer.R
Created November 13, 2023 17:49
Fivethirtyeight footer
@tanho63
tanho63 / rb_situation_usage.R
Last active September 29, 2023 18:20
rb situation usage plot
rb_opps <- data.table::rbindlist(
list(
nflreadr::load_ff_opportunity(stat_type = "pbp_rush"),
nflreadr::load_ff_opportunity(stat_type = "pbp_pass")
),
fill = TRUE) |>
dplyr::filter(position == "RB" | receiver_position == "RB", week == 3, posteam == "MIA") |>
dplyr::transmute(
game_id,
player_name = dplyr::coalesce(receiver_full_name, full_name),
library(yaml)
url_tag <- "<a href='http://my-url.com'>My website</a>"
quoted <- function(x){
attr(x, "quoted") <- TRUE
return(x)
}
list(x = quoted(url_tag)) |> yaml::as.yaml()
# Gist URL https://gist.github.com/e194fa3e10d9e85fdedae6318e688557
library(yaml)
url_tag <- "<a href='http://my-url.com'>My website</a>"
attr(url_tag,"quoted") <- TRUE
list(x = url_tag) |> yaml::as.yaml()
# Gist URL https://gist.github.com/4d3ce5f22b53ebad6ed472653b700171
library(yaml)
url_tag <- "<a href='http://my-url.com'>My website</a>"
attr(url_tag,"quoted") <- TRUE
list(x = url_tag) |> yaml::as.yaml()
# Gist URL https://gist.github.com/b8ba7b2c3a3578ac19737882fef7dbea
@tanho63
tanho63 / mlb_videos.R
Created March 23, 2022 15:46
Downloading videos from MLB API with R
# All base R actually but make sure libcurl is installed if you're on Linux
# Devtools -> Copy as cURL -> go to curlconverter.com/#r and paste -> mostly important to get headers in this case
# idk which of these work but this combo works
headers = c(
`User-Agent` = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:98.0) Gecko/20100101 Firefox/98.0',
`Accept` = '*/*',
`Accept-Language` = 'en-US,en;q=0.5',
`Accept-Encoding` = 'gzip, deflate, br',
`Origin` = 'https://www.mlb.com',
`DNT` = '1',
@tanho63
tanho63 / tenthousandpeople.R
Created January 2, 2022 03:26
Genuary 2022.01 - Ten Thousand People
library(ggplot2)
library(ragg)
library(systemfonts)
library(tantastic) # tanho63/tantastic
library(tidyverse)
# Weepeople font https://github.com/propublica/weepeople/
colours <- c("#5E4AE3","#44FFD1","#EFCA08","#FF3366")
crossing(
@tanho63
tanho63 / scrape_stream_notes.md
Last active July 22, 2021 00:58
scraping stream questions
@tanho63
tanho63 / scoobydoo_pivot.R
Last active September 25, 2023 19:19
pivot_longer sentinel .value - scoobydoo tidy tuesday
library(tidyverse)
scooby_data <- read.csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-07-13/scoobydoo.csv")
x <-
scooby_data %>%
select(season, title,
starts_with("caught"),
starts_with("captured"),
starts_with("unmask"),