This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NVM Changing node versions automatically per directory - place this after nvm initialization on .zshrc file | |
autoload -U add-zsh-hook | |
load-nvmrc() { | |
local node_version="$(nvm version)" | |
local nvmrc_path="$(nvm_find_nvmrc)" | |
if [ -n "$nvmrc_path" ]; then | |
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")") | |
if [ "$nvmrc_node_version" = "N/A" ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.Aligner { | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
} | |
.Aligner-item { | |
max-width: 50%; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
build: | |
@for f in *.diag; do \ | |
seqdiag -T svg $$f; \ | |
base=$$(basename $$f .diag); \ | |
cairosvg -o $${base}.pdf $${base}.svg; \ | |
echo "$$f --> $$base.pdf"; \ | |
done | |
clean: | |
rm -rf *.pdf *.svg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const subscriptions = {}; | |
var crypto = require("crypto"); | |
const webpush = require("web-push"); | |
const vapidKeys = { | |
privateKey: process.env.WEB_PUSH_NOTIFICATIONS_PRIVATE_KEY, | |
publicKey: process.env.WEB_PUSH_NOTIFICATIONS_PUBLIC_KEY | |
}; | |
webpush.setVapidDetails("mailto:[email protected]", vapidKeys.publicKey, vapidKeys.privateKey); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mystringVar = "abcde \x31\xE2\x83\xA3" | |
myStringVar.replace(/[^\x20-\x7E]+/g, "") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- https://stackoverflow.com/questions/20342717/postgresql-change-column-type-from-int-to-uuid | |
CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; | |
ALTER TABLE tableA ALTER COLUMN colA SET DATA TYPE UUID USING (uuid_generate_v4()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const arrayToObject = (array, keyField) => | |
array.reduce((obj, item) => { | |
return {...obj, [item[keyField]]: item} | |
}, {}); | |
const peopleObject = arrayToObject(peopleArray, "id"); | |
console.log(peopleObject); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const addresses = [...]; | |
const uniqueAddresses = Array.from(new Set(addresses.map(a => a.id))) | |
.map(id => { | |
return addresses.find(a => a.id === id) | |
}); |