Skip to content

Instantly share code, notes, and snippets.

View ExileofAranei's full-sized avatar

Denis Mamaev ExileofAranei

View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active April 26, 2024 03:53
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@s2ar
s2ar / .htaccess_slash
Created July 28, 2016 12:21
Убрать слеши в htaccess
#Правило обрабатывает внутренние страницы
# http://site.ru/catalog////item///
RewriteCond %{REQUEST_URI} ^(.*)/{2,}(.*)$
#Проверяем, повторяется ли слеш (//) более двух раз.
RewriteRule . %1/%2 [R=301,L]
#Исключаем все лишние слеши.
#удаляем слеши для главной http://site.ru/////
RewriteCond %{THE_REQUEST} ([^\s]*)\/{2,}(\?[^\s]*)?
RewriteRule (.*) / [R=301,L]
@paulirish
paulirish / what-forces-layout.md
Last active April 26, 2024 05:24
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