Skip to content

Instantly share code, notes, and snippets.

View mihdan's full-sized avatar
:octocat:
Code is poetry

Mikhail Kobzarev mihdan

:octocat:
Code is poetry
View GitHub Profile
@mihdan
mihdan / migrate_repo.sh
Created July 6, 2021 16:41 — forked from mariozig/migrate_repo.sh
Migrate repo from GitLab to GitHub Full blog post @ http://ruby.zigzo.com/2015/03/23/moving-from-gitlab-to-github/
# Assume we are in your home directory
cd ~/
# Clone the repo from GitLab using the `--mirror` option
$ git clone --mirror git@your-gitlab-site.com:mario/my-repo.git
# Change into newly created repo directory
$ cd ~/my-repo.git
# Push to GitHub using the `--mirror` option. The `--no-verify` option skips any hooks.
@mihdan
mihdan / 0fixup.md
Created May 14, 2021 11:19 — forked from silent1mezzo/0fixup.md
On undoing, fixing, or removing commits in git

A git choose-your-own-adventure!

This document is an attempt to be a fairly comprehensive guide to recovering from what you did not mean to do when using git. It isn't that git is so complicated that you need a large document to take care or your particular problem, it is more that the set of things that you might have done is so large that different techniques are needed depending on exactly what you have done and what you want to have happen.

@mihdan
mihdan / fix-authors-bug-5.7.php
Created March 22, 2021 08:41 — forked from kagg-design/fix-authors-bug-5.7.php
MU-Plugin to temporary fix the problem with the list of authors on post edit page with Block Editor.
<?php
/**
* MU-Plugin to temporary fix the problem with the list of authors on post edit page with Block Editor.
* With WP 5.7, user with the Editor role is unable to search across long list of authors in Author combobox.
*
* @package kagg-design
*/
/**
* Fixes bug in WP 5.7 with author selection on post edit in admin.
@mihdan
mihdan / wp-searchwp-wpallimport-customizations.php
Last active March 3, 2021 14:12 — forked from jchristopher/searchwp-customizations.php
How to Integrate SearchWP with Wp All Import
<?php
/**
* WP All Import SearchWP PRE-import routine
*
* @link https://searchwp.com/documentation/knowledge-base/content-imports/
*/
add_action( 'pmxi_before_xml_import', function( $import_id ) {
\SearchWP::$indexer->pause();
@mihdan
mihdan / elementor-default-editor.php
Created February 27, 2021 16:34 — forked from wppunk/elementor-default-editor.php
Make the Elementor as default editor
<?php
/**
* Make the Elementor as default editor.
*
* @since 1.0.0
* @author wppunk
* @link https://github.com/wppunk/
*/
namespace wppunk\Elementor;
@mihdan
mihdan / bypass-elementors-maintenance-mode.php
Created February 3, 2021 09:42 — forked from mishterk/bypass-elementors-maintenance-mode.php
Using this snippet, you can bypass Elementor's maintenance mode by adding ?bypass_maintenance=1 to the query string
<?php
add_filter( 'pre_option_elementor_maintenance_mode_mode', function ( $option ) {
$parameter = 'bypass_maintenance'; // change this to whatever you like
if ( isset( $_GET['bypass_maintenance'] ) and $_GET['bypass_maintenance'] ) {
return 0; // needs to be falsy but not FALSE
}
<?php
register_activation_hook( __FILE__, 'tlap_default_options' );
function tlap_default_options() {
$defaults = array(
'tlap_add_analytics_option' =>
array(
'tlap_yametrika_id' => '',
'tlap_yametrika_webvisor' => '0',
<?php
/*
Plugin Name: Enable/Disable plugins when doing local dev
Plugin URL: https://gist.github.com/pbiron/52bb63042cf220256ece89bc07fb57b0
Description: If the WP_LOCAL_DEV constant is true, enables/disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Paul V. Biron/Sparrow Hawk Computing
Author URI: https://sparrowhawkcomputing.com
*/
<?php
## Заполняем опцию 3
function fill_tlap_field_exlude_page() {
$val = get_option('tlap_add_analytics_option');
$val = $val ? $val['tlap_excludepage'] : null;
?>
<span><input size="80" type="text" name="tlap_add_analytics_option[tlap_excludepage]" value="<?php echo esc_attr($val) ?>" placeholder="Введите id страниц через запятую"/>&#9;<span class="pro">PRO</span></span>
<div> Страницы, на которых не нужно загружать коды счётчиков статистики (например страницы закрытые от индексации).</div>
<div> Ввести ID страниц через запятую без пробела, например: 345,1145,3778 </div>
<?php
@mihdan
mihdan / scripts-lazy-load.html
Last active August 21, 2022 08:06 — forked from artikus11/gist:5c2706a1d452d614b6111a31da7668ef
Подключение скриптов с отложенной загрузкой
<!-- Див в котором будет отображаться виджет -->
<div id="vk_community_messages"></div>
<script type="text/javascript">
// откладываем по времени
setTimeout(function(){
// создаем элемент script и добавляем его асинхронно в DOM
var VKO = document.createElement("script");
VKO.src = 'https://vk.com/js/api/openapi.js';
VKO.async = true;