Skip to content

Instantly share code, notes, and snippets.

View adi518's full-sized avatar
🎯
Focusing

Adi adi518

🎯
Focusing
View GitHub Profile
@adi518
adi518 / what-forces-layout.md
Created July 13, 2018 23:50 — 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()
@adi518
adi518 / gist:a8be5e1b436648776da8d2e886f735ab
Created June 16, 2018 13:16 — forked from snowman-repos/gist:3825198
JavaScript: Detect Orientation Change on Mobile Devices
// Listen for orientation changes
window.addEventListener("orientationchange", function() {
// Announce the new orientation number
alert(window.orientation);
}, false);
// Listen for resize changes
window.addEventListener("resize", function() {
// Get screen size (inner/outerWidth, inner/outerHeight)
@adi518
adi518 / package.json
Created March 28, 2018 15:53 — forked from ronapelbaum/package.json
PM Version Management Auto-Patch Gist
{
"name": "my-package",
"version": "1.2.0",
"scripts": {
"patch-version": "node patch-version.js",
"tag-version": "node tag-version.js \"release-tag\"",
"prerelease": "npm run patch-version && npm run tag-version",
"release": "npm publish",
}
}
@adi518
adi518 / Uppercase.vue
Last active January 20, 2018 17:50 — forked from bengry/Uppercase.vue
// Uppercase.vue
<template>
<div>
<slot v-bind="{style: style}" />
</div>
</template>
<script>
export default {
data() {
@adi518
adi518 / styles.less
Created April 26, 2017 23:43 — forked from brandondurham/styles.less
Using Operator Mono in Atom
/**
* Using Operator Mono in Atom
*
* 1. Open up Atom Preferences.
* 2. Click the “Open Config Folder” button.
* 3. In the new window’s tree view on the left you should see a file called “styles.less”. Open that up.
* 4. Copy and paste the CSS below into that file. As long as you have Operator Mono SSm installed you should be golden!
* 5. Tweak away.
*
* Theme from the screenshot (http://cdn.typography.com/assets/images/blog/operator_ide2.png):
@adi518
adi518 / bem.html
Created February 23, 2017 17:34 — forked from Integralist/bem.html
In CSS/BEM: how do we name a sub-block that is related to its parent block?
<!-- Simplest solution is to just label the element as a element within an element -->
<div class="block">
Content
<div class="block__element">
Content
<div class="block__element__element">
Content related to `block__element`
</div>
</div>
</div>