Skip to content

Instantly share code, notes, and snippets.

View tux255's full-sized avatar

Andrii Haranin tux255

  • Kyiv
  • 00:06 (UTC -12:00)
View GitHub Profile
@tux255
tux255 / disable-emoji-wordpress.php
Created September 30, 2020 12:57 — forked from JeroenSormani/disable-emoji-wordpress.php
Emoji disabling code snippet for WordPress
<?php // For implementation instructions see: https://aceplugins.com/how-to-add-a-code-snippet/
/**
* Disable WP 4.2 emoji
*/
function ace_remove_emoji() {
add_filter( 'emoji_svg_url', '__return_false' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
@tux255
tux255 / index.html
Created April 1, 2020 06:01
JS Bin text gradient css // source https://jsbin.com/qazutol
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="text gradient css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
h1 {
font-size: 72px;
@tux255
tux255 / console.commands
Last active November 25, 2019 06:26
Clear docker containers. Used to fix: Docker-compose up failing because "port is already allocated"
docker-compose down
docker rm -fv $(docker ps -aq)
sudo lsof -i -P -n | grep {PORT}
@tux255
tux255 / query
Created February 22, 2019 09:20
Wordpress links replacer
UPDATE ac_options SET option_value = replace(option_value, 'http://to.replace', 'http://placehold.er') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE ac_posts SET guid = replace(guid, 'http://to.replace','http://placehold.er');
UPDATE ac_posts SET post_content = replace(post_content, 'http://to.replace', 'http://placehold.er');
UPDATE ac_postmeta SET meta_value = replace(meta_value,'http://to.replace','http://placehold.er');
@tux255
tux255 / sitemap_generator_cached.php
Created September 4, 2018 09:17
sitemap_generator_cached
<?php
header("Content-type: text/xml");
$cache_time = 3600 * 24; // Time in seconds to keep a page cached
$cache_folder = '/'; // Folder to store cached files (no trailing slash)
$cache_filename = $cache_folder.md5($_SERVER['REQUEST_URI']); // Location to lookup or store cached file
//Check to see if this file has already been cached
// If it has get and store the file creation time
$cache_created = (file_exists($cache_filename)) ? filemtime($cache_filename) : 0;
@tux255
tux255 / gist:afe9331cf64b06adfcaa3a4fc67805d9
Created May 7, 2018 11:55 — forked from perusio/gist:1326701
Mobile device detection in Nginx with just 7 lines of configuration
### Testing if the client is a mobile or a desktop.
### The selection is based on the usual UA strings for desktop browsers.
## Testing a user agent using a method that reverts the logic of the
## UA detection. Inspired by notnotmobile.appspot.com.
map $http_user_agent $is_desktop {
default 0;
~*linux.*android|windows\s+(?:ce|phone) 0; # exceptions to the rule
~*spider|crawl|slurp|bot 1; # bots
~*windows|linux|os\s+x\s*[\d\._]+|solaris|bsd 1; # OSes
@tux255
tux255 / Sitemap.xml
Created May 7, 2018 11:42 — forked from misterebs/Sitemap.xml
Create sitemap.xml for wordpress site without plugins
Copy this code to function.php
//Sitemap XML
/*
function to create sitemap.xml file in root directory of site
*/
@tux255
tux255 / functions.php
Created May 6, 2018 07:28
Change Wordpress final output. LazyLoad integration for IMG tags. Not finished
function callback($buffer) {
$patterns = [
'/<img(.*) src=/',
'/<img(.*) class="/'
];
$replacements = [
'<img${1} data-src=',
'<img${1} class="b-lazy '
];
@tux255
tux255 / readme.md
Last active March 1, 2018 09:46
Nano editor syntax highlight
@tux255
tux255 / friendly-url-mod.ocmod
Created December 15, 2017 17:45
Opencart add friendly URLs for other pages
<modification>
<id>seo_url_core</id>
<version>1.4.x and above</version>
<vqmver required="true">2.x.x</vqmver>
<file name="catalog/controller/common/seo_url.php">
<operation error="skip">
<search position="before" offset="0">
<![CDATA[
public function index() {