Skip to content

Instantly share code, notes, and snippets.

@Shumaher
Shumaher / shortcuts.xml
Created June 12, 2022 15:07
Notepad++ macro: switch editor to next tab. Visit https://blog.alexz.me/npp-macro (in Russian).
<?xml version="1.0" encoding="UTF-8" ?>
<NotepadPlus>
<Macros>
<Macro name="Switch to next tab" Ctrl="no" Alt="no" Shift="no" Key="0">
<Action type="0" message="2422" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2325" wParam="0" lParam="0" sParam="" />
<Action type="2" message="0" wParam="50004" lParam="0" sParam="" />
</Macro>
</Macros>
</NotepadPlus>
@Shumaher
Shumaher / shortcuts.xml
Last active August 16, 2020 16:09
Notepad++ macros: convert playlists to text. Visit https://blog.alexz.me/spotify-import for more info (in Russian)
<NotepadPlus>
<Macros>
<Macro name="VKontakte audios to text" Ctrl="no" Alt="no" Shift="no" Key="0">
<Action type="2" message="0" wParam="42055" lParam="0" sParam="" />
<Action type="0" message="2451" wParam="0" lParam="0" sParam="" />
<Action type="1" message="2170" wParam="0" lParam="0" sParam=" " />
<Action type="1" message="2170" wParam="0" lParam="0" sParam="-" />
<Action type="1" message="2170" wParam="0" lParam="0" sParam=" " />
<Action type="0" message="2180" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2300" wParam="0" lParam="0" sParam="" />
@Shumaher
Shumaher / .htaccess
Last active February 1, 2020 14:18
mod_rewrite redirects for SEO, see http://blog.alexz.me/seo-redirects for more info
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# https:
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R=301,L]
# /? to /
RewriteCond %{THE_REQUEST} ^[^\s]+\s+[^?]*?\?
@Shumaher
Shumaher / functions.php
Last active October 30, 2017 08:34
Some optimizations for WordPress, see http://blog.alexz.me/wp-opengraph for more info
<?php
function disable_emojis() {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' );
@Shumaher
Shumaher / header.php
Last active April 24, 2018 14:42
Open Graph tags for WordPress, see http://blog.alexz.me/wp-opengraph for more info
<head>
<?php if (is_single() || is_page()) { ?>
<meta name="description" content="<?php $s = trim(str_replace("\r\n", " ", htmlspecialchars(strip_tags($post->post_content)))); if(mb_strlen($s,'UTF-8') > 200){$postdescr = mb_substr($s,0,198,'UTF-8').' …';} else{$postdescr = $s;}; echo $postdescr; ?>" />
<meta property="og:description" content="<?php echo $postdescr; ?>" />
<meta property="og:url" content="http://site.com/<?php global $post; echo $post->post_name; ?>" /> <!-- OR -->
<meta property="og:url" content="<?php the_permalink() ?>" />
<meta property="og:title" content="Site Name<?php wp_title(); ?>" />
<meta property="og:headline" content="Site Name<?php wp_title(); ?>" />
<?php if (get_post_meta($post->ID, 'image_id', true)){$postimage = wp_get_attachment_image_src(get_post_meta($post->ID, 'image_id', true), 'full'); ?>
<link rel="image_src" href="<?php echo $postimage[0]; ?>" />