Skip to content

Instantly share code, notes, and snippets.

View anti-pode's full-sized avatar
🎯
Focusing

Timofey Solomennikov anti-pode

🎯
Focusing
View GitHub Profile
> * {
-webkit-column-break-inside: avoid; /* stylelint-disable-line property-no-vendor-prefix */
page-break-inside: avoid;
break-inside: avoid;
}
arr.sort( (a, b) => a - b );
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');
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));
}
function isInteger(x) { return (x ^ 0) === x; }
@anti-pode
anti-pode / gist:cde2ba6d56f9c8b703f1036f904f3dab
Created August 13, 2019 05:50 — forked from realmyst/gist:1262561
Склонение числительных в javascript
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, ['найдена', 'найдено', 'найдены']);
var menu = $(".menu");
var hight = $(window).height();
$(window).scroll(function() {
var top = $(this).scrollTop();
if ( top <= hight - 150) {
}
});
$('a[href^="#"]').on('click', (e) => {
const el = $(e.target).attr('href');
$('html, body').animate({
scrollTop: $(el).offset().top,
}, 500);
e.preventDefault();
});
@anti-pode
anti-pode / button.sass
Created February 19, 2019 12:32 — forked from agragregra/button.sass
Button Sass Styles (Universal Starter)
.button
display: inline-block
border: none
color: #fff
text-decoration: none
background-color: $accent
padding: 15px 45px
font-size: 13px
text-transform: uppercase
font-weight: 600