Skip to content

Instantly share code, notes, and snippets.

View keego's full-sized avatar

Keegan Farley keego

View GitHub Profile
@keego
keego / named_functions.js
Last active November 22, 2023 22:33
Google Sheets - various Named Functions for utility purposes
// ------------------------------------------------------------------------------------
// These are some handy Named Functions I came up with to help with my
// Google Sheet I use for tracking roommate expenses.
//
// This gist uses JSDoc syntax but translates pretty easily into the form fields
// in Google Sheets Named Function wizard.
// ------------------------------------------------------------------------------------
/**
* @function
const syntaxChars = /[\^$\\.*+?()[\]{}|]/g
/**
* Escapes all special special regex characters in a given string
* so that it can be passed to `new RegExp(escaped, ...)` to match all given
* characters literally.
*
* inspired by https://github.com/es-shims/regexp.escape/blob/master/implementation.js
*
* @param {string} s
/**
* This code is meant to be executed in a browser console in order
* to make it visually apparent what section of the page has focus.
* As focus moves around, different elements will exhibit a flashing border.
* Usage:
* 1. Drop definitions in in browser console
* 2. Call `addAnimation()` to add the animation css to the current document
* 3. Call `start()` to start tracking focus
* 4. Call `stop()` to stop tracking focus
*/
@keego
keego / kaybase.md
Last active June 29, 2020 02:24
Keybase proof

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@keego
keego / screenshot.js
Last active June 9, 2021 19:40 — forked from poissoj/splitImage.js
Uses `html2canvas` to take screenshots each element in an html NodeList, then uses `pdfMake` to concatenate them into a pdf and download it. (ES5 for AngularJS)
// Private fields
var PAGE_HEIGHT = 700;
var PAGE_WIDTH = 500;
// Private methods
function createNewReport (fileName) {
var content = [];
/**
* Converts a label or variable name into kebab-case
*
* i.e
* ```
* "Sentence case rekt" -> "sentence-case-rekt"
* "Title Case Rekt" -> "title-case-rekt"
* "camelCaseRekt" -> "camel-case-rekt"
* "PascalCaseRekt" -> "pascal-case-rekt"
* "snake_case_rekt" -> "snake-case-rekt"