Skip to content

Instantly share code, notes, and snippets.

@ladislavsulc
ladislavsulc / example.html
Last active July 11, 2017 00:47
Responsive images - Wordpress (Timber)
<img
src="{{ post.thumbnail.src|resize(480) }}"
srcset="
{{ post.thumbnail.src|resize(480) }} 480w,
{{ post.thumbnail.src|resize(220) }} 220w
"
sizes="
(min-width: 980px) 25vw,
50vw
"
@dverbovyi
dverbovyi / gulpfile.js
Last active January 19, 2021 12:41
ES6 project with Gulp, Sass, Babel & Browserify
/**
* Created by Dmytro on 3/27/2016.
*/
var browserify = require('browserify'),
gulp = require('gulp'),
sourcemaps = require('gulp-sourcemaps'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
source = require('vinyl-source-stream'),
buffer = require('vinyl-buffer'),
@paulirish
paulirish / what-forces-layout.md
Last active April 30, 2024 17:56
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
@glennblock
glennblock / fork forced sync
Created March 4, 2012 19:27
Force your forked repo to be the same as upstream.
git fetch upstream
git reset --hard upstream/master