Skip to content

Instantly share code, notes, and snippets.

View xelinel32's full-sized avatar
🚤

Artem Sedliar xelinel32

🚤
View GitHub Profile
@jessetan
jessetan / secondsToSMPTE.js
Last active April 6, 2023 21:11
Convert seconds to SMPTE timecode JSON object and string
/** Convert seconds to SMPTE timecode JSON object, example input is html video.currentTime */
function secondsToSMPTE(seconds, framerate) {
var f = Math.floor((seconds % 1) * framerate);
var s = Math.floor(seconds);
var m = Math.floor(s / 60);
var h = Math.floor(m / 60);
m = m % 60;
s = s % 60;
return {h: h, m: m, s: s, f: f};
@zmts
zmts / tokens.md
Last active November 16, 2024 12:50
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

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

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@DawidMyslak
DawidMyslak / vue.md
Last active April 22, 2024 12:49
Vue.js and Vuex - best practices for managing your state

Vue.js and Vuex - best practices for managing your state

Modifying state object

Example

If you have to extend an existing object with additional property, always prefer Vue.set() over Object.assign() (or spread operator).

Example below explains implications for different implementations.

@rproenca
rproenca / Clipboard.js
Last active May 28, 2024 08:57
Copy text to clipboard using Javascript. It works on Safari (iOS) and other browsers.
window.Clipboard = (function(window, document, navigator) {
var textArea,
copy;
function isOS() {
return navigator.userAgent.match(/ipad|iphone/i);
}
function createTextArea(text) {
textArea = document.createElement('textArea');
@JamieMason
JamieMason / group-objects-by-property.md
Created September 14, 2018 07:38
Group Array of JavaScript Objects by Key or Property Value

Group Array of JavaScript Objects by Key or Property Value

Implementation

const groupBy = key => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = obj[key];
    objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
    return objectsByKeyValue;
@Sengulair
Sengulair / .eslintrc.cjs
Created February 2, 2024 00:38
Vue 3.4+ lint+prettier+ts+vite starter
module.exports = {
root: true,
env: {
browser: true,
node: true,
},
parser: 'vue-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
sourceType: 'module',