Skip to content

Instantly share code, notes, and snippets.

paulirish /
Last active Oct 30, 2020
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
ImJasonH / markdown.css
Last active Oct 19, 2020
Render Markdown as unrendered Markdown (see
View markdown.css
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
ericclemmons /
Last active Oct 8, 2020
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

 <summary>Summary Goes Here</summary>
bxt /
Last active Aug 30, 2020
A very basic caching python HTTP proxy server.
# Originally from
# Usage:
# A call to http://localhost:80000/ will cache the file
# at on disc and not redownload it again.
# To clear the cache simply do a `rm *.cached`. To stop the server simply
# send SIGINT (Ctrl-C). It does not handle any headers or post data.
import BaseHTTPServer
import hashlib
mmerickel /
Last active Apr 24, 2020
cors in pyramid
def includeme(config):
'add_cors_preflight_handler', add_cors_preflight_handler)
config.add_route_predicate('cors_preflight', CorsPreflightPredicate)
config.add_subscriber(add_cors_to_response, '')
class CorsPreflightPredicate(object):
gosko / dt
Created Mar 24, 2020
dt - display current date/time in various time zones
View dt
# dt: display useful date/time info incl current time in various time zones
# any optional extra args are passed along to date, e.g. '--date "2 weeks ago"'
/usr/bin/cal -3
vincent-zurczak /
Last active Jan 17, 2020
HTML 5 validation in Java (based on the Nu HTML Checker)
* Verifies that a HTML content is valid.
* @param htmlContent the HTML content
* @return true if it is valid, false otherwise
* @throws Exception
public boolean validateHtml( String htmlContent ) throws Exception {
InputStream in = new ByteArrayInputStream( htmlContent.getBytes( "UTF-8" ));
ByteArrayOutputStream out = new ByteArrayOutputStream();
tylor / Procfile
Created Dec 7, 2012
Quick node.js HTTP proxy on Heroku
View Procfile
web: node index.js

Room Rules

1. Speak English!

2. Don't be a dick!

henare / mw-to-gollum.rb
Created Mar 10, 2011
Imports a MediaWiki XML export into a Gollum wiki
View mw-to-gollum.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'hpricot'
require 'gollum'
wiki ='')
file ="OpenAustralia-20110309232515.xml", "r")
doc = Hpricot(file)
You can’t perform that action at this time.