Skip to content

Instantly share code, notes, and snippets.

View borisdiakur's full-sized avatar
🍵
♬♫♪◖(- ᵕ -)◗ノ ♪♫♬

Boris Diakur borisdiakur

🍵
♬♫♪◖(- ᵕ -)◗ノ ♪♫♬
View GitHub Profile
@borisdiakur
borisdiakur / git-tidy.sh
Last active September 28, 2023 07:39 — forked from antonio/delete_rebased_and_merged_branches.sh
Deletes branches which were rebased and merged into main.
#!/bin/sh
git stash
git checkout main
git fetch
git pull --rebase
for branch in $(git branch -a | sed 's/^\s*//' | sed 's/^remotes\///' | grep -v 'main$'); do
if [[ ! "$branch" =~ "origin/" ]]; then
last_commit_msg="$(git log --oneline --format=%f -1 $branch)"
if [[ "$(git log --oneline --format=%f | grep $last_commit_msg | wc -l)" -eq 1 ]]; then
@borisdiakur
borisdiakur / Snazzy entrance animations.css
Created December 16, 2022 13:16
Snazzy entrance animations
/* Animating to default styles? You only need the "from" part of your keyframes 🚀 */
keyframes scale-in {
from {
transform: scale(0);
}
}
@borisdiakur
borisdiakur / prototype poisoning fix one-liner.js
Created December 16, 2022 13:08
prototype poisoning fix one-liner
// prototype poisoning fix one-liner:
const noProto = (k, v, u) => k === '__proto__' ? u : v
// usage:
const json = '{ "a": 1, "__proto__": { "b": 2 } }'
const obj = JSON.parse(json, noProto)
console.log(obj.a) // 1
console.log(obj.b) // undefined
@borisdiakur
borisdiakur / CSS Viewport height.txt
Created December 16, 2022 13:03
CSS Viewport height
lvh: Largest viewport height (when browser UI is hidden)
svh: Smallest viewport height (when browser UI is visible)
dvh: Dynamically changes when browser UI is shown
@borisdiakur
borisdiakur / gist:a31e4ce48e5769470bc3b00578a59af1
Created December 16, 2022 12:11
Make html and body fill the viewport
:where(html) {
display: grid;
height: 100vh;
height: 100dvh;
}
@borisdiakur
borisdiakur / Nework_throttling_profiles.md
Created January 6, 2022 23:07 — forked from theodorosploumis/Nework_throttling_profiles.md
Web development - Custom network throttling profiles
Profile download (kb/s) upload (kb/s) latency (ms)
Native 0 0 0
GPRS 50 20 500
56K Dial-up 50 30 120
Mobile EDGE 240 200 840
2G Regular 250 50 300
2G Good 450 150 150
3G Slow 780 330 200
@borisdiakur
borisdiakur / ftpush
Last active February 11, 2016 22:09
Bash script for transmitting all changed (tracked and uncommited) files in a git repo to an ftp server via Transmits DockSend.
#!/bin/bash
#: Title : ftpush
#: Author : Boris Diakur
#: Version : 1.0
#: Description : Transmits all changed (tracked and uncommited) files to an ftp server via Transmits DockSend.
#: Options : None
for i in $(git status --short --untracked-files=no); do
if [[ -e "$i" ]]; then
echo "Transmitting $i"
@borisdiakur
borisdiakur / case-sensitive-seach.js
Last active April 27, 2023 03:47
Bookmarklet for case-sensitive search in Google Chrome (and other browsers which do not ship this feature). You can find install instruction below the code.
(function () {
'use strict';
var body = document.body,
html = document.documentElement;
var docHeight = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
var findingColor = 'limegreen';