Skip to content

Instantly share code, notes, and snippets.

@jwarby
jwarby / ter-u14n.bdf
Last active March 1, 2017 04:51
Terminus bitmap font patched for Powerline with modified (aligned center-vertical) tilde symbol
STARTFONT 2.1
COMMENT ter-u14n
FONT -xos4-Terminus-Medium-R-Normal--14-140-72-72-C-80-ISO10646-1
SIZE 14 72 72
FONTBOUNDINGBOX 8 14 0 -2
STARTPROPERTIES 21
FAMILY_NAME "Terminus"
FOUNDRY "xos4"
SETWIDTH_NAME "Normal"
ADD_STYLE_NAME ""
@jwarby
jwarby / autobind-to-arrow.js
Last active November 25, 2020 11:29
JSCodeshift codemod for replacing `autobind` decorators with fat arrow functions
/**
* Replaces instances of @autobind decorators with a fat arrow function.
*
* !! **YMMV - only tested with ES6 class property member functions.**
*
* Given the following input:
*
* class MyClass {
* @autobind
* myAutoboundFunction() {
@jwarby
jwarby / bootstrap-breakpoint-logger.js
Created November 15, 2019 09:42
Log out Bootstrap (v4) breakpoint changes (add as a snippet in Google Chrome/Chromium and then run)
function getResponseBreakpoint() {
const breakpoints = ['xl', 'lg', 'md', 'sm'];
return breakpoints.find((breakpoint) => {
const div = document.createElement("div");
div.classList.add("d-none", `d-${breakpoint}-block`);
document.body.appendChild(div);
@jwarby
jwarby / input.scss
Created March 22, 2021 10:00
Generated by SassMeister.com.
$color: #ffc107;
@debug lightness($color);
html {
background: lighten($color, 39.2%);
}
@jwarby
jwarby / extract-netlify-env-vars.js
Last active November 25, 2021 05:09
Extract Netlify env vars
/* Prints env vars from Netlify deploy settings UI to
* the JavaScript console.
*
* Usage: go to the build & deploy settings section of
* a Netlify site, then run this script.
*/
const envVars = $("#section-environment").querySelectorAll("dl");
const output = [].reduce.call(envVars, (str, dl) => {
const name = dl.querySelector("dt").innerText;