Skip to content

Instantly share code, notes, and snippets.

View danielvartan's full-sized avatar

Daniel Vartanian danielvartan

View GitHub Profile
@danielvartan
danielvartan / parse_html_table.R
Last active February 22, 2025 19:04
Parse HTML tables using `rvest`
# library(clipr)
# library(prettycheck) # github.com/danielvartan/prettycheck
# library(rvest)
parse_html_table <- function(x = clipr::read_clip()) {
prettycheck:::assert_character(x)
x |>
paste0(collapse = " ") |>
rvest::read_html() |>
@danielvartan
danielvartan / ffmeg-cut-video.sh
Last active April 10, 2025 00:21
Learn more abou FFMEG at: https://www.ffmpeg.org
# Source: https://stackoverflow.com/a/42827058/8258804
ffmpeg -ss 00:01:00 -to 00:02:00 -i input.mp4 -c copy output.mp4
@danielvartan
danielvartan / .Rprofile
Last active April 27, 2025 03:01
My `.Rprofile` settings.
# Load packages -----
library(magrittr)
library(ragg)
# Set options -----
options(scipen = 999)
options(vsc.use_httpgd = TRUE)
@danielvartan
danielvartan / toTitleCasePT.R
Created June 25, 2024 21:39 — forked from jjesusfilho/toTitleCasePT.R
Converts Portuguese strings to Title Case
#' Convertion to title case with lower case for some classes of words.
#'
#' In written Portuguese, when converting to title case, it is not usual
#' to keep in title case some words, like prepositions, conjunctions,
#' articles and some kinds of pronouns. This functions locates those
#' cases and converts them to lower case.
#'
#' @param string vector of characters to be converted to title case
#' but with connector words (one-word prepositions and conjunctions)
#' and articles (both definite and indefinite) and some pronouns
@danielvartan
danielvartan / find_orphan_files.R
Last active September 2, 2024 06:51
Find orphan files in a Zotero database.
# Install the packages below (in the `library` function) if you don't
# already have them.
# library(checkmate)
# library(magrittr)
# library(purrr)
# library(readr)
# library(stringr)
#' List all files linked to a reference in a Zotero library