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'
# 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: /(.+) |
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; |
#!/bin/bash | |
printf 'Are you sure you want to run this command? [Y/n] ' | |
read -r yn | |
case $yn in | |
[Yy]* | '' ) | |
"$@" | |
;; | |
* ) | |
exit 1 |
/** | |
* 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)); |
#!/usr/bin/env bash | |
BLUE='\033[1;34m' | |
RESET='\033[0m' | |
WHITE='\033[1;37m' | |
echo -e "Creating temp dir..." | |
tempdir=$(mktemp -d) | |
pushd $tempdir &>/dev/null | |
echo -e "${BLUE}!${WHITE} Starting a new shell. Type ${BLUE}exit${WHITE} to return.${RESET}" |
function watchMediaQuery(media, truthy = true, falsy = false) { | |
const listeners = []; | |
const mediaQuery = matchMedia(`(${media}: ${truthy})`); | |
mediaQuery.addListener(() => { | |
for (const listener of listeners) listener(); | |
}); | |
return (fn) => { | |
const listener = () => fn(mediaQuery.matches ? truthy : falsy) | |
listeners.push(listener); | |
listener(); |
#!/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' |
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 }) { |
/** | |
* Usage example | |
* | |
* ``` | |
* const myStore = new Store({ | |
* count: 1, | |
* }); | |
* | |
* myStore.addEventListener('change', () => { | |
* console.log(store.state.count); |