This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>☃️</text></svg>"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Make</title> | |
<style> | |
</style> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From: NicolasLetellier @ https://gist.github.com/Yimiprod/7ee176597fef230d1451#gistcomment-3058093 | |
function objectDiff(object, base) { | |
function changes(object, base) { | |
const accumulator = {}; | |
Object.keys(base).forEach((key) => { | |
if (object[key] === undefined) { | |
accumulator[`-${key}`] = base[key]; | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
search_all_up() { | |
# extended from https://stackoverflow.com/a/19011599/370746 | |
local look=${PWD%/} | |
while [[ -n $look ]]; do | |
for name in $@ ; do | |
[[ -e $look/$name ]] && { | |
printf '%s\n' "$look/$name" | |
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// regexp group 1: visible text group 2: ansi codes | |
// eslint-disable-next-line no-control-regex | |
const ansiMatcher = new RegExp("([^\u001B\u009B]*)([\u001B\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))|$)", "g") | |
function stripAnsi (s) { | |
return s.replace(ansiMatcher, "$1") | |
} | |
function truncateAnsi (s, len) { | |
let total = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// table resize test for tty-table | |
const Table = require("tty-table") | |
const Chalk = require("chalk") | |
let failures = [] | |
function test (width, truncate, marginLeft) { | |
let output = new Table([ | |
{minWidth: 6, shrink: 0}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tested on 2020-01-04 on latest rasbian (buster) and nano 4.7 | |
sudo apt-get install pkg-config libncursesw5-dev groff | |
URL="https://www.nano-editor.org$(curl https://www.nano-editor.org/download.php 2>/dev/null | grep -o '<a .*href=.*>' | sed -e 's/<a /\n<a /g' | sed -e 's/<a .*href=['"'"'"]//' -e 's/["'"'"'].*$//' -e '/^$/ d' | egrep '\.tar\.gz$')" | |
wget "$URL" | |
tar zxvf nano-*.tar.gz | |
cd nano-*[0-9] | |
sudo mkdir -p /usr/local/share/doc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isInViewport (elem, partially) { | |
let box = elem.getBoundingClientRect(), | |
top = box.top, | |
bottom = box.bottom, | |
right = box.right, | |
left = box.left, | |
h = window.innerHeight || document.documentElement.clientHeight, | |
w = window.innerWidth || document.documentElement.clientWidth, | |
fully = (top >= 0 && box.left >= 0 && bottom <= h && box.right <= w); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// save: | |
localStorage.temp = JSON.stringify(Array.from(document.querySelectorAll('input')).map(x => {console.log(x.value); return x.value})) | |
// restore: | |
JSON.parse(localStorage.temp).forEach((x,i) => document.querySelectorAll('input').item(i).value = x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for Dreamhost, need to adjust FcgidWrapper path for other hosts | |
AddHandler fcgid-script .html | |
FcgidWrapper "/dh/cgi-system/php72.cgi" .html |