Skip to content

Instantly share code, notes, and snippets.

Shokodin

Block or report user

Report or block Shokodin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Shokodin
Shokodin / measure_lead_time.php
Created Jan 15, 2020
Measure lead time for script's on PHP
View measure_lead_time.php
<?php
// time to do
$toDo = 1000000;
// create text
$string = '';
for ($i = 0; $i < 10000; $i++) {
$string .= 'Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, aspernatur aut odit aut fugit, sed quia consequuntur gaing magni dolores eos, qui ratione voluptatem sequi nesciunt, neque porro quisquam est, qui dolorem ipsum, quia dolor sit, amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt, ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla pariatur? At vero eos et accusamu
@Shokodin
Shokodin / Yandex_Metrika_reach_goal_on_jQuery.js
Created Dec 13, 2019
Yandex Metrika. Reach goal on jQuery
View Yandex_Metrika_reach_goal_on_jQuery.js
jQuery( document ).ready( function() {
jQuery( document )
.on('click', '#id', function() {
ym(55311013, 'reachGoal', 'name_goal');
return true;
});
});
View noindex_in_wp.html
<meta name="robots" content="noindex, nofollow" />
@Shokodin
Shokodin / add_noindex_1.php
Last active Jul 22, 2019
add_noindex_in_wp_part_1.php
View add_noindex_1.php
<?php
/** закрываем страничку от поисковиков - индексации **/
function my_meta_robots () {
// закрываем выборочно страницу
if (is_page(28))// 28 id записи
{
echo "".'<meta name="robots" content="noindex,nofollow" />'."\n";
}
}
add_action('wp_head', 'my_meta_robots');
@Shokodin
Shokodin / add_noindex_2.php
Last active Jul 22, 2019
add_noindex_in_wp_part_2.php
View add_noindex_2.php
<?php
/*** ЗАКРЫВАЕМ СТРАНИЦЫ ***/
function echo_meta_mih_head() {
$echo = false;
$uri = $_SERVER['REQUEST_URI'];
if (mb_strstr($uri, 'ссылка в формате /razdel_name')) $echo = true;
if (mb_strstr($uri, 'ссылка в формате /razdel_name')) $echo = true;
if (mb_strstr($uri, 'ссылка в формате /razdel_name')) $echo = true;
if ($echo) echo '<meta name="robots" content="noindex,nofollow" />';
}
@Shokodin
Shokodin / lazyload.js
Last active Jul 18, 2019
Отложенная загрузка скриптов на JavaScript.
View lazyload.js
function downloadJSAtOnload() {
var element = document.createElement("script");
element.src = "путь до вашего скрипта";
document.body.appendChild(element);
}
if (window.addEventListener)
window.addEventListener("load", downloadJSAtOnload, false);
else if (window.attachEvent)
window.attachEvent("onload", downloadJSAtOnload);
else window.onload = downloadJSAtOnload;
View opengraph.html
<!DOCTYPE HTML>
<html prefix="og: http://ogp.me/ns#">
<head>
<title>[[*title]]</title>
<meta charset="utf-8" />
<base href="[[++site_url]]" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="[[*description]]" />
<meta name="keywords" content="[[*keywords]]" />
You can’t perform that action at this time.