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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
</head> | |
<body> | |
<progress id='imageProgress' value='0' max='100'></progress> |
// more minimal version of https://github.com/olahol/scrollparent.js/blob/master/scrollparent.js | |
const regex = /(auto|scroll)/; | |
const style = (node, prop) => | |
getComputedStyle(node, null).getPropertyValue(prop); | |
const scroll = (node) => | |
regex.test( | |
style(node, "overflow") + | |
style(node, "overflow-y") + |
// 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...] |