Skip to content

Instantly share code, notes, and snippets.

@elysium001
elysium001 / bypass-cache-w-cookie.sh
Created August 20, 2024 14:28
random curl tests
@elysium001
elysium001 / WP_CLI_Term_Importer.php
Last active August 5, 2024 20:48
Clones parent terms to subsite and creates WPML relationship
<?php
/**
* Plugin Name: WP CLI Term Importer
*
* Description: Import terms from the parent site to the current site.
* Author: Omar
* Version: 1.0.0
*/
/**
@elysium001
elysium001 / class-json-to-gutenberg-table.php
Created July 18, 2024 17:37
A PHP class that converts JSON data to a Gutenberg ready html table.
<?php
declare(strict_types=1);
/**
* Class JsonToGutenbergTable
*
* Converts JSON data to a Gutenberg table.
*
* @package MetricPoster
@elysium001
elysium001 / gen-md5-wp-cron.php
Created January 26, 2024 19:54
Find the name of a cron job from the md5 hash of the name
<?php
// Find the name of a cron job from the md5 hash of the name.
// prerequisites
// 1. jobs.txt - a list of cron job names, one per line
// 2. needles.txt (optional) - a list of md5 hashes of cron job names, one per line
// get the list of names from jobs.txt
$hook_names = file_get_contents('jobs.txt');
$hook_names = explode("\n", $hook_names);
@elysium001
elysium001 / demo-slow-query.php
Created December 22, 2023 00:02
used to demo slow queries and ES implementation
<?php
/*
Plugin Name: Omars Test
Description: for testing
Author: Automattic
*/
// return if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
@elysium001
elysium001 / functions.php
Created September 7, 2020 04:21
render block hook example to modify specific blocks
<?php
// IG: @i_am_techgnosis
// render block hook example to modify specific blocks...
function gutenberg_block_wrapper( $block_content, $block ) {
if ( isset( $block['attrs']['align'] ) && in_array( $block['attrs']['align'], array( 'wide', 'full' ) ) ) {
$block_content = sprintf(
'<div class="%1$s">%2$s</div>',
'align-wrap align-wrap-' . esc_attr( $block['attrs']['align'] ),
@elysium001
elysium001 / functions.php
Created September 7, 2020 04:19
Adding Metaboxes to WP Post and Pages
<?php
add_action( 'add_meta_boxes', 'add_featured_checkbox_function' );
function add_featured_checkbox_function() {
// view WP Docs: https://developer.wordpress.org/reference/functions/add_meta_box/
add_meta_box(
'full_content_checkbox_id',
'Show Full Content?',
'full_content_checkbox_callback_function',
'post',
@elysium001
elysium001 / Dockerfile
Last active September 10, 2023 01:22
Quick Dockerfile for php and composer
# Generated using Google Bard with prompt:
# generate a dockerfile that does the following:
# uses composer image to execute composer install on a given directory
# uses a nodejs image to execute npm install && npm run build on a given directory
# copies the composer and nodejs output to a PHP image that runs WordPress
# composer task
FROM composer:latest AS composer
WORKDIR /app
COPY composer.json composer.lock ./
@elysium001
elysium001 / index.html
Created October 21, 2018 06:05
SVG <feColorMatrix>, pattern with bitmapped image
<!--Pen by Margus Lillemägi | codepen.io/VisualAngle/-->
<div id="container">
<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMin slice">
<filter id="F">
<feColorMatrix type="reference" values="0" />
</filter>
<filter id="colorMeMatrix">