Skip to content

Instantly share code, notes, and snippets.

View Maxim-Kolmogorov's full-sized avatar
☺️
I love my job

Maxim Kolmogorov Maxim-Kolmogorov

☺️
I love my job
View GitHub Profile
<!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]]" />
@Maxim-Kolmogorov
Maxim-Kolmogorov / lazyload.js
Last active December 29, 2021 12:50
Отложенная загрузка скриптов на JavaScript.
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;
@Maxim-Kolmogorov
Maxim-Kolmogorov / add_noindex_2.php
Last active July 22, 2019 10:28
add_noindex_in_wp_part_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" />';
}
@Maxim-Kolmogorov
Maxim-Kolmogorov / add_noindex_1.php
Last active July 22, 2019 10:30
add_noindex_in_wp_part_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');
@Maxim-Kolmogorov
Maxim-Kolmogorov / noindex_in_wp.html
Created July 22, 2019 11:26
noindex_in_wp.html
<meta name="robots" content="noindex, nofollow" />
@Maxim-Kolmogorov
Maxim-Kolmogorov / Yandex_Metrika_reach_goal_on_jQuery.js
Created December 13, 2019 06:09
Yandex Metrika. Reach goal on jQuery
jQuery( document ).ready( function() {
jQuery( document )
.on('click', '#id', function() {
ym(55311013, 'reachGoal', 'name_goal');
return true;
});
});
@Maxim-Kolmogorov
Maxim-Kolmogorov / measure_lead_time.php
Created January 15, 2020 09:42
Measure lead time for script's on 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
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Выбор файла</title>
<!-- <link rel="stylesheet" href="/style.css"> -->
<style>
<?php
// Проверяем запрос, если это Drag and Drop в JSON то:
if (stristr($_SERVER["REQUEST_URI"], 'responseType=json') == true) {
$full_path = '';
$upload_dir = '/img'; // Папка, куда будем складировать все картинки и доставать их оттуда с помощью второго скрипта browse.php
// Т.е в рамках моего сайта это будет равно kolmogorov.pro/img.
<script src="https://www.google.com/recaptcha/api.js?render=ВАШ_КЛЮЧ"></script>
<script>
grecaptcha.ready(function() {
grecaptcha.execute('ВАШ_КЛЮЧ', {action: 'homepage'}).then(function(token) {
let json = JSON.stringify({
token: token
});
let xhr = new XMLHttpRequest();
xhr.open('POST', '/functions/recaptcha.php', false);