Skip to content

Instantly share code, notes, and snippets.

View script
$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
Window history back.
View script
<script>setTimeout(function(){history.back(1);},5000);</script>
@SashaKolbasov
SashaKolbasov / index.html
Last active Oct 24, 2017
Custom + / - Input field
View index.html
<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
Own WordPress hooks
View hooks.php
// 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 Jan 6, 2019
Pause YouTube video
View index.html
<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
Sort Array by field
View php.php
<?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
Insert String without whitespaces
View php.php
<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 Mar 27, 2017
Upload Photo/File
View index.html
<label class="attach attachInput">
<span>Загрузите ваше фото</span>
<input type="file" name="photo" class="photo" accept="image/*" required />
</label>
@SashaKolbasov
SashaKolbasov / index.html
Last active Mar 27, 2017
Fixing Header inside the page
View index.html
<div id="header" class="header">
<div id="headerWrap" class="header__wrap">
</div>
</div>
@SashaKolbasov
SashaKolbasov / index.html
Last active Jul 19, 2017
Yandex Placemark
View index.html
<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() {
You can’t perform that action at this time.