Skip to content

Instantly share code, notes, and snippets.

@alukos
alukos / tokens.md
Created July 26, 2021 14:37 — 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

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@alukos
alukos / organizations.gql
Last active July 27, 2020 12:57
Ex. vuetify + apollo
query Organizations ($where: organizations_bool_exp){
organizations (where: $where, order_by: {id: asc}) {
id
name
phones_organizations (order_by: {phone_id:desc}) {
id
phone {
id
value
}
@alukos
alukos / cloudSettings
Last active December 26, 2018 09:40
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-12-26T09:40:36.652Z","extensionVersion":"v3.2.4"}
@alukos
alukos / pages.js
Created August 20, 2018 07:30
LE store/pages.js:movePage
movePage({ getters, commit }, { name, pageNum, direction }) {
return new Promise(async (resolve, reject) => {
try {
if (pageNum == 1 && direction == 'left') {
reject('Error cant move first page to the left');
}
const totalPages = getters.pageCount(name);
if (pageNum >= totalPages && direction == 'right') {
reject('Error cant move last page to the right');
}
@alukos
alukos / align.css
Last active June 13, 2018 15:10
css-grid
.container {
// one line
/*
auto
normal
start
end
center
stretch
baseline
@alukos
alukos / observer.js
Created February 20, 2018 08:04
Observer (restore transcript in youtube)
var button = document.querySelectorAll('ytd-menu-service-item-renderer')[1];
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.type == "attributes") {
console.log("attributes changed");
button.click();
}
});
});
observer.observe(document.getElementById('transcript-loader'), {
<img id="imgZoom" width="300px" height="200px" onmousemove="zoomIn(event)" onmouseout="zoomOut()" src="http://ginger-mum.com/wp-content/uploads/2015/10/3633-1269758855-0da5042c33400a811a5d766be4579cb8.jpg">
<div id="overlay" onmousemove="zoomIn(event)"></div>
@alukos
alukos / 0_reuse_code.js
Created October 19, 2016 10:50
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
/*
* Copyright (c) 2010 Tobias Schneider
* This script is freely distributable under the terms of the MIT license.
*/
(function(){
var UPC_SET = {
"3211": '0',
"2221": '1',
"2122": '2',