Skip to content

Instantly share code, notes, and snippets.

View gnowland's full-sized avatar
💭
Let's design a world that's thoughtful, considered, and aesthetically pleasing.

Gifford Nowland gnowland

💭
Let's design a world that's thoughtful, considered, and aesthetically pleasing.
View GitHub Profile
@gnowland
gnowland / Makefile
Last active September 30, 2020 05:36
Makefile get_input
ifdef APP_EXISTS # If app directory already exists
@printf "# checking whether composer.json file has changed..."
ifeq ($(shell sed 's/PHP_VERSION/$(PHP_VERSION)/' src/composer.json | cmp -s - $(APP_NAME)/composer.json && echo false || echo true),true)
@printf " it has\n"
@echo update composer? [Y/n]
@read line; if [[ $$line = "y" || $$line = "Y" ]]; then make composer_update; fi
else
@printf " it's the same\n"
endif
else
@gnowland
gnowland / gist:6e6b8b4e0a3f564644ea00741b6aa89c
Created March 15, 2021 06:57
Configure and Clean NPM proxy
Purging any npm particles in the system:
npm config rm proxy
npm config rm proxy --global
npm config rm https-proxy
npm config rm https-proxy --global
npm config rm registry
npm cache clean
sudo apt-get remove nodejs nodejs-dev node-gyp libssl1.0-dev npm
@gnowland
gnowland / dockerfile-output
Last active June 2, 2021 23:50
Get the output of a command during docker build
RUN [command] 1>&2 && return 1
@gnowland
gnowland / .eslintrc.js
Created September 23, 2021 04:20
React eslint golden
/*
This file was autogenerated by tslint-to-eslint-config: https://github.com/typescript-eslint/tslint-to-eslint-config.
It represents the closest reasonable ESLint configuration to this project"s original TSLint configuration.
AirBnB recommended setup: https://github.com/iamturns/create-exposed-app/blob/master/.eslintrc.js
*/
module.exports = {
root: true,
plugins: [
"@typescript-eslint",
@gnowland
gnowland / fix-eslint.sh
Created September 23, 2021 08:34
run a single fix through eslint npx
npx eslint --no-eslintrc --parser @typescript-eslint/parser --plugin 'import' --rule 'import/no-duplicates: "error"' --fix . --ext .js,.jsx,.ts,.tsx
@gnowland
gnowland / typescript-objects.md
Last active September 23, 2021 23:38
Typescript Objects
  • Avoid the Object and {} types, as they mean "any non-nullish value".
  • Avoid the object type, as it is currently hard to use due to not being able to assert that keys exist.

USE:

Record<string|number|symbol, unknown> | null | unknown[]
@gnowland
gnowland / bump.sh
Last active November 13, 2021 00:06
Use interactive menu to pass SemVer target to npm-version command
#!/bin/bash
# Portions of this script are Copyright (C) 2017 Ingo Hollmann - All Rights Reserved
# Permission to copy and modify is granted under the Creative Commons Attribution 4.0 license
# https://www.bughunter2k.de/blog/cursor-controlled-selectmenu-in-bash
# Last revised 2020-11-12 by Gifford Nolwland [https://giffordnowland.com]
ESC=$(printf "\e")
curr=0
declare -a target=("patch" "minor" "major") # mac does not support associative arrays

Promises must be handled appropriately or explicitly marked as ignored with the void operator.eslint@typescript-eslint/no-floating-promises

That's a crappy error message. A better one might be,

every expression of type Promise must end with a call to .catch or a call to .then with a rejection handler (source).

So, for example, if you do

@gnowland
gnowland / bump.sh
Last active March 25, 2022 12:11
interactive semver target script
#!/bin/bash
# Portions of this script are Copyright (C) 2017 Ingo Hollmann - All Rights Reserved
# Permission to copy and modify is granted under the Creative Commons Attribution 4.0 license
# https://www.bughunter2k.de/blog/cursor-controlled-selectmenu-in-bash
# Last revised 2020-11-12 by Gifford Nolwland <hi@giffordnowland.com>
# Call this file as so: `./select.sh "${ARRAY[@]}"`
# per https://stackoverflow.com/a/36808100/2764290
ESC=$(printf "\e")
@gnowland
gnowland / venmo csv excel description generator.vb
Created April 16, 2022 07:49
Venmo CSV description generator excel function
=IF(EXACT([@Type],"Standard Transfer"),"To "&[@Column2],IF([@[Amount (total)]]>0,"From "&IF(EXACT([@Type],"Charge"),[@To],[@From]),"To "&IF(EXACT([@Type],"Charge"),[@From],[@To]))&" for "&CHAR(34)&[@Note]&CHAR(34))