Skip to content

Instantly share code, notes, and snippets.

@jimhester
jimhester / graphql_reviews.R
Last active April 27, 2018 15:31
graphql query
library(tidyverse)
library(httr)
library(jsonlite)
library(glue)
library(lubridate)
# JSON friendly version of glue
jlue <- function(..., .envir = parent.frame()) {
glue(..., .envir = .envir, .open = "<", .close = ">")
}
@RLesur
RLesur / sort_definition_list.lua
Created October 27, 2018 23:22
A pandoc lua filter that sorts definition lists
DefinitionList = function(dl)
local terms = {}
local inlines = {}
local blocks = {}
local sorted = {}
for i, item in ipairs(dl.content) do
local term = string.upper(pandoc.utils.stringify(item[1])) --string.upper() is used because all the terms were not capitalized in the example
table.insert(terms, term)
inlines[term] = item[1]
blocks[term] = item[2]
@jennybc
jennybc / vv_transformer.R
Last active August 9, 2019 18:32
A glue transformer inspired by the "variables & values" f-string syntax in Python 3.8
library(glue)
vv_transformer <- function(text, envir) {
regex <- "=$"
if (!grepl(regex, text)) {
return(identity_transformer(text, envir))
}
text <- sub(regex, "", text)
res <- identity_transformer(text, envir)
n <- length(res)
@akostadinov
akostadinov / fonts_find.sh
Created May 19, 2021 21:10
shows fonts containing character
#!/usr/bin/env bash
# example: ./font_find.sh 🎩︎
# credits: David Baynard, https://unix.stackexchange.com/a/393740/14907
param="$1"
char=${param:0:1}
printf '%x' \'"$char" | xargs -I{} fc-list ":charset={}"
@juliasilge
juliasilge / installation.md
Last active April 22, 2024 21:04
Installing R + Tensorflow on M1