If you're OK in having a node-esm
executable, please consider this solution.
#!/usr/bin/env sh
# the /usr/local/bin/node-esm executable
input_file=$1
shift
exec node --input-type=module - $@ <$input_file
// Credits: https://medium.com/@saeed.asghari.241/create-custom-event-in-typescript-8219054cee5d | |
class EventBus extends EventTarget { | |
constructor() { | |
super() | |
} | |
addCustomEventListener<T extends Partial<Record<string, any>>>( | |
type: string, | |
listener: (event: CustomEvent<T>) => void, |
If you're OK in having a node-esm
executable, please consider this solution.
#!/usr/bin/env sh
# the /usr/local/bin/node-esm executable
input_file=$1
shift
exec node --input-type=module - $@ <$input_file
# The command finds the most recent tag that is reachable from a commit. | |
# If the tag points to the commit, then only the tag is shown. | |
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object | |
# and the abbreviated object name of the most recent commit. | |
git describe | |
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix: | |
git describe --abbrev=0 | |
# other examples |
foo | |
bar | |
baz |
#!/usr/bin/env bash | |
# | |
# Authors: | |
# Stefan Buck (https://github.com/stefanbuck) | |
# Thomas Ruoff (https://github.com/tomru) | |
# | |
# | |
# Description: | |
# Are you still prefixing your commits with a ticket number manually? You will love this script! | |
# This is a git hook script that will automatically prefix your commit messages with a ticket |
#!/bin/sh | |
npm install |
#!/usr/bin/env bash | |
set -Eeuo pipefail | |
trap cleanup SIGINT SIGTERM ERR EXIT | |
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) | |
usage() { | |
cat <<EOF | |
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...] |
// Useful for debouncing callbacks to mousemove, resize, scroll event listeners | |
function debounce(fn) { | |
let raf; | |
return (...args) => { | |
if (raf) { | |
console.log('debounced'); | |
return; | |
} |
alias gh="open \`git remote -v | grep git@github.com | grep fetch | head -1 | cut -f2 | cut -d' ' -f1 | sed -e's/:/\//' -e 's/git@/http:\/\//'\`" |