Skip to content

Instantly share code, notes, and snippets.

View devzom's full-sized avatar
:octocat:
Coding for life and fun

Jakub Zomerfeld devzom

:octocat:
Coding for life and fun
View GitHub Profile
@devzom
devzom / git-remove-file-from-whole-history.bash
Created July 28, 2022 10:42
git: Remove specific file from whole git history
git rm --cached --ignore-unmatch filePath --prune-empty --tag-name-filter cat -- --all
@devzom
devzom / generateEnvExample.sh
Last active October 25, 2022 13:56
Create .env.dev example file structure based on .env file
#!/bin/bash
# (generate only keys, without values)
sed 's/=.*/=/' .env > .env.dev
@devzom
devzom / zsh-aliases.txt
Last active March 8, 2025 09:53
ZSH: custom aliases
# ZSH Aliases on MacOs
## For a full list of active aliases, run `alias`.
# NAVIGATION
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
# COMMON DIRECTORIES
@devzom
devzom / git-logs-commands.sh
Last active September 5, 2023 19:22
Git diff & log multicommand
### This snippets allow to make a log of work within given date range, used for author timework report:
#### all excludes *-lock.* files
# make git diff from files on 2 branches excluding package-lock.json, filtered by author and date range
git diff main branchB -- . ':(exclude)*-lock.*' --after="2023-05-01" --until="2023-06-01" --author="$(git config --global user.name)" --pretty=format:"%ad - %an: %s" > project_name-"$(git config --global user.name)"-diff-11_2023.txt
#make log from whole project filtered by date range and author
git log main branchB --since=4.weeks -p --stat --abbrev-commit --author="$(git config --global user.name)" ':(exclude)*-lock.*' > project_name-"$(git config --global user.name)"-diff-01_2023.txt
#make log of current branch and the changes for specific author
@devzom
devzom / cssCheckOverflowElements.js
Last active January 11, 2023 10:19
CSS: check and list all overflow'ed HTML elements
// this snippets allow to list all of the elements which overflow page and is wider than HTML <body/>
var docWidth = document.documentElement.offsetWidth;
[].forEach.call(
document.querySelectorAll('*'),
(el) => {
if (el.offsetWidth > docWidth) {
console.log(el);
}
// Utility function for try-catch,
// handle promises, where error is always of type Error.
// The function returns tuple [data, error], where data is result of promise and error is error if promise is rejected.
// Usage:
// const [productData, productError] = await tryCatch(getProduct(1))
// if (error) throw new Error(productError.message || 'Cannot get product data', {cause: productError})
// else console.log(data)
type SuccessResults<T> = readonly [T, null]