Skip to content

Instantly share code, notes, and snippets.

View jherax's full-sized avatar
:atom:
Performance focused

David Rivera jherax

:atom:
Performance focused
View GitHub Profile
@jherax
jherax / promise.allSettled.js
Last active July 16, 2024 17:17 — forked from davidbarral/promises.js
Promise.allSettled: polyfill
/**
* The Promise.allSettled() method returns a promise that resolves
* after all of the given promises have either resolved or rejected,
* with an array of objects that each describe the outcome of each promise.
*
* For each outcome object, a `status` string is present.
* If the status is "fulfilled", then a `value` is present.
* If the status is "rejected", then a `reason` is present.
* The value (or reason) reflects what value each promise
* was fulfilled (or rejected) with.
@jherax
jherax / what-forces-layout.md
Created June 15, 2020 18:09 — forked from paulirish/what-forces-layout.md
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
@jherax
jherax / onScroll.rAF.js
Last active July 17, 2024 01:08 — forked from koistya/App.js
How to add `onscroll` event with requestAnimationFrame in ReactJS component
import React from 'react';
let lastScrollY = 0;
let ticking = false;
class App extends React.Component {
componentDidMount() {
window.addEventListener('scroll', this.handleScroll);
}
@jherax
jherax / git-ssh-auth-win-setup.md
Last active September 4, 2024 19:07 — forked from bsara/git-ssh-auth-win-setup.md
Setup SSH Authentication for Git Bash on Windows

Setup SSH Authentication for Git Bash on Windows

Prepararation

  1. Create a folder at the root of your user home folder (Example: C:/Users/username/) called .ssh.
    You can run something like: mkdir -p ~/.ssh
  2. Create the following files if they do not already exist (paths begin from the root of your user home folder):
@jherax
jherax / subl
Created March 14, 2018 15:33 — forked from cmalard/subl
Cygwin + Sublime Text 3 : works with files and Git
#!/bin/bash
# To create in [.babun/]cygwin/usr/local/bin/subl with chmod +x
ARGS=""
while test $# -gt 0
do
ARGS="$ARGS ${1#/cygdrive/[a-zA-Z]}"; # Remove /cygdrive and disk letter from the path
shift
done
pact install python-setuptools python-ming
pact install libxml2-devel libxslt-devel libyaml-devel
curl -skS https://bootstrap.pypa.io/get-pip.py | python
Optional/Not sure what these are for:
pip install virtualenv
curl -skS https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | python
@jherax
jherax / install.sh
Last active May 30, 2020 15:41 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"