Skip to content

Instantly share code, notes, and snippets.


Senica Gonzalez senica

View GitHub Profile
paulirish /
Last active May 20, 2022
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
lrvick / app.js
Last active Nov 11, 2019
AngularJS credit card form with validation
View app.js
// MIT:
angular.module('app', []);
( 'MainCtrl'
, function($scope,$locale) {
$scope.currentYear = new Date().getFullYear()
$scope.currentMonth = new Date().getMonth() + 1
$scope.months = $locale.DATETIME_FORMATS.MONTH
branneman / svg-classes.js
Created Jan 15, 2014
SVG — hasClass, addClass, removeClass, toggleClass
View svg-classes.js
// SVG — hasClass, addClass, removeClass, toggleClass
// Source:
// Taken and adapted from:
if (SVGElement && SVGElement.prototype) {
dergachev /
Last active May 18, 2022
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF


To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

fnando / dev.conf
Created Jul 23, 2011
Nginx configuration for SSH tunnel
View dev.conf
upstream tunnel {
server {
listen 80;
location / {
proxy_set_header X-Real-IP $remote_addr;