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
| > * { | |
| -webkit-column-break-inside: avoid; /* stylelint-disable-line property-no-vendor-prefix */ | |
| page-break-inside: avoid; | |
| break-inside: avoid; | |
| } |
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
| arr.sort( (a, b) => a - b ); |
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 traverseAllNodes = (dom, callback) => { | |
| callback(dom); | |
| const list = dom.children; | |
| for(let i = 0; i < list.length; i++) { | |
| traverseAllNodes(list[i], callback) | |
| } | |
| } | |
| const dom = document.querySelector('#app'); |
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 isPolyndrom(str) { | |
| // return str.split('').every((el, i) => el === str[str.length - 1 - i]); | |
| // return str.split('').reverse().join('') === str; | |
| const strLength = str.length; | |
| if (strLength <= 1) return true; | |
| if (str[0] === str[strLength - 1]) { | |
| return isPolyndrom(str.slice(1, -1)); | |
| } |
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 isInteger(x) { return (x ^ 0) === x; } |
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 declOfNum(number, titles) { | |
| cases = [2, 0, 1, 1, 1, 2]; | |
| return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ]; | |
| } | |
| use: | |
| declOfNum(count, ['найдена', 'найдено', 'найдены']); |
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
| var menu = $(".menu"); | |
| var hight = $(window).height(); | |
| $(window).scroll(function() { | |
| var top = $(this).scrollTop(); | |
| if ( top <= hight - 150) { | |
| } | |
| }); |
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
| $('a[href^="#"]').on('click', (e) => { | |
| const el = $(e.target).attr('href'); | |
| $('html, body').animate({ | |
| scrollTop: $(el).offset().top, | |
| }, 500); | |
| e.preventDefault(); | |
| }); |