Skip to content

Instantly share code, notes, and snippets.

@davidkpiano
davidkpiano / ts-0-60.ts
Last active January 22, 2021 04:55
TypeScript from 0 to 60
// No TypeScript
function add(a, b) {
return a + b;
}
// Type function arguments
// vvvvvv vvvvvv
function add(a: number, b: number) {
return a + b;
}
@subzey
subzey / Debug z-index.js
Created December 25, 2019 13:44
Debug z-index snippet
console.table(
$x('ancestor-or-self::*', $0).reverse().map(el => {
const computedStyle = el.ownerDocument.defaultView.getComputedStyle(el);
return { element: el, 'z-index': computedStyle.zIndex, position: computedStyle.position };
})
);
@virolea
virolea / upload.js
Last active August 28, 2024 02:16
Tracking file upload progress using axios
upload(files) {
const config = {
onUploadProgress: function(progressEvent) {
var percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total)
console.log(percentCompleted)
}
}
let data = new FormData()
data.append('file', files[0])
@zmts
zmts / tokens.md
Last active September 18, 2024 17:08
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

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

Last major update: 25.08.2020

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

System

  1. Set up iCloud Keychain
  2. Remove icons and hide Dock
  3. Default address in iMessage
  4. Install Updates
  5. Add Ru Input Sources
  6. Set up Shortcuts
  7. Add text shortcuts Text