Skip to content

Instantly share code, notes, and snippets.

View ktajpuri's full-sized avatar

kamlesh tajpuri ktajpuri

View GitHub Profile
@abdes-zakari
abdes-zakari / mac-git-name-branch.md
Created December 3, 2021 15:23
Add Git Branch Name to Terminal Prompt on Mac (Big Sur)

Add Git Branch Name to Terminal Prompt on Mac (Big Sur)

Open ~/.zprofile or ~/.zshrc in your favorite editor and add the following content to the bottom. ( if the file ~/.zprofile or ~/.zprofile does not already exist create it)

# Git branch in prompt.
function parse_git_branch() {
    git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p'
}
@paulirish
paulirish / what-forces-layout.md
Last active May 6, 2024 07:54
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.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent