Skip to content

Instantly share code, notes, and snippets.

View YozhEzhi's full-sized avatar

Alexandr Zhidovlenko YozhEzhi

  • Sportmaster Lab
  • Saint-Petersburg, Russia
View GitHub Profile
@YozhEzhi
YozhEzhi / tokens.md
Created April 10, 2024 08:14 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

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

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@YozhEzhi
YozhEzhi / dom-helper.js
Created April 20, 2017 19:38 — forked from SitePointEditors/dom-helper.js
Mini jQuery, sort of.
/**
* A collection of helper prototype for everyday DOM traversal, manipulation,
* and event binding. Sort of a minimalist jQuery, mainly for demonstration
* purposes. MIT @ m3g4p0p
*/
window.$ = (function (undefined) {
/**
* Duration constants
* @type {Object}
@YozhEzhi
YozhEzhi / es6-singleton-module-scoped-instance.js
Last active February 25, 2017 14:53 — forked from dmnsgn/SingletonEnforcer.js
ES6 singleton pattern: constructor returns an instance scoped to the module. Without using the `new` operator.
const singleton = Symbol();
const singletonEnforcer = Symbol();
class Singleton {
constructor(enforcer) {
if (enforcer !== singletonEnforcer) {
throw new Error('Cannot construct singleton');
}
this._type = 'Singleton';
@YozhEzhi
YozhEzhi / es6-singleton-module-scoped-instance.js
Last active September 27, 2019 08:28 — forked from dmnsgn/SingletonModuleScopedInstance.js
ES6 singleton pattern: constructor returns an instance scoped to the module. With using the `new` operator.
let instance;
class Singleton {
constructor() {
if (!instance) {
instance = this;
}
this._type = 'Singleton';
return instance;
@YozhEzhi
YozhEzhi / mediaquery-mixin.less
Last active March 2, 2017 09:53 — forked from vestman/media-queries.less
Less: Mixin for building media queries
// Live example: https://goo.gl/xJblcx
.Q(@breaks; @rules;) {
// If there's only one breakpoint:
& when (length(@breaks) = 1) {
@query: ~"(min-width: @{breaks}px)";
@media screen and @query {@rules();};
}
// If there's two breakpoints:
& when (length(@breaks) = 2) {
@YozhEzhi
YozhEzhi / rename-git-branch.sh
Last active February 20, 2017 13:26 — forked from lttlrck/gist:9628955
Rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote