Skip to content

Instantly share code, notes, and snippets.

@gadzhimari
gadzhimari / conventional_commit_messages.md
Created November 28, 2022 10:46 — forked from qoomon/conventional_commit_messages.md
Conventional Commit Messages

Conventional Commit Messages

See how a minor change to your commit message style can make a difference. Examples

Have a look at CLI util git-conventional-commits to ensure this conventions and generate changelogs

Commit Formats

Default

@gadzhimari
gadzhimari / useGeolocation.js
Created November 9, 2021 07:02
Geoposition hook
import { useReducer } from 'react';
import { useEffectOnce } from 'react-use';
import { GeolocationPositionError } from 'errors';
const geoPositionReducer = (state, action) => {
switch (action.type) {
case 'error': {
return {
...state,
status: 'error',
@gadzhimari
gadzhimari / link.js
Created July 17, 2019 06:27
Link parser for chat messaging app
@gadzhimari
gadzhimari / what-forces-layout.md
Created May 14, 2019 10:29 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@gadzhimari
gadzhimari / WebAssembly.md
Created November 30, 2018 17:28
Installation and configuration of Emscripten and things that related to WebAssembly

Cannot find /usr/bin/llvm-link, check the paths in ~/.emscripten

Solution: Manually set LLVM_ROOT to /usr/local/opt/emscripten/libexec/llvm/bin

@gadzhimari
gadzhimari / adobe_cc.md
Created November 22, 2018 11:29
Completely Remove Adobe from your Mac in 2 Steps

Step 1

Download and run the Adobe Creative Cloud Cleaner Tool, their multi-app uninstaller and wipe assistant. Adobe does recommend running individual application uninstallers first, your call. Click the Clean All option.

Step 2

Type a one line command in terminal find ~/ -iname "*adobe*" and it's shows up all files which match pattern.

To remove all files

`sudo rm -rf /Applications/Adobe* /Applications/Utilities/Adobe* /Library/Application\ Support/Adobe /Library/Preferences/com.adobe.* /Library/PrivilegedHelperTools/com.adobe.* /private/var/db/receipts/com.adobe.* ~/Library/Application\ Support/Adobe* ~/Library/Application\ Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/com.adobe* ~/Library/Application\ Support/CrashReporter/Adobe* ~/Library/Caches/Adobe ~/Library/Caches/com.Adobe.* ~/Library/Caches/com.adobe.* ~/Library/Cookies/com.adobe.* ~/Library/Logs/Adobe* ~/Librar

@gadzhimari
gadzhimari / dotfiles.md
Created November 8, 2018 07:34
Dotfiles configuration

Sync dotfiles

The best way to store your dotfiles is bare repository.

No extra tooling, no symlinks, files are tracked on a version control system, you can use different branches for different computers, you can replicate you configuration easily on new installation.

More about this techique

@gadzhimari
gadzhimari / url-detect.js
Created November 6, 2018 18:25
Detect url in text
// const pattern = /(?:\[(.+)\]\()?((?:https?|ftp):\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-z]{2,6}\b(?:[-a-zA-Z0-9@:%_\+.~#?&\/\/=():!,\'\'\*]*))/ig;
// const pattern = /(?:\[(.+)\]\()?((https?:\/\/|ftps?:\/\/)?([a-z0-9\-]+\.){1,}([a-z0-9\-]+)?(:(\d{1,5}))?(\/([a-z0-9\-._~:\/\?#\[\]@!$&'\(\)\*\+,;=%]+)?)?)/ig;
const pattern = /(?:\[(.+)\]\()?(((?:https?|ftps?):\/\/)?(?:www\.)?[-a-z0-9]+\.[a-z]{2,6}\b([-a-z0-9._~:\/\?#\[\]@!$&'()\*\+,;=%]+)?)/ig;
//
// const pattern = /(?:\[(.+)\]\()?((?:https?|ftp):\/\/\S+)/ig;
// const pattern = /(?:\[(.+)\]\()?(([--:\w?@%&+~#=]*\.[a-z]{2,4}\/{0,2})((?:[?&](?:\w+)=(?:\w+))+|[--:\w?@%&+~#=\(\)]+)?)/ig;
@gadzhimari
gadzhimari / git.md
Last active August 20, 2019 08:23
List of resources and helpful info about commands

Basics

In git there is three essential entity: blob, tree object and commit.

Reset

To throw away local changes exits couple of similar commands
git reset --hard
git checkout -f <branch>

Note: Untracked files will be untouched. The <branch> is optional and if we specified the HEAD it's unnecessary, because by default it's reference to the currently checked out commit.

@gadzhimari
gadzhimari / npm.md
Last active November 16, 2018 17:06
Npm cheatsheet

Install fixed version of package

npm install --save --save-exact react

Set a default in .npmrc config

npm config set save-exact=true

Install package from Git and Github repository

As of NPM version 1.1.65, we can do this: npm install /#