Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Code is poetry

Mikhail Kobzarev mihdan

:octocat:
Code is poetry
View GitHub Profile
@mihdan
mihdan / tsf-custom-image-generator.php
Created March 23, 2023 07:05 — forked from sybrew/tsf-custom-image-generator.php
Example snippet to prepend and append image generators for The SEO Framework.
View tsf-custom-image-generator.php
<?php
// Do not include this PHP opening tag if PHP is already opened...
// Ref: https://theseoframework.com/docs/using-filters/
add_filter( 'the_seo_framework_image_generation_params', 'my_tsf_custom_image_generation_args', 10, 3 );
/**
* Adjusts image generation parameters.
*
* @link https://theseoframework.com/docs/api/filters/#append-image-generators-for-social-images
@mihdan
mihdan / pluralize-ru.js
Created January 18, 2023 13:25 — forked from znechai/pluralize-ru.js
JavaScript - Plural forms for russian words
View pluralize-ru.js
/**
* Plural forms for russian words
* @param {Integer} count quantity for word
* @param {Array} words Array of words. Example: ['депутат', 'депутата', 'депутатов'], ['коментарий', 'коментария', 'комментариев']
* @return {String} Count + plural form for word
*/
function pluralize(count, words) {
var cases = [2, 0, 1, 1, 1, 2];
return count + ' ' + words[ (count % 100 > 4 && count % 100 < 20) ? 2 : cases[ Math.min(count % 10, 5)] ];
}
View gutenberg-set-default-nav-type.php
<?php
add_action(
'enqueue_block_editor_assets',
function() {
wp_register_script(
'mihdan-editor-js',
get_theme_file_uri( 'js/editor.js' ),
[ 'wp-blocks' ],
filemtime( get_theme_file_path( 'js/editor.js' ) ),
true
@mihdan
mihdan / README-WordPress-FULLTEXT-Search.md
Created March 24, 2022 16:55 — forked from jesgs/README-WordPress-FULLTEXT-Search.md
WordPress Full Text Search Examples
View README-WordPress-FULLTEXT-Search.md

Adding MySQL FULLTEXT Support to WordPress

FULLTEXT support to WordPress is simple if you have access to phpMyAdmin. If not, it can still be done but is a little trickier if you’re not used to command-line. We’ll demonstrate how to modify your WordPress database using phpMyAdmin.

How To Modify Database

  1. Start out by having a set of keywords to test against. You’ll need ‘before’ and ‘after’ test results. Also, I can’t stress this enough but back up your database before proceeding!

  2. Next, log into your phpMyAdmin page and navigate to your {prefix}_posts table.

  3. Click on the “Structure” tab.

@mihdan
mihdan / grammarly.sh
Created December 22, 2021 15:24
Script install Grammarly for Linux via PlayOnlinux
View grammarly.sh
#!/usr/bin/env playonlinux-bash
# Date : (2021-04-05 04-20)
# Last revision : (2021-04-05 06-09)
# Wine version used : 6.3 staging
# Distribution used to test : Ubuntu 20.04 LTS
# Author : tiagovla
# PlayOnLinux : 4.3.4
# Script licence : MIT
[ "$PLAYONLINUX" = "" ] && exit 0
@mihdan
mihdan / fish_install.md
Created December 1, 2021 15:33 — forked from gagarine/fish_install.md
Install fish shell on macOS Mojave with brew
View fish_install.md

Installing Fish shell on MacOS (Intel and M1)

Fish is a smart and user-friendly command line (like bash or zsh). This is how you can instal Fish on MacOS and make your defaul shell.

Note that you need the https://brew.sh/ package manager.

You can also download the fish app from their website. I do recomand using brew because update are easier.

Install Fish

View defaults-2.php
<?php
function tlap_plugin_default_values(){
$defaults = array(
'tlap_add_analytics_option' => array(
'tlap_excludepage' => '',
'tlap_timer_delay' => '5000',
),
'tlap_add_analytics_option_counters' => array(
@mihdan
mihdan / DNS Prefetch domains
Last active August 20, 2021 18:16 — forked from lukecav/DNS Prefetch domains
WP Rocket - Advanced Options Prefetch DNS requests examples
View DNS Prefetch domains
//maps.googleapis.com
//maps.gstatic.com
//fonts.googleapis.com
//fonts.gstatic.com
//ajax.googleapis.com
//apis.google.com
//google-analytics.com
//www.google-analytics.com
//ssl.google-analytics.com
//youtube.com
View wpseo-pagination-canonical.php
<?php
function return_canon () {
$canon_page = get_pagenum_link( 1 );
return $canon_page;
}
function canon_paged() {
if ( is_paged() ) {
add_filter( 'wpseo_canonical', 'return_canon' );
}
View wpseo-remove-prev-next-links.php