Skip to content

Instantly share code, notes, and snippets.

View christianhg's full-sized avatar
🍔

Christian Grøngaard christianhg

🍔
View GitHub Profile
@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
@mgreensmith
mgreensmith / Slack_solarized_themes
Last active May 2, 2024 18:14
Solarized themes for Slack
Solarized
#FDF6E3,#EEE8D5,#93A1A1,#FDF6E3,#EEE8D5,#657B83,#2AA198,#DC322F
Solarized Dark
#073642,#002B36,#B58900,#FDF6E3,#CB4B16,#FDF6E3,#2AA198,#DC322F
@esfand
esfand / typescript_angular.adoc
Last active September 30, 2022 12:37
AngularJS with TypeScript
@robotlolita
robotlolita / loops-are-evil.md
Last active March 2, 2022 17:19
Why `xs.each(f)` should not be considered a "loop".

First and foremost, let's take a look at the following pieces of code. The first one is something you should be rather familiar with, and the second one is also a somewhat familiar idiom these days (at least in languages with higher-order functions):

// Example 1:
30 + 12

// Example 2:
xs.map(f)
@maxrice
maxrice / us-state-names-abbrevs.php
Created May 23, 2012 18:32
US State Names & Abbreviations as PHP Arrays
<?php
/* From https://www.usps.com/send/official-abbreviations.htm */
$us_state_abbrevs_names = array(
'AL'=>'ALABAMA',
'AK'=>'ALASKA',
'AS'=>'AMERICAN SAMOA',
'AZ'=>'ARIZONA',
'AR'=>'ARKANSAS',