Skip to content

Instantly share code, notes, and snippets.

View smargelov's full-sized avatar

Sergey Margelov smargelov

View GitHub Profile
@smargelov
smargelov / cards.html
Created September 5, 2022 21:21
Crossed out cards
<section class="wrapper">
<div class="block">
TEXT
</div>
<div class="block block--disable">
TEXT
</div>
.tags-submenu
height: 48px
overflow-x: auto
overflow-y: hidden
scroll-snap-type: x proximity
-webkit-overflow-scrolling: touch
-ms-overflow-style: none
scrollbar-width: none
&::-webkit-scrollbar
width: 0
@smargelov
smargelov / main.js
Created April 26, 2021 11:27
Native JS slideUp
/* SLIDE UP */
const slideUp = (target, duration = 500) => {
target.style.transitionProperty = 'height, margin, padding';
target.style.transitionDuration = duration + 'ms';
target.style.boxSizing = 'border-box';
target.style.height = target.offsetHeight + 'px';
target.offsetHeight;
target.style.overflow = 'hidden';
target.style.height = 0;
@smargelov
smargelov / carousel_nav_trigger.js
Created March 31, 2020 12:35 — forked from ZeRRoCull/carousel_nav_trigger.js
Owl Carousel: переназначаем кнопки по умолчанию
@smargelov
smargelov / example-bem-menu.html
Created March 26, 2020 21:41 — forked from campusboy87/example-bem-menu.html
Преобразует дефолтное меню WordPress в меню на основе методологии БЭМ с помощью только фильтров меню
<ul class="menu menu--main menu--horizontal">
<li class="menu-node menu-node--main_lvl_1 menu-node--active">
<a href="#" class="menu-link menu-link--active">Пункт 1</a>
<ul class="menu menu--dropdown menu--vertical">
<li class="menu-node menu-node--main_lvl_2">
<a href="#" class="menu-link">Подпункт 1.1</a>
</li>
<li class="menu-node menu-node--main_lvl_2">
<a href="#" class="menu-link">Подпункт 1.2</a>
</li>
@smargelov
smargelov / main.js
Last active October 17, 2019 21:20
Изменение текста в зависимости от числительно
function declOfNum(number, titles) {
let 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(price, ['рубль', 'рубля', 'рублей'])
@smargelov
smargelov / mail.php
Created October 14, 2019 11:29
Создание csv из массива
function kama_create_csv_file( $create_data, $file = null, $col_delimiter = ';', $row_delimiter = "\r\n" ){
if( ! is_array($create_data) )
return false;
if( $file && ! is_dir( dirname($file) ) )
return false;
// строка, которая будет записана в csv файл
$CSV_str = '';
@smargelov
smargelov / Breakpoints
Created April 20, 2019 09:58 — forked from janily/Breakpoints
Mobile-first CSS Media Queries Breakpoints
@media (min-width:320px) { /* smartphones, portrait iPhone, portrait 480x320 phones (Android) */ }
@media (min-width:480px) { /* smartphones, Android phones, landscape iPhone */ }
@media (min-width:600px) { /* portrait tablets, portrait iPad, e-readers (Nook/Kindle), landscape 800x480 phones (Android) */ }
@media (min-width:801px) { /* tablet, landscape iPad, lo-res laptops ands desktops */ }
@media (min-width:1025px) { /* big landscape tablets, laptops, and desktops */ }
@media (min-width:1281px) { /* hi-res laptops and desktops */ }
@smargelov
smargelov / woocommece_style_template.php
Last active December 28, 2015 06:29
Перенеся файл woocommerce.css из папки плагина в папку темы и внеся код в functions.php можно менять стили woocommerce не боясь обновлений сайта. Важно не забыть снять галочку «Подключить стили woocommerce» на странице настройки плагина
function woo_style() {
wp_register_style( 'my-woocommerce', get_template_directory_uri() . '/woocommerce.css', null, 1.0, 'screen' );
wp_enqueue_style( 'my-woocommerce' ); } add_action( 'wp_enqueue_scripts', 'woo_style' );
@smargelov
smargelov / 0_reuse_code.js
Created November 13, 2013 21:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console