Skip to content

Instantly share code, notes, and snippets.

@schalkneethling
Last active February 4, 2022 11:09
Show Gist options
  • Save schalkneethling/d13c3e3a3f03e18ca8c1ab7a140abbe7 to your computer and use it in GitHub Desktop.
Save schalkneethling/d13c3e3a3f03e18ca8c1ab7a140abbe7 to your computer and use it in GitHub Desktop.
Random snippets
# count all `index.html` and `index.md` files in the current directory recursively.
find . -iname 'index.html' -o -iname 'index.md' | wc -l
// __dirname in ESM
import { fileURLToPath } from "url";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
// for use in ESM
import { createRequire } from "module";
const require = createRequire(import.meta.url);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment