Skip to content

Instantly share code, notes, and snippets.

View marcysutton's full-sized avatar

Marcy Sutton-Todd marcysutton

View GitHub Profile
@paulirish
paulirish / what-forces-layout.md
Last active April 24, 2024 12:47
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
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@pdbartsch
pdbartsch / .gitignore
Last active March 29, 2023 18:06
North America d3
data/*
*.zip
*.gzip
*.bu
*.paul
*.*~
Thank you for extending an invitation to speak at HighLoad++. I
sincerely appreciate your consideration.
I am an outspoken advocate for LGBTQ equality; this position is deeply
woven into my work. Clojure From The Ground Up is adamantly
LGBT-inclusive. Jepsen is named after a gay pop anthem and includes
dozens of references to same-sex relationships and trans identities. My
talk slides are populated with bearded nuns, genderqueer punks, and
trans hackers. My twitter feed is about as gay as it is possible to get.
@chrisbateman
chrisbateman / Active Element Logger.md
Last active January 10, 2019 08:25
Bookmarklet for logging the current document.activeElement

Bookmarklet: Active Element Logger

This will log the current document.activeElement to the console. Useful when debugging keyboard focus issues. Click once to turn it on, click again to turn it off.

Unfortunately, markdown gists aren't allowed to include JS in links, or this would work:

Active Element Logger

So you'll have to add this to your bookmarks the hard way:

@bkardell
bkardell / click-focus.js
Last active August 29, 2015 14:24
An experiment in effectively managing focus rings
document.addEventListener("DOMContentLoaded", function () {
document.body.addEventListener("mousedown", function (evt) {
if (!evt.target.setSelectionRange || evt.target.role === 'textbox' || evt.target.hasAttribute("disable-point-focus")) {
evt.target.setAttribute("point-focused", true);
}
});
document.body.addEventListener("blur", function (evt) {
evt.srcElement.removeAttribute("point-focused");
}, true);
});
@kentcdodds
kentcdodds / az-action.js
Created November 25, 2014 00:11
accessible ng-click
angular.module('atac.common').directive('azAction', function azActionDirective() {
'use strict';
return {
restrict: 'A',
link: function(scope, el, attrs) {
el.attr('tabindex', 0);
el.on('click', action);
el.on('keyup', function(event) {
if (event.which === 32 || event.which === 13) {
action();
@ThomasBurleson
ThomasBurleson / docSearcher.js
Last active August 29, 2015 14:10
Enhanced version of `docSearcher` webWorker discussed in Pete Darwin's blog [AngularJS Docs Performance](http://www.bacondarwin.co.uk/angularjs-docs-performance/)
angular.module('search', [])
.service('docsSearch', ['$q','$rootScope','$timeout','NG_PAGES',BackgroundSearchService]);
/**
* Document search service that uses Web Workers to index
* and search in the background.
*/
function BackgroundSearchService($q, $rootScope, $timeout, NG_PAGES) {
console.log('Using WebWorker Search Index');