Skip to content

Instantly share code, notes, and snippets.

View SashaKolbasov's full-sized avatar

Alex SashaKolbasov

View GitHub Profile
$expectMarks = array('utm_source','utm_medium','utm_campaign','utm_term','utm_content');$utms = array();foreach($expectMarks as $utm){if(isset($_REQUEST[$utm])){ setcookie($utm,$_REQUEST[$utm],time()+60*60*24*365,"/");}}
@SashaKolbasov
SashaKolbasov / script
Created May 15, 2018 17:24
Window history back.
<script>setTimeout(function(){history.back(1);},5000);</script>
@SashaKolbasov
SashaKolbasov / index.html
Last active October 24, 2017 23:34
Custom + / - Input field
<div class="input input-number">
<button class="minus"></button>
<input type="number" name="" id="" class="" value="1">
<button class="plus">+</button>
</div>
@SashaKolbasov
SashaKolbasov / hooks.php
Last active May 17, 2018 18:18
Own WordPress hooks
// page tags
<?php get_header(); ?>
<?php get_footer(); ?>
<?php bloginfo('template_url'); ?>/
<?php /* Template Name: Index */ ?>
<?php get_template_part('partname'); ?>
<?php get_template_part('template-parts/content-post', get_post_type()); ?>
<?php wp_head(); ?>
<?php wp_footer(); ?>
@SashaKolbasov
SashaKolbasov / index.html
Last active January 6, 2019 16:30
Pause YouTube video
<iframe src="https://www.youtube.com/embed/XXX?enablejsapi=1" frameborder="0" allowfullscreen></iframe>
<iframe src="https://www.youtube.com/embed/fjjkcWP4heM?rel=0&amp;controls=0&amp;showinfo=0&amp;start=5&amp;enablejsapi=1" frameborder="0" allowfullscreen></iframe>
<iframe src="https://www.youtube-nocookie.com/embed/knfrxj0T5NY" frameborder="0" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
@SashaKolbasov
SashaKolbasov / php.php
Created May 3, 2017 16:35
Sort Array by field
<?php
function cmp($a, $b) { return strcmp($a["cat_letter"], $b["cat_letter"]); }
usort($infoCats, "cmp");
?>
@SashaKolbasov
SashaKolbasov / php.php
Last active May 2, 2017 16:53
Insert String without whitespaces
<a href="tel:<?php $phone = get_field('blog_header_phone', 4); echo str_replace(" ", "", $phone); ?>">
<?php echo $phone; ?>
</a>
@SashaKolbasov
SashaKolbasov / index.html
Last active March 27, 2017 16:56
Upload Photo/File
<label class="attach attachInput">
<span>Загрузите ваше фото</span>
<input type="file" name="photo" class="photo" accept="image/*" required />
</label>
@SashaKolbasov
SashaKolbasov / index.html
Last active March 27, 2017 17:02
Fixing Header inside the page
<div id="header" class="header">
<div id="headerWrap" class="header__wrap">
</div>
</div>
@SashaKolbasov
SashaKolbasov / index.html
Last active July 19, 2017 16:45
Yandex Placemark
<script src="https://api-maps.yandex.ru/2.1/?lang=ru_RU" type="text/javascript"></script>
<a class="mapFly" data-flyx="59.9178326" data-flyy="30.3937128">Санкт-петербург</a>
<a class="mapFly" data-flyx="55.755826" data-flyy="37.6173">Москва</a>
<script type="text/javascript">
ymaps.ready(init);
function init() {