Skip to content

Instantly share code, notes, and snippets.

View renakdup's full-sized avatar
I'm Yoda

Andrei Pisarevskii renakdup

I'm Yoda
View GitHub Profile
@mihdan
mihdan / wp-image-placeholder.php
Last active December 12, 2022 23:59
Заменяет битые ссылки на кратинки в WordPress на заглушки. Удобно, например на тестовом сайте, чтобы не переносить фотки с боевого.
<?php
/**
* Plugin Name: Mihdan: Image Placeholder
*/
namespace Mihdan\Image_Placeholder;
$images = array(
// Обычные
'https://placeimg.com/640/480/animals',
<?php
/**
* Plugin Name: Mihdan: Disable Plugins For REST API
* Description: Отключить все плагины при запросах REST API для увеличения скорости ответов
* Version: 1.0
* Author: Mikhail Kobzarev
* Author URI: https://www.kobzarev.com/
*/
if ( false !== strpos( $_SERVER['REQUEST_URI'], '/wp-json' ) ) {
@GhazanfarMir
GhazanfarMir / Instructions.sh
Last active October 5, 2025 08:00
Install PHP7.2 NGINX and PHP7.2-FPM on Ubuntu 16.04
########## Install NGINX ##############
# Install software-properties-common package to give us add-apt-repository package
sudo apt-get install -y software-properties-common
# Install latest nginx version from community maintained ppa
sudo add-apt-repository ppa:nginx/stable
# Update packages after adding ppa
@roblogic
roblogic / msys2-setup.md
Last active March 5, 2025 01:29
MSYS2 first time setup

MSYS2 is a minimalist linux/unix shell environment for Windows.

Quote: "A modern replacement for MSYS bringing recent versions of the GNU toolchains, Git and other common Unix command line tools to the Windows platform"

1. Install

Do all the steps listed here: http://msys2.github.io/
(troubleshooting guide here: https://github.com/msys2/msys2/wiki/MSYS2-installation )

2. Set up proxies

@taupecat
taupecat / hover-state.scss
Created February 8, 2013 14:47
I'm tired of writing a { &:hover, &:active, &:focus { [blah blah blah] } } all the time in my SCSS. So I wrote a mixin. I can probably make this better. Later.
@mixin hover-state {
&:hover, &:active, &:focus {
@content;
}
}
a {
text-decoration: none;
@include hover-state {
<?php
/**
* In theory should support the following subdir sites as port of a subdomain network:
* - subdomain.example.org/site1
* - subdomain.example.org/site2
*/
function can_i_haz_subdomain_and_subdir() {
global $wpdb, $current_blog, $current_site, $blog_id, $site_id;
// Taken from ms-settings.php