Skip to content

Instantly share code, notes, and snippets.

View decentraliser's full-sized avatar
🦈
In a sharking mood

Decentraliser🌵🍄 decentraliser

🦈
In a sharking mood
View GitHub Profile
@decentraliser
decentraliser / enum-extraction.ts
Last active March 11, 2020 10:07
Extract strings and numbers from enums
// A simple way to extract strings and numbers from an enum
enum actions {
Link = 1,
Unlink = 0
}
const strings = Object.keys(actions)
.filter((key) => Number.isNaN(parseFloat(key)))
@decentraliser
decentraliser / git-aliases
Last active November 17, 2024 08:18
Git aliases
[alias]
b = branch -vv
ba = branch -a -vv
bb = branch
cb = checkout -b
cm = checkout master
cma = checkout main
cnv = commit -m --no-verify
co = checkout
d = branch -D
@decentraliser
decentraliser / promises-iterations.js
Last active June 7, 2023 05:39
Promises iteration with for of
const promise = (number) => new Promise(resolve => {
setTimeout(() => resolve(number), Math.random() * Math.floor(1000))
})
const sequentialIteration = async () => {
for (const number of Array(10).keys()) console.log(await promise(number))
}
sequentialIteration()