Skip to content

Instantly share code, notes, and snippets.

@paulirish
paulirish / what-forces-layout.md
Last active May 31, 2024 22:37
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
@Restuta
Restuta / framework-sizes.md
Last active March 7, 2024 00:01
Sizes of JS frameworks, just minified + minified and gzipped, (React, Angular 2, Vue, Ember)

Below is the list of modern JS frameworks and almost frameworks – React, Vue, Angular, Ember and others.

All files were downloaded from https://cdnjs.com and named accordingly. Output from ls command is stripped out (irrelevant stuff)

As-is (minified)

$ ls -lhS
566K Jan 4 22:03 angular2.min.js
@treshugart
treshugart / example.jsx
Last active May 6, 2024 04:53
Give yourself full control over the DOM that any hyperscript VDOM style function creates http://www.webpackbin.com/4kR0ZnXFf
import hify from './create-element';
import React from 'react';
import { render } from 'react-dom';
const h = hify(React.createElement.bind(React));
class Test extends HTMLElement {
static observedAttributes = ['attr']
attributeChangedCallback (name, oldValue, newValue) {
this.innerHTML = `Hello, ${this.getAttribute('attr')}!`;
@ibraheem4
ibraheem4 / postgres-brew.md
Last active May 30, 2024 04:53 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update

A Redux Story

Developer: "Doo Doo Doo... Working on the new Redux rewrite. Gotta write some fetch actions..."

FETCH_USERS -> function fetchUsersAction() {...}
FETCH_PAGES -> function fetchPagesAction() {...}
FETCH_FRIENDS -> function fetchFriendsAction() {...}
FETCH_GROUPS -> function fetchGroupsAction() {...}
FETCH_EVENTS -> function fetchEventsAction() {...}

The Challenge

Compare two (or more) tools that are trying to solve a similar set of problems, without discussing any of the following:

  • Community
  • Programming Language
  • Documentation/Examples/Demos/etc
  • Stars/Forks/Downloads/Issues/PRs/Stack Overflow Answers/etc
  • Age/Maturity of tool
@chrissm79
chrissm79 / App.tsx
Last active December 29, 2019 03:46
Relay Snapshots
// create relay environment
import { RelaySnapshot } from './RelaySnapshot'
import { RecordSource } from './RecordSource'
import { Store } from './Store'
export const environment = new Environment({
network: Network.create(fetchQuery),
store: new Store(new RecordSource()),
})
@sibelius
sibelius / AutocompleteRelay.tsx
Last active March 23, 2024 10:13
@material-ui Autocomplete lab with react-window + infinite-loader for GraphQL/Relay connections
import React, { useRef, useState } from 'react';
import { Typography } from '@material-ui/core';
import TextField from '@material-ui/core/TextField';
import CircularProgress from '@material-ui/core/CircularProgress';
import Autocomplete, {
AutocompleteChangeDetails,
AutocompleteChangeReason,
AutocompleteProps
} from '@material-ui/lab/Autocomplete';
@Offirmo
Offirmo / javascript_learning_resources.md
Last active May 8, 2024 07:47
[Resources for learning JavaScript] #JavaScript
@challapradyumna
challapradyumna / DGraph.arm64.Dockerfile
Created April 23, 2021 17:53
Build DGraph for ARM processor
ARG GOLANG=1.13.8-buster
FROM golang:${GOLANG} as builder
RUN apt-get update && apt-get install -qy build-essential software-properties-common gcc make sudo
ENV CGO_ENABLED=1 GOOS=linux GOARCH=arm64
RUN go get -u -v google.golang.org/grpc && \
git clone --depth 1 --branch v20.07.2 https://www.github.com/dgraph-io/dgraph/ && \
cd dgraph && \
make dgraph