Skip to content

Instantly share code, notes, and snippets.

@brettz9
brettz9 / jsdoc.md
Last active Mar 2, 2022
Plain JavaScript + JSDoc with TypeScript tools. **Disclaimer**: I'm still rather a noob to TypeScript
View jsdoc.md

Plain JavaScript + TypeScript-flavored JSDoc (i.e., no need for TypeScript syntax)

Here are some basic tips for beginners trying to use TypeScript tooling against plain JavaScript + JSDoc files.

TypeScript-style documentation syntax is JSDoc, it's just a different dialect of JSDoc as far as which JSDoc tags have formally defined behavior, what the types are (there are many more available in the TypeScript flavor), and what the allowable syntax is (the TypeScript team tried to hew closely to JSDoc, but they avoided @module in favor of allowing import() of third party types and they don't yet support certain tags in a type-aware way--though for doc tools unrelated to type-checking it might not matter).

View output.txt
$ ffmpeg -i "Efficient-Searches-and-Shortcuts-1-SD-480p.mov" "Efficient-Searches-and-Shortcuts-1-SD-480p.webm"
ffmpeg version 3.3.4 Copyright (c) 2000-2017 the FFmpeg developers
built with Apple LLVM version 9.0.0 (clang-900.0.37)
configuration:
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
View Discussion on ESM-only projects.md

I understand your argument about force, and although I very much sympathize with the general tendency to seek to do things without what one could in a sense call "force", I think there are a few factors which are obscuring matters here.

For one, I think we have to be careful that we are not engaging in a fallacy of equivocation. While it is especially disconcerting to see "force" being used ot justify even well-intended behaviors, when understood as compulsion under threat of violence or imprisonment by the state, obviously we are not talking about anything remotely similar in degree here (assuming all would even agree that this is indeed a form of compulsion at all).

So saying "it's always wrong to force things on people" might be seen as gaining credence by attacking the strawman of a supposed claim justifying physical compulsion. This brings me to my second point which is about the polemical-sounding nature of engagement with such a fallacy.

Polemicists use ambiguous language such as this to obscure mat

@brettz9
brettz9 / detectEnv.js
Last active Feb 13, 2021
Detecting Node version for Node-based configs. Hope to integrate into an [mrm](https://github.com/sapegin/mrm) task.
View detectEnv.js
'use strict';
// Todo: Move to own repo
/**
* You can use this in your `.eslintrc.js` as follows...
*
* @example
*
* 'use strict';
@brettz9
brettz9 / resolve.js
Last active Apr 23, 2020
Promise-based `resolve`
View resolve.js
/*
import resolve from './resolve.js';
await resolve('tap', { basedir: __dirname });
*/
const _resolve = require('resolve');
const resolve = (path, opts = {}) => {
// eslint-disable-next-line promise/avoid-new
return new Promise((resolve, reject) => {
// eslint-disable-next-line promise/prefer-await-to-callbacks
@brettz9
brettz9 / .eslintignore
Last active Feb 26, 2020
Disabling of mostly stylistic rules when applying eslint-config-ash-nazg (for linting other projects or node_modules); should split these out within ash-nazg; also has overrides used for linting others' projects
View .eslintignore
# dist
# very unfortunately, it seems this can't be overridden apparently
# per https://eslint.org/docs/user-guide/configuring
# "ESLint always ignores files in /node_modules/* and /bower_components/*"
!node_modules
!.eslintrc.js
!.eslintrc-script.js
@brettz9
brettz9 / hyperJML.js
Last active Jan 19, 2021
hyperhtml wrapper (not currently put to use or tested)
View hyperJML.js
/* globals hyperHTML, jml, Interpolator */
// Relies on getInterpolator of Jamilih: https://github.com/brettz9/jamilih
'use strict';
window.hyperJamilih = (() => {
const map = new Map();
const {bind: hyper} = hyperHTML;
View pug-i18n.js
'use strict';
// Todo: Move to own repo
const {i18n} = require('intl-dom');
const walk = require('pug-walk');
const fileFetch = require('file-fetch');
global.fetch = fileFetch; // For `intl-dom`
View check-deprecated-packages.sh
jq -r '.dependencies,.devDependencies|keys[]' package.json | while read line; do \
printf "$line: "
[ "$(npm show "$line" | grep -ic 'DEPRECATED')" != "0" ] && \
printf "\e[1;31m""DEPRECATED\n""\e[0m" || \
printf "\e[1;32m""not deprecated.\n""\e[0m"
done
@brettz9
brettz9 / .npmrc
Last active Sep 28, 2019
My current npmrc config
View .npmrc
; Can get this file by `npm config edit` but doing so causes loss of some comments; better go get at `/Users/brett/.npmrc`
; Filed https://npm.community/t/npm-config-edit-reformats-file-stripping-user-comments/10287
; Off topic, but good info on migrating global npm for nvm:
; https://github.com/nvm-sh/nvm#migrating-global-packages-while-installing
; Also off topic: `npm star` not working
; https://npm.community/t/npm-star-shows-a-star-but-npm-stars-doesnt-list-any-stars-thereafter/10284
; Let\'s just try this and disable if ends up too oppressive (useful to