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 / 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
@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 / 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 / .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 / 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 / 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 / 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
n=0; for f in *.pngx; do echo mv "$f" "${f/_*./_$(($n*7 + 660305562)).}"; ((n++)); done
@gnowland
gnowland / gist:29d362921e455c8f87b54d7652a2eedf
Created September 12, 2019 22:50
When node is giving you macos firewall trouble
# https://github.com/tj/n/issues/394#issuecomment-359570847
# remove current entry in firewall
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --remove /usr/local/bin/node && \
# copy current node from n
cp -pf /usr/local/n/versions/node/$(node -v | cut -d 'v' -f 2)/bin/node /usr/local/bin && \
# add to firewall
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /usr/local/bin/node
@gnowland
gnowland / gist:45c3e1c136ee14659059e4fc9fd816d7
Created February 18, 2019 21:04
Blockstack Verification
Verifying my Blockstack ID is secured with the address 1Biwu72jJTKhuaraFbBR9P39ZuWAEq8zR1 https://explorer.blockstack.org/address/1Biwu72jJTKhuaraFbBR9P39ZuWAEq8zR1