Skip to content

Instantly share code, notes, and snippets.

View chranderson's full-sized avatar
👋

Chris Anderson chranderson

👋
  • Denver, Colorado
View GitHub Profile
@chranderson
chranderson / asyncDelay.js
Created August 8, 2018 15:39
async delay function
const delay = ms => new Promise(resolve => setTimeout(resolve, ms))
@chranderson
chranderson / indexArray.js
Created August 8, 2018 15:47
create indexed array by count
const createArray = count => Array(count).fill().map((x, i) => i)
const tenItemArray = createArray(10)
console.log(tenItemArray)
// [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
@chranderson
chranderson / .gitconfig
Created August 22, 2018 20:34
Fix git error: Could not read Username for gitlab
// cat ~/.gitconfig # Note, this might be ~/.git/config for you
[user]
email = user@example.com
name = Example user
[url "git@gitlab.com:"]
insteadOf = https://gitlab.com/
@chranderson
chranderson / createFavicon.txt
Created September 5, 2018 19:46
multi-size favicon generator
install imagemagick (node)
https://www.npmjs.com/package/imagemagick
- npm -g install imagemagick
- brew install imagemagick
// in directory that contains favicon.png, run bash command:
convert favicon.png -alpha on -resize 256x256 \
-define icon:auto-resize="256,128,96,64,48,32,16" \
favicon.ico
@chranderson
chranderson / .ts
Last active March 17, 2024 23:00
Typescript Patterns
/** String literal union from Enum */
enum Status {
FAILED: 'fail',
PENDING: 'pending,
SUCCESS: 'success',
}
type StatusType = `${AccessPassVariant}`
// StatusType = 'fail' | 'pending' | 'success'
@chranderson
chranderson / nvmCommands.js
Last active May 15, 2024 03:16
Useful NVM commands
// check version
node -v || node --version
// list locally installed versions of node
nvm ls
// list remove available versions of node
nvm ls-remote
// install specific version of node