node.js でパスを取得する方法についてのメモ
$ node ~/hoge/Foo.js/a.js
を実行したときに、
process.argv[1]
から、node コマンドに指定された a.js のパス(~/hoge/Foo.js/a.js
)を取得できます
javascript:(function(){var d=document.getElementsByClassName("css-18t94o4 css-1dbjc4n r-1niwhzg r-p1n3y5 r-sdzlij r-1phboty r-rs99b7 r-1w2pmg r-1vuscfd r-1dhvaqw r-1ny4l3l r-1fneopy r-o7ynqc r-6416eg r-lrvibr")[0].getAttribute('data-testid').split('-')[0];window.open('https://idtwi.com/'+d);})() |
node.js でパスを取得する方法についてのメモ
$ node ~/hoge/Foo.js/a.js
を実行したときに、
process.argv[1]
から、node コマンドに指定された a.js のパス( ~/hoge/Foo.js/a.js
)を取得できます#!/usr/bin/env bash | |
# MIT © Sindre Sorhus - sindresorhus.com | |
# git hook to run a command after `git pull` if a specified file was changed | |
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`. | |
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" | |
check_run() { | |
echo "$changed_files" | grep --quiet "$1" && eval "$2" |