Skip to content

Instantly share code, notes, and snippets.

View antonlukin's full-sized avatar

Anton Lukin antonlukin

View GitHub Profile
@artikus11
artikus11 / rank-math-cleanup.php
Last active February 2, 2024 18:30
Rank Math SEO plugin cleanup
<?php
/**
* Plugin Name: Rank Math SEO plugin cleanup
* Description: A cached translation override for WordPress.
* Author: Artem Abramovich
* Plugin URI: https://gist.github.com/artikus11/0d7a52273bd8bdc85f0d3010f156cd5f
*
* @link https://rankmath.com/kb/filters-hooks-api-developer/
*
* @see https://gist.github.com/timbowen/c5c00667c4c48f8ec3f5706b686d6f00
@leurdo
leurdo / img-link-tooltip.js
Last active July 17, 2023 22:09
Gutenberg Rich Editor button for tooltip
import { useEffect, useRef } from 'react';
// CONFIG
const WIDTH = 660;
const HEIGHT = 440;
const COLUMN_WIDTH = 20;
const COLUMNS = WIDTH / COLUMN_WIDTH;
@sudar
sudar / store-post-meta-gutenberg.js
Created August 6, 2020 09:32
store-post-meta-gutenberg
const { domReady } = wp;
const { useMemo } = wp.element;
const { TextControl } = wp.components;
const { select, useSelect, useDispatch } = wp.data;
const { PluginDocumentSettingPanel } = wp.editPost;
const { registerPlugin } = wp.plugins;
const { __ } = wp.i18n;
/**
* Output the Meta panel for Report pages.
@ireade
ireade / sw.js
Last active October 7, 2023 20:56
Handle broken images with the service worker
self.addEventListener('install', (e) => {
e.waitUntil(
caches.open("precache").then((cache) => cache.add("/broken.png"))
);
});
function isImage(fetchRequest) {
return fetchRequest.method === "GET" && fetchRequest.destination === "image";
}
@argyleink
argyleink / easings.css
Created February 26, 2018 22:34
Handy CSS properties for easing functions
:root {
--ease-in-quad: cubic-bezier(0.55, 0.085, 0.68, 0.53);
--ease-in-cubic: cubic-bezier(0.55, 0.055, 0.675, 0.19);
--ease-in-quart: cubic-bezier(0.895, 0.03, 0.685, 0.22);
--ease-in-quint: cubic-bezier(0.755, 0.05, 0.855, 0.06);
--ease-in-expo: cubic-bezier(0.95, 0.05, 0.795, 0.035);
--ease-in-circ: cubic-bezier(0.6, 0.04, 0.98, 0.335);
--ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
--ease-out-cubic: cubic-bezier(0.215, 0.61, 0.355, 1);
--ease-out-quart: cubic-bezier(0.165, 0.84, 0.44, 1);
@neretin-trike
neretin-trike / pug.md
Last active April 24, 2024 18:22
Туториал по HTML препроцессору Pug (Jade)
@dustyfresh
dustyfresh / nginx-load-scripts-mitigation.conf
Last active March 14, 2023 06:07
nginx rule to mitigate DoS attack on WordPress load-scripts.php
# https://baraktawily.blogspot.fr/2018/02/how-to-dos-29-of-world-wide-websites.html
# https://wpvulndb.com/vulnerabilities/9021
location ~* ^/wp-admin/load-scripts\.php$ {
if ( $query_string ~* "^.{1024,}$" ) {
return 444;
}
}
@banhaclong20
banhaclong20 / Touch swipe detection in pure JavaScript
Created November 2, 2017 22:41
Touch swipe detection in pure JavaScript
<div id="swipezone">
Swipe me
</div>
// credit: http://www.javascriptkit.com/javatutors/touchevents2.shtml
function swipedetect(el, callback){
var touchsurface = el,
swipedir,
startX,
@sirbrillig
sirbrillig / functions.php
Last active January 24, 2024 15:46 — forked from UmeshSingla/functions.php
Post file using wp_remote_post in WordPress
<?php
$local_file = 'file_path'; //path to a local file on your server
$post_fields = array(
'name' => 'value',
);
$boundary = wp_generate_password( 24 );
$headers = array(
'content-type' => 'multipart/form-data; boundary=' . $boundary,
);