Skip to content

Instantly share code, notes, and snippets.

View bahiirwa's full-sized avatar
🏠
Working from home

Laurence Bahiirwa bahiirwa

🏠
Working from home
View GitHub Profile
<?php
/**
* WP_HTML_Table_Processor
* @author Seth Rubenstein
*/
/**
* Pass in a table and get back an array of the header, rows, and footer cells quickly and effeciently.
*
* The WP_HTML_Tag_Processor bookmark tree navigation is heavily cribbed from WP_Directive_Processor class https://github.com/WordPress/block-interactivity-experiments/pull/169/files#diff-ad36045951e27010af027ae380350ae4b07b56a659a3127b40b7967b2308d5bc
@BhargavBhandari90
BhargavBhandari90 / url_to_qr.php
Last active December 20, 2023 17:50
URL to QR Code.
<?php
$url = 'https://bhargavb.com/';
$qr_link = 'https://chart.googleapis.com/chart?chs=224x224&cht=qr&chl='. $url .'&choe=UTF-8';
printf( '<img src="%s" alt="QR Code">', $qr_link );
@devinsays
devinsays / OrdersList.php
Created June 2, 2022 15:45
Speeds up the loading of /wp-admin/edit.php?post_type=shop_order and /wp-admin/edit.php?post_type=subscription.
<?php
namespace UniversalYums\Admin\Performance;
class OrdersList {
/**
* The single instance of the class.
*/
protected static $instance;
@devinsays
devinsays / ActionSchedulerHighVolume.php
Last active March 24, 2023 14:25
Modifications to Action Scheduler in order to run higher volumes of actions.
<?php
/**
* High volume modifications to Action Scheduler.
*
* Adapted from https://github.com/woocommerce/action-scheduler-high-volume/
*
* Increase Action Scheduler batch size, concurrency, timeout period, and claim action query
* ORDER BY to process large queues of actions more quickly on servers with more server resources.
*
* @package UniversalYums\ActionScheduler
@bradtraversy
bradtraversy / docker_wordpress.md
Last active April 10, 2024 08:56
Docker Compose FIle For Wordpress, MySQL & phpmyadmin

Wordpress & Docker

This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command

$ docker-compose up -d

# To Tear Down
$ docker-compose down --volumes
@johnalarcon
johnalarcon / .htaccess
Last active March 24, 2020 20:46
Directives for the ClassicPress .htaccess file. These directives can be copied into your exisitng .htaccess file, but they are not intended to overwrite other directives that may already be present. Read the comment before each directive below, and you'll be fine!
# Code Potent's official .htaccess directives to make your ClassicPress site ROCK!
# Prevent directory browsing.
Options -Indexes
# Enable rewrite engine - you may already have these 2 lines... don't duplicate, if so.
RewriteEngine On
RewriteBase /
# Force SSL connection to everything (URLs, images, scripts, styles, etc)
@pento
pento / php-block.js
Last active February 29, 2024 01:31
Converting a shortcode to a block: this method is fast to do, but a mediocre UX. You should only use this as a stopgap until you can implement a full block UI.
// License: GPLv2+
var el = wp.element.createElement,
registerBlockType = wp.blocks.registerBlockType,
ServerSideRender = wp.components.ServerSideRender,
TextControl = wp.components.TextControl,
InspectorControls = wp.editor.InspectorControls;
/*
* Here's where we register the block in JavaScript.
@bahiirwa
bahiirwa / local gulp workflow
Created August 25, 2017 01:58
My gulp local workflow
npm init to create package.js
create gulpfile.js
Install Local dependecies
npm install --save-dev gulp gulp-autoprefixer gulp-sass gulp-uglify gulp-concat
Write gulp tasks like
const gulp = require('gulp');
const sass = require('gulp-sass');
@dingo-d
dingo-d / page-metabox.php
Last active May 23, 2023 15:05
A page metabox with a color picker option
<?php
add_action( 'admin_enqueue_scripts', 'mytheme_backend_scripts');
if ( ! function_exists( 'mytheme_backend_scripts' ) ){
function mytheme_backend_scripts($hook) {
wp_enqueue_media();
wp_enqueue_style( 'wp-color-picker');
wp_enqueue_script( 'wp-color-picker');
}
@geoffspink
geoffspink / rename_woocommerce_admin_menu.php
Created November 10, 2014 07:07
Rename the Admin Menu name for WooCommerce to the name of the website store.
<?php
add_action( 'admin_menu', 'rename_woocoomerce_admin_menu', 999 );
function rename_woocoomerce_admin_menu()
{
global $menu;
// Pinpoint menu item
$woo = recursive_array_search_php( 'WooCommerce', $menu );