Skip to content

Instantly share code, notes, and snippets.

@planetahuevo
planetahuevo / cloudflare-purge-cache-service-worker.js
Last active October 29, 2023 13:24 — forked from vdbelt/cloudflare-purge-cache-service-worker.js
A CloudFlare service worker that proxies purge cache requests. Example: https://example.com/__purge_cache?zone=XX
addEventListener('fetch', event => {
event.respondWith(purgeCache(event.request))
})
async function purgeCache(request) {
const url = new URL(request.url)
@planetahuevo
planetahuevo / 0-README.md
Created September 11, 2023 19:14 — forked from Overbryd/0-README.md
Cloudflare Fragment Caching

Cloudflare fragment rendering/caching

This worker script will evaluate your origin response, and replace html comments marked as fragment:key with a respective prefetch defined in a X-Fragments response header.

Usage

Your origin must include the X-Fragments header, specifying the a comma separated list of prefetch requests to make for that response.

< HTTP/1.1 200 OK
body {
background-image: url(https://live.staticflickr.com/65535/51705970602_9f5ec7b9a8_k.jpg);
background-size: 100% 100%;
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
transition: background .2s;
color:#fff;
}
@planetahuevo
planetahuevo / a_faster_load_textdomain.php
Created June 25, 2021 23:57 — forked from soderlind/a_faster_load_textdomain.php
A faster load_textdomain for WordPress
<?php
/*
Plugin Name: A faster load_textdomain
Version: 0.0.1
Description: While we're wating for https://core.trac.wordpress.org/ticket/32052.
Author: Per Soderlind
Author URI: https://soderlind.no
Plugin URI: https://gist.github.com/soderlind/610a9b24dbf95a678c3e
License: GPL
@planetahuevo
planetahuevo / Stackedit.md
Created April 19, 2021 23:50 — forked from nztim/Stackedit.md
Install StackEdit on Ubuntu 14.04

###Install Node and Bower

  • Set up the NodeSource repo and install Node
  • curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
  • sudo apt-get install nodejs
  • Install bower: sudo npm install -g bower

Install StackEdit

  • Clone the repo: git clone https://github.com/benweet/stackedit
  • To use a domain other than 'localhost', edit /public/res/constants.js:
  • constants.BASE_URL = "http://stackedit.dev:3000/";
@planetahuevo
planetahuevo / sec-scan-v6.sh
Created January 30, 2021 19:32 — forked from CapWebSolutions/sec-scan-v6.sh
Latest iteration of security scanning script for MainWP instance.
#
# This script is executed from a terminal prompt at the root of your MainWP WordPress website.
# It uses the same services as WP CLI, so if WP CLI runs, this should also.
#
# Execute MainWP CLI command to generate a list of all configured sites in MainWP
# Pipe output through filter to remove columns 3 and 4 of output. These columns hold the 2 digit site number. Adjust if more than 99 sites.
# Pipe that output to get rid of the comment lines in the site listing.
# Pipe that output through the SED editor inserting the security scan command at the beginning of the line
# Send everything to a shell script to be executed.
rm -f sec-scan-auto.sh
@planetahuevo
planetahuevo / stripParamsWorker.js
Created January 5, 2021 23:23 — forked from rohenaz/stripParamsWorker.js
cloudflare worker - strip referral query parameters such as fbclid
/**
* Define regular expressions at top to have them precompiled.
*/
const urlRegex = new RegExp('^(refreshce|gclid|cx|ie|cof|siteurl|zanpid|origin|utm_[a-z]+|fbid|fbclid|mr:[A-z]+|ref(id|src))$');
addEventListener('fetch', event => {
event.passThroughOnException()
event.respondWith(handleRequest(event.request))
})
@planetahuevo
planetahuevo / hide-edd-coupons.php
Created November 10, 2020 17:01 — forked from bekarice/hide-edd-coupons.php
Hide EDD Coupon fields and codes at checkout
/**
* Snippets to hide EDD coupon fields & codes during the checkout process - handy if you use URLs to apply discounts instead
* Tutorial: http://www.sellwithwp.com/easy-digital-downloads-hide-coupons/
*/
// Removes the field to enter a discount at checkout
remove_action( 'edd_checkout_form_top', 'edd_discount_field', -1 );
// Changes the discount code in the checkout summary to display "Discount applied - " instead of the code
@planetahuevo
planetahuevo / cookie-policy.md
Created December 10, 2019 20:41 — forked from maddisondesigns/cookie-policy.md
eCommerce Terms & Conditions and Privacy Templates
@planetahuevo
planetahuevo / yuzo-related-post-hacked.md
Created April 10, 2019 12:34 — forked from mrnonz/yuzo-related-post-hacked.md
Zero Day Vulnerability Yuzo Related Post plugin. I try to find where injected code into my Database

SELECT * FROM wp_options WHERE option_value LIKE '%eval(String.fromCharCode%';

and I got these value.