Skip to content

Instantly share code, notes, and snippets.

// @ts-check
(() => {
const key = 'toc-position';
let timeout = 0;
/** @type {{ scrollTop: number, details: boolean[] }} */
#----------------------------------------------------------------
# convert an excel range (obtained from a spreadsheet function
# or the COM/scripting API) into a data frame, optionally with
# headers in the first row.
#----------------------------------------------------------------
range2dataframe <- function(x, headers=F){
# remove headers from data if necessary
data <- if(headers) x[-1,] else x;
#------------------------------------------------------------------------------
#
# This is a library for storing arbitrary R objects in Excel workbook files.
# It requires the "XML" library -- install that from the shell using
#
# > install.packages( "XML" )
#
# selecting a CRAN mirror if necessary.
#
# Modern Excel files (meaning xlsx, xlsm and xlsb, but NOT xls) can include
@duncanwerner
duncanwerner / poly.R
Last active July 20, 2016 14:54
Fit polynomial in Excel with BERT/R.
#
# fit a polynomial. pass a range of x (independent),
# y (dependent), and degree.
#
# returns a row vector by default, but pass False as
# the last parameter and it will return a column vector.
#
fit.poly <- function( x, y, degree, as.row=T ){
@duncanwerner
duncanwerner / gist:6b50c77747a15f3f706b413f39e9f4cc
Created June 24, 2016 17:57
user.css for moz look-and-feel
@import url(https://fonts.googleapis.com/css?family=Fira+Mono:400,700);
@import url(https://fonts.googleapis.com/css?family=Fira+Sans:400,300,300italic,400italic,500,500italic,700,700italic);
html, body, input[type=text] {
font: 11pt 'Fira Sans' !important;
}
pre {
font: 11pt 'Fira Mono' !important;