Skip to content

Instantly share code, notes, and snippets.

View taraskhvyl's full-sized avatar
🇺🇦

Taras Khvyl taraskhvyl

🇺🇦
View GitHub Profile
function rr_404_my_event() {
global $wp_query;
if(isset($wp_query->query["product_cat"])) {
$cate = get_queried_object();
$cateID = $cate->term_id;
if("https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" !=str_replace("./","",get_category_link( $cateID ))){
global $wp_query;
$wp_query->set_404();
@taraskhvyl
taraskhvyl / svg-to-css-clip-path-polygon.js
Created August 9, 2018 17:30 — forked from lostfictions/svg-to-css-clip-path-polygon.js
convert an svg to a css clip-path polygon
// why do this? clip-path accepts a `url` reference to an svg element, right?
// the difference is that anything defined as a `basic-shape` can be animated:
// https://developer.mozilla.org/en-US/docs/Web/CSS/clip-path
const input = `121.151,20.761 170.165,55.885 200.872,3.816 231.145,55.884 280.592,20.762 286.854,80.687 346.526,68.666
327.657,126.005 387.276,139.247 346.502,184 395.796,220.302 340.127,244.647 370.611,297.814 309.636,297.457 316.076,358.381
260.303,333.3 241.622,391.529 200.655,345.979 160.121,391.53 141.008,333.302 85.666,358.381 91.673,297.456 31.131,297.813
61.183,244.647 5.947,220.302 54.81,184 14.466,139.248 73.652,126.004 55.216,68.667 114.457,80.688 `
const viewBoxScale = 4
@taraskhvyl
taraskhvyl / main.js
Last active July 20, 2018 11:41
responsive iframe with jquery
$(document).ready(() => {
$('.content iframe').wrap('<div class="iframe__wrapper"></div>')
});
if ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
$("select").select2('destroy');
}
@taraskhvyl
taraskhvyl / gist:ab45f92c824f8c6cfecf
Created November 29, 2015 16:59
hide text in url
.hide-text {
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
}
.clearfix:after {
visibility: hidden;
display: block;
content: "";
clear: both;
height: 0;
}
var start = $(".parMak").offset().top - $(window).height() + $(".parMak").height();
var stop = $(".parMak").offset().top + $(".parMak").height() - $(window).height() / 2;
var lastScrollTop = 0;
function parall(){
var st = $(window).scrollTop();
if ($(document).scrollTop() >= start && $(document).scrollTop() <= stop) {
if (st > lastScrollTop){
var min = st - lastScrollTop;