Skip to content

Instantly share code, notes, and snippets.

View KRostyslav's full-sized avatar
🇺🇦
Ukraine

Ros K. KRostyslav

🇺🇦
Ukraine
View GitHub Profile
@KRostyslav
KRostyslav / PUTvsPOSTvsPATCH.md
Created January 30, 2018 19:10 — forked from zmts/PUTvsPOSTvsPATCH.md
PUT or POST or PATCH?

PUT or POST or PATCH? PATCH!

TL;DR

POST для создания новых ресурсов
POST для остальных кастомных глаголов
PATCH для обновления ресурсов. В 99,99% на обновление уходят не все поля ('created_at' и 'updated_at' так точно)
На PUT можно забить =)
@KRostyslav
KRostyslav / script to run localTunnel
Last active April 10, 2021 16:23
Run localtunnel
#!/bin/bash
# Script for run localtunnel
# https://github.com/localtunnel/localtunnel
##### Constants
SUBDOMAIN='name'
PORT=8080
# =================================
# List all node_modules
# Linux.
$ cd documents
$ find . -name "node_modules" -type d -prune -print | xargs du -chs
# Windows
$ cd documents
$ FOR /d /r . %d in (node_modules) DO @IF EXIST "%d" echo %d"
# Prune images
$ docker image prune
or
$ docker image prune -a
# Prune containers
$ docker container prune
# Prune volumes
$ docker volume prune
@KRostyslav
KRostyslav / Clear localStorage on close tabs or browser
Last active June 16, 2020 10:04
Clear localStorage on close tabs/browser
((nm, tm) => {
const lStorage = localStorage;
const sStorage = sessionStorage;
const tabId = sStorage.getItem(tm)
|| ((newId) => {
sStorage.setItem(tm, newId);
return newId;
})((Math.random() * 1e8).toFixed());
const update = (setTabValue) => {
let currentValue = JSON.parse(lStorage.getItem(nm) || '{}');