Skip to content

Instantly share code, notes, and snippets.

View woolinsilver's full-sized avatar

Oliver Wilson woolinsilver

  • Iron Owl Consulting
  • London, UK
View GitHub Profile
@woolinsilver
woolinsilver / color
Last active September 19, 2016 13:17
Shell color and font styles.
#!/usr/bin/env bash
isColorTerminal () {
COLOR_SUPPORT=$(tput colors)
[ -t 1 ] && [ -n "${COLOR_SUPPORT}" ] && [ "${COLOR_SUPPORT}" -ge 8 ]
}
if isColorTerminal ; then
# Escape Squence
@woolinsilver
woolinsilver / .gitignore
Created November 4, 2024 09:51
SKNUPS .gitignore template
###############################################################################
# MacOS
###############################################################################
.DS_Store
###############################################################################
# IntelliJ
###############################################################################
@woolinsilver
woolinsilver / temporary-directory.js
Created November 4, 2024 09:52
Node.js create temporary directory
/**
* @callback NeedsTemporaryDirectory
* @param {string} path path of temporary directory
*/
/**
* @param {string} prefix prepended to name of temporary directory
* @param {NeedsTemporaryDirectory} lambda will be given access to temporary directory
*/
async function withTemporaryDirectory (prefix, lambda) {
@woolinsilver
woolinsilver / slugify.js
Created March 18, 2025 10:48
This is adapted from the 'slugify' npm package, which is MIT licensed.
const REPLACEMENTS = JSON.parse('{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","¢":"cent","£":"pound","¤":"currency","¥":"yen","©":"(c)","ª":"a","®":"(r)","º":"o","À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","Þ":"TH","ß":"ss","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","þ":"th","ÿ":"y","Ā":"A","ā":"a","Ă":"A","ă":"a","Ą":"A","ą":"a","Ć":"C","ć":"c","Č":"C","č":"c","Ď":"D","ď":"d","Đ":"DJ","đ":"dj","Ē":"E","ē":"e","Ė":"E","ė":"e","Ę":"e","ę":"e","Ě":"E","ě":"e","Ğ":"G","ğ":"g","Ģ":"G","ģ":"g","Ĩ":"I","ĩ":"i","Ī":"i","ī":"i","Į":"I","į":"i","İ":"I","ı":"i","Ķ":"k","ķ":"k","Ļ":"L","ļ":"l","Ľ":"L","ľ":"l","Ł":"L","ł":