Skip to content

Instantly share code, notes, and snippets.

Performance focused

David Rivera jherax

Performance focused
View GitHub Profile
jherax / absmartly.config.json
Last active Apr 19, 2022
ABSmartly configuration test
View absmartly.config.json
"assignments": [
"pathName": "/",
"variant": 1,
"configs": [{
"apiTarget": "/content/landingpage/MEDICARE/",
"replacements": {
"data": {
jherax / get-headers.ts
Last active Apr 19, 2021
Gets all Response Headers for the current document
View get-headers.ts
* Gets all Reponse Headers for the current document.
* @returns An object cointaining the key-value pairs for each header
function getHeaders(url = document.location.href) {
const req = new XMLHttpRequest();"GET", url, false);
let key: string;
jherax /
Created Jun 15, 2020 — forked from paulirish/
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 / Git commit editior
Created Mar 20, 2019 — forked from S3ak/Git commit editior
How to set git commit editor to sublime
View Git commit editior
Method 1
git config --global core.editor "'c:/program files/sublime text 3/sublime_text.exe' -w"
Method 2
git config --global core.editor "subl -n -w"
Method 3
$ echo 'alias subl="/cygdrive/c/Program\ Files/Sublime\ Text\ 3/sublime_text.exe"' >> ~/.bashrc
jherax / App.js
Created Feb 18, 2019 — forked from koistya/App.js
How to add `onscroll` event in ReactJS component
View App.js
import React from 'react';
let lastScrollY = 0;
let ticking = false;
class App extends React.Component {
componentDidMount() {
window.addEventListener('scroll', this.handleScroll);
jherax /
Last active Oct 12, 2021
Debugging with VS Code

VS Code: Debugging

The way we usually debug JavaScript code, is through a web browser and typing the keyword debugger or console.log in our files, but switching between browser and VS Code can be annoying, and we also lose synchronization with the source code.

VS Code provides the extension Debugger for Chrome which enables you to edit, debug, and set breakpoints to your JavaScript

jherax /
Last active Oct 6, 2022
VS Code: Debugging with Jest

VS Code: Debugging Jest

Sometimes, debugging with console.log is not enough to find out what is happening in the code, as console.log prints only plain objects but neither functions nor objects with circular references. Besides, it's possible you may need to know the context and flow of the code.

Read more about debugging with VS Code in VS Code: Debugging.

jherax / index.html
Created Jan 8, 2019
Disable auto-zoom in input elements - For Safari, iPhone
View index.html
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no" />
jherax /
Last active Oct 6, 2022 — forked from bsara/
Setup SSH Authentication for Git Bash on Windows

Setup SSH Authentication for Git Bash on Windows


  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 /
Last active Sep 22, 2022
Git Alias and Rebase

Git Alias and Git Rebase


After each commit in our branch, in order to be up-to-date with the integration branch.