Skip to content

Instantly share code, notes, and snippets.

@paulirish
paulirish / what-forces-layout.md
Last active December 8, 2025 09:19
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
@Stanback
Stanback / nginx.conf
Last active December 9, 2025 07:28 — forked from michiel/cors-nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@apa6ec
apa6ec / getMySteamPrices.js
Last active December 24, 2015 12:39
Calculate money on page https://store.steampowered.com/account/ . It is jQuery variant this gist: https://gist.github.com/Sintetic/6797297)
var summ = {
store: {},
gifts: {},
market: {
sell: {},
purchased: {}
}
};
var selector = '.transactions .transactionRow, .hidden_transactions .transactionRow';
@romannurik
romannurik / SwipeDismissListViewTouchListener.java
Last active August 5, 2025 08:10
**BETA** Android 4.0-style "Swipe to Dismiss" sample code
Moved to
https://github.com/romannurik/android-swipetodismiss
anonymous
anonymous / gist:1190397
Created September 3, 2011 01:57
private TextView htmlTextView;
private SpannableStringBuilder htmlSpannable;
@Override
public void onCreate(Bundle savedInstanceState) {
// ...
// first parse the html
// replace getHtmlCode() with whatever generates/fetches your html