This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set nocompatible " be iMproved, required | |
| filetype off " required | |
| " set the runtime path to include Vundle and initialize | |
| set rtp+=~/.vim/bundle/Vundle.vim | |
| call vundle#begin() | |
| " alternatively, pass a path where Vundle should install plugins | |
| "call vundle#begin('~/some/path/here') | |
| " let Vundle manage Vundle, required |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // сложение в столбик | |
| function convertNumber(num) { | |
| return num | |
| .toString() | |
| .split('') | |
| .map(n => Number(n)); | |
| } | |
| function normalizeArrays(...arrays) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default function debounceIfValid( | |
| fn = () => {}, | |
| TIME = 1000, | |
| FREQUENCY = 100, | |
| ) { | |
| let localTime = TIME; | |
| let interval = null; | |
| return { | |
| start(condition) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // piece of vue.js code | |
| // Возвращает промис по окончанию скролла, убирает с себя event listener | |
| scrollToItem(refName) { | |
| return new Promise((resolve) => { | |
| const debouncedScrollEnd = _.debounce(function() { | |
| this.removeEventListener('scroll', debouncedScrollEnd); | |
| resolve(); | |
| }, 200); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Создаёт инстанс класса QueuedCall, | |
| * у которого есть метод push. | |
| * | |
| * Первый пуш запускает обратный таймер, | |
| * каждый последующий обнуляет его. | |
| * Когда таймер сработает, то вызовутся все ф-и из очереди. | |
| */ | |
| function QueuedCall(DELAY = 1000, TIMESTEP = 250) { | |
| const queue = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <div class="wrapper"> | |
| <input type="checkbox" id="checkbox"> | |
| <div class="checkbox" /> | |
| <label for="checkbox">checkbox</label> | |
| </div> | |
| </template> | |
| <style scoped> | |
| .wrapper { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // запуск функции с задержкой | |
| async delayExecute(fn, duration = 0) { | |
| return new Promise( | |
| resolve => setTimeout( | |
| () => resolve(fn()), | |
| duration, | |
| ), | |
| ); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const throtthe = () => { | |
| let timeout = null; | |
| return (fn, TIME) => { | |
| if (!timeout) { | |
| fn(); | |
| timeout = setTimeout( | |
| () => { | |
| clearTimeout(timeout); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // подставляет в inline-styles значение высоты, | |
| // которое можно использовать для анимации высоты с динамическим контентом | |
| let isCollapsed = true; | |
| type Params = { | |
| from: string; | |
| to: string; | |
| }; |
OlderNewer