Skip to content

Instantly share code, notes, and snippets.

View NewEXE's full-sized avatar
🌀
WIP

Vlad Voloshyn NewEXE

🌀
WIP
  • Sweet Stack Digital
  • Ukraine, Kharkiv
View GitHub Profile
@NewEXE
NewEXE / get-enum-key.ts
Created July 6, 2022 12:42
Get enum key by value (Typescript)
export const getEnumKeyByValue = (enumerated, value: string) => {
return Object.keys(enumerated)[
Object.values(enumerated).indexOf(value as typeof enumerated)
];
};
@NewEXE
NewEXE / spread-exclude.js
Created October 18, 2022 13:08
JS spread operator: exclude properties
// Example: exclude (separate) 'notifyUser' property from 'request' object
const request = {
id: 1,
title: 'ID 1 title',
notifyUser: true
};
const { notifyUser, ...updateSet } = request;
@NewEXE
NewEXE / remove-docker-entities.sh
Created March 16, 2023 13:42
Remove all docker entities (containers, images, volumes, networks)
# Remove containers
docker rm -f $(docker ps -a -q)
# Remove images
docker rmi -f $(docker images -a -q)
# Remove volumes
docker volume rm $(docker volume ls -q)
docker volume prune
docker system prune --volumes