Skip to content

Instantly share code, notes, and snippets.

View Semigradsky's full-sized avatar
😉

Dmitry Semigradsky Semigradsky

😉
View GitHub Profile
@remy90
remy90 / TemporalDateAdapter.txt
Last active March 27, 2024 15:11
WIP: Temporal date adapter implementation of MuiPickersAdapter<TDate>
import { DateIOFormats, Unit } from '@date-io/core/IUtils';
import { MuiPickersAdapter } from '@mui/lab';
import { Temporal, Intl } from '@js-temporal/polyfill';
interface Opts {
locale?: string;
formats?: Partial<DateIOFormats>;
}
@Jaid
Jaid / migratingRules.md
Last active February 21, 2024 10:48
ESLint rules for migrating projects from CommonJS to ESM

ESLint rules

The ESM standard is considered stable in NodeJS and well supported by a lot of modern JavaScript tools.

ESLint does a good job validating and fixing ESM code (as long as you don't use top-level await, coming in ESLint v8). Make sure to enable the latest ECMA features in the ESLint config.

  • .eslint.json
{
@sindresorhus
sindresorhus / esm-package.md
Last active May 24, 2024 02:36
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.
@sibelius
sibelius / useTransition.tsx
Created April 27, 2020 18:48
useTransition polyfill
import { unstable_withSuspenseConfig, useState, useCallback } from 'react'
// based on https://github.com/facebook/relay/commit/1befdc085bceef5c78f8eb8c2117459ce4b9d7c7#diff-c8dcd2c1e7d048e3b69a8538434cbca4
function useSuspenseTransition(config: {|timeoutMs: number|}) {
const [isPending, setPending] = useState(false);
const startTransition = useCallback(
(callback: () => void) => {
setPending(true);
Scheduler.unstable_next(() => {

Конкурс "Вопрос для JavaScript Developer Day 31-MAY-2019"

Задание:

  1. Прочитать статью - https://medium.com/@dzmitry.varabei/celebrating-javascript-developer-day-ab9b26059b59 Аплодисменты приветствуются 👏 👏 👏
  2. Просмотреть вопросы и ответы прошлогоднего квиза #jsdevday2018, чтобы избежать повторений - https://docs.google.com/presentation/d/1V5qbCJBQVlpZ-efRRsRNtlNgLZC9o7xRCoE4t09Ziso/edit
  3. Придумать свой вопрос. Требования:
    • любой по формату (код, текст, картинка, аудио, видео и т.д.)
    • вопрос может занимать 1 или 2 слайда.
    • на обсуждение вопроса у участников квиза будет 1 минута
  4. Отправить вопрос в форму - https://docs.google.com/forms/d/e/1FAIpQLScrKoh78aOHUnrPoMgTYeSXWxchezLTVVpMxiTytB18ocIQBw/viewform
@jakub-g
jakub-g / double-fetch-triple-fetch.md
Last active April 13, 2024 12:22
Will it double-fetch? Browser behavior with `module` / `nomodule` scripts
@askd
askd / checklist.md
Created July 3, 2018 10:43
Чеклист спикера

Общее

  1. Представься: краткая информация о себе – имя, место работы, чем занимаешься, можно фото для тех, кто будет смотреть слайды отдельно
  2. План доклада: несколько пунктов (лучше не более 5) о чём будет доклад. Это могут быть главы доклада (кстати, составление плана может помочь грамотнее структурировать доклад ещё при создании)
  3. Зачем: кратко рассказать, чем то, о чем рассказываешь в докладе, может быть полезно остальным – и разработчикам, и руководителям, и клиентам (можно акцентироваться на аудитории конкретной конфы – например если там есть дизайнеры, бэкенды, то упомянуть, что они могут узнать из доклада)
  4. Итоги: в конце доклада ещё раз пройтись по плану и подвести итог по каждому пункту – что узнали, чему научились
  5. Контакты: как слушатель и тот кто смотрит слайды может связаться и задать вопрос

Оформление

@zmts
zmts / tokens.md
Last active May 24, 2024 18:51
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов

Minimum Viable Async with Node 6

With the release of Node 6.0.0, the surface of code that needs transpilation to use ES6 features has been reduced very dramatically.

This is what my current workflow looks like to set up a minimalistic and fast microservice using micro and async + await.

The promise

@paulirish
paulirish / what-forces-layout.md
Last active May 24, 2024 19:16
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