Skip to content

Instantly share code, notes, and snippets.

View muks999's full-sized avatar

Muks999 muks999

View GitHub Profile
@muks999
muks999 / metrika.js
Created October 9, 2018 12:55 — forked from artikus11/metrika.js
Подключение целей из метрики в теме Divi на просто кнопку, кнопку в призыве и кнопку в слайдере
XXXXXXX - номер счетчика
TARGET_NAME - идентификатор цели
<script>
jQuery(document).ready(function ($) {
$('#buy').click(function () {
yaCounterXXXXXXX.reachGoal('TARGET_NAME ');
console.log('цель 1');
});
@muks999
muks999 / functions.php
Created October 9, 2018 12:54 — forked from artikus11/functions.php
Функция подстановики названия соцсетей в зависимости от сслыки на профиль
function art_social_icons($item_url) {
$social_icons = apply_filters( 'art_social_icons', array(
'codepen.io' => 'codepen',
'digg.com' => 'digg',
'dribbble.com' => 'dribbble',
'dropbox.com' => 'dropbox',
'facebook.com' => 'facebook',
'flickr.com' => 'flickr',
'foursquare.com' => 'foursquare',
@muks999
muks999 / .htaccess
Created October 9, 2018 12:52 — forked from artikus11/.htaccess
Редирект с http На https
#Вариант 1
RewriteCond %{HTTP:X-HTTPS} !1
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
#Вариант 2
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
@muks999
muks999 / wrapURLs.js
Created July 9, 2018 08:05 — forked from ryasmi/wrapURLs.js
Wraps all URLs in anchor tags with a `href` and `target` inside some given text.
var wrapURLs = function (text, new_window) {
var url_pattern = /(?:(?:https?|ftp):\/\/)?(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\x{00a1}\-\x{ffff}0-9]+-?)*[a-z\x{00a1}\-\x{ffff}0-9]+)(?:\.(?:[a-z\x{00a1}\-\x{ffff}0-9]+-?)*[a-z\x{00a1}\-\x{ffff}0-9]+)*(?:\.(?:[a-z\x{00a1}\-\x{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?/ig;
var target = (new_window === true || new_window == null) ? '_blank' : '';
return text.replace(url_pattern, function (url) {
var protocol_pattern = /^(?:(?:https?|ftp):\/\/)/i;
var href = protocol_pattern.test(url) ? url : 'http://' + url;
return '<a href="' + href + '" target="' + target + '">' + url + '</a>';
});
};
@muks999
muks999 / mvvm.html
Created June 14, 2018 05:41 — forked from smelukov/mvvm.html
Very simple MVVM (dynamic data binding) on JS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<h1>MVVM</h1>
@muks999
muks999 / Simple tabs Jquery
Last active June 14, 2018 00:56
Tabs Jquery
$('.tabs-list li').click(function() {
var tabName = $(this).attr('show-tab');
$(this).addClass('active').siblings().removeClass('active');
$('.tabs-content .' + tabName).addClass('active').siblings().removeClass('active');
});
@muks999
muks999 / Radio custom
Created June 14, 2018 00:52
Radio custom
label.radio
span.radio__text name
input(type="radio")
span.checkbox__custom
.radio {
display: block;
position: relative;
width: 100%;
@muks999
muks999 / Sandwich
Created June 14, 2018 00:52
Sandwich
.sandwich
.sandwich__line.sandwich__line--top
.sandwich__line.sandwich__line--middle
.sandwich__line.sandwich__line--bottom
.sandwich {
cursor: pointer;
display: none;
height: 20px;
position: relative;
@muks999
muks999 / stylus mixins
Created June 14, 2018 00:51
stylus mixins
absolute-center()
position absolute
top 50%
left 50%
transform translate(-50%,-50%)
absolute-all(num)
position absolute
top num
bottom num
@muks999
muks999 / Fix Header
Created June 14, 2018 00:50
Fix Header
function headerScroll() {
if ($(window).scrollTop() > 150) {
$('header').addClass('slicky');
} else {
$('header').removeClass('slicky');
}
}
headerScroll();