Skip to content

Instantly share code, notes, and snippets.

View abstractalgo's full-sized avatar

Dragan Okanovic abstractalgo

View GitHub Profile
@stevemu
stevemu / config-overrides.js
Last active May 5, 2022 14:39
react-app-rewired config-overrides.js for referencing folders in adjacent folder https://github.com/facebook/create-react-app/issues/9127
const { override, addWebpackAlias } = require('customize-cra');
const path = require('path');
const overridePath = (webpackConfig) => {
const oneOfRule = webpackConfig.module.rules.find((rule) => rule.oneOf);
if (oneOfRule) {
const tsxRule = oneOfRule.oneOf.find(
(rule) => rule.test && rule.test.toString().includes('tsx')
);
class NodeUtils {
static path(node) {
let tests = []
// if the chain contains a non-(element|text) node type, we can go no further
for (;
node && (node.nodeType === Node.ELEMENT_NODE || node.nodeType === Node.TEXT_NODE);
@xameeramir
xameeramir / default nginx configuration file
Last active November 17, 2024 15:13
The default nginx configuration file inside /etc/nginx/sites-available/default
# Author: Zameer Ansari
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
@paulirish
paulirish / what-forces-layout.md
Last active November 19, 2024 08:58
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