Copy the following lines into your terminal to register the hide
and show
aliases.
alias hide='xattr -w -x com.apple.FinderInfo "$(xattr -p -x com.apple.FinderInfo ~/Library)"'
alias show='xattr -d com.apple.FinderInfo 2> /dev/null'
function test(which, value) { | |
if (value > 0) throw new Error(`${which}: ${value}px`) | |
} | |
for (const element of document.querySelectorAll('*')) { | |
const { left, right } = element.getBoundingClientRect() | |
try { | |
test('right', right - window.innerWidth) | |
test('left', 0 - left) | |
} catch ({ message }) { |
# This app.yaml file assumes your static site is built into a directory called dist. | |
# Make sure dist only contains files you want to be made public. At a minimum, dist | |
# should contain an index.html and a 404.html. | |
# This can be any standard environment https://cloud.google.com/appengine/docs/standard/ | |
runtime: python312 | |
handlers: | |
# Handle files | |
- url: /(.+) |
/** | |
* Merges multiple arrays using a zip strategy. | |
* | |
* @example ƒ(['a', 'b'], [1, 2, 3]) → ['a', 1, 'b', 2, 3] | |
* @param {...[]} iterables | |
* @yields {*} | |
*/ | |
// | |
function* zipMerge(...iterables) { | |
const length = Math.max(...iterables.map(it => it.length)); |
/** | |
* The target language. [Browser support is good][1] but "en-US" is a safe default. | |
* | |
* [1]: https://developer.mozilla.org/en-US/docs/Web/API/NavigatorLanguage/language | |
* | |
* @type {string} | |
*/ | |
const { language = "en-US" } = navigator; | |
/** |
#!/bin/bash | |
BLUE='\033[1;34m' | |
GREEN='\033[1;32m' | |
PURPLE='\033[1;35m' | |
RED='\033[1;31m' | |
RESET='\033[0m' | |
WHITE='\033[1;37m' | |
YELLOW='\033[1;33m' |
export class CancellablePromise extends Promise { | |
#abortController; | |
constructor(callback) { | |
const abortController = new AbortController(); | |
super((resolve, reject) => { | |
callback(resolve, reject); | |
abortController.signal.addEventListener('abort', reject); | |
}); | |
this.#abortController = abortController; |
/** | |
* Utility function parse a string as HTML, SVG or XML. | |
* | |
* Example usage: | |
* parse('<a href="https://www.google.com">')[0].click(); | |
* | |
* @param {string} string The string to parse [1] | |
* @param {type='text/html'} string The mime type to parse the string as [2] | |
* @returns {HTMLCollection} A HTML collection of the parsed elements | |
* |
#!/bin/bash | |
printf 'Are you sure you want to run this command? [Y/n] ' | |
read -r yn | |
case $yn in | |
[Yy]* | '' ) | |
"$@" | |
;; | |
* ) | |
exit 1 |