Skip to content

Instantly share code, notes, and snippets.

View Krabaton's full-sized avatar
:dependabot:
Working

Yuriy Kuchma Krabaton

:dependabot:
Working
View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active July 25, 2024 04:47
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.
@zmts
zmts / tokens.md
Last active July 25, 2024 07:03
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

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

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@mjackson
mjackson / fetchJSON.js
Created February 23, 2016 22:23
fetch JSON with a callback
function fetchJSON(url, options, callback) {
if (typeof options === 'function') {
callback = options
options = {}
}
options = options || {}
const headers = (options.headers || (options.headers = {}))
headers.Accept = 'application/json'
@inirudebwoy
inirudebwoy / 0001_createsuperuser.py
Created March 13, 2015 12:18
Django 1.7+ migration for creating superuser
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django.contrib.auth.admin import User
def create_superuser(apps, schema_editor):
superuser = User()
superuser.is_active = True