Skip to content

Instantly share code, notes, and snippets.

@slowkow
slowkow / barplot_heatmap.png
Last active April 15, 2023 19:24
Plot a horizontal bar plot and the lower triangle of a heatmap aligned at the base of the bars
barplot_heatmap.png
@gavinsimpson
gavinsimpson / Deriv.R
Last active May 25, 2024 08:50
R functions to compute and plot the first derivative of a spline term in a GAM(M) fitted by `gam()` or `gamm()` in package mgcv
################################################
## Functions for derivatives of GAM(M) models ##
################################################
Deriv <- function(mod, n = 200, eps = 1e-7, newdata, term) {
if(inherits(mod, "gamm"))
mod <- mod$gam
m.terms <- attr(terms(mod), "term.labels")
if(missing(newdata)) {
newD <- sapply(model.frame(mod)[, m.terms, drop = FALSE],
function(x) seq(min(x), max(x), length = n))
@dannyedel
dannyedel / annot.avi
Last active August 24, 2020 02:38
example latex-beamer presentation containing media
@goerz
goerz / Elements of Statistical Learning.md
Last active June 21, 2024 04:08
PDF bookmarks for "Hastie, Tibshirani, Friedman - The Elements of Statistical Learning" (LaTeX)

This gist contains out.tex, a tex file that adds a PDF outline ("bookmarks") to the freely available pdf file of the book

The Elements of Statistical Learning (2nd ed), by Trevor Hastie, Robert Tibshirani, and Jerome Friedman

https://web.stanford.edu/~hastie/ElemStatLearn/

The bookmarks allow to navigate the contents of the book while reading it on a screen.

Usage

@MTuner
MTuner / fix-sublimetext-subpixel.txt
Last active July 17, 2024 22:39
Fixing font rendering/aliasing in Sublime Text in MacOS Mojave
Apple removed colored sub-pixel antialiasing in MacOS Mojave
(https://developer.apple.com/videos/play/wwdc2018/209/ starting from ~28min)
To make fonts look normal in Sublime Text, add to Preferences:
// For the editor
"font_options": [ "gray_antialias" ],
// For the sidebar / other elements
"theme_font_options": [ "gray_antialias" ],
@r2evans
r2evans / coord_cartesian_panels.R
Last active April 25, 2023 03:54
per-facet panel range clipping
#' Cartesian coordinates per facet-panel
#'
#' This function mimics the behavior of [ggplot2::coord_cartesian()],
#' while supporting per-panel limits when faceted.
#'
#' @details
#'
#' A 'panel_limits' data frame may contain:
#'
#' - zero or more faceting variables, all of which must be found
@jmarshall
jmarshall / bgzfsize.c
Last active May 14, 2024 19:23
Display BGZF compression statistics
/* bgzfsize.c -- Display uncompressed sizes of BGZF files
Copyright (C) 2009 John Marshall
*/
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <inttypes.h>