Skip to content

Instantly share code, notes, and snippets.

@BrookeDot
BrookeDot / biker.sql
Created October 16, 2025 23:05
Bike[R] database structure
DROP TABLE IF EXISTS `rwg_career_totals`;
CREATE TABLE `rwg_career_totals` (
`id` bigint(20) UNSIGNED NOT NULL,
`date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`trips` int(10) UNSIGNED NOT NULL,
`moving_time` int(11) UNSIGNED NOT NULL,
`elevation_gain` decimal(22,12) UNSIGNED NOT NULL,
`distance` decimal(22,12) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/**
* Remove Jetpack's sitemap feature so MSM sitemaps can take control.
* Unless we are trying to access the news sitemap, in which case we use JP.
*/
add_action( 'init', function() {
if ( ! class_exists( 'Jetpack_Sitemap_Manager' ) ) {
return;
}
$raw_uri = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
if ( false === strpos( $raw_uri, '/news-sitemap.xml' ) && false === strpos( $raw_uri, '/news-sitemap.xsl' ) ) {
@BrookeDot
BrookeDot / gist:151aee9fcb7eed370b007b8575246116
Created August 20, 2024 21:01
MSM Sitemap customization
<?php
function vip_customize_msm_sitemap_entry( $url ) {
if ( $url instanceof SimpleXMLElement ) {
// Add images to the sitemap entry.
$post_id = get_the_ID();
$thumbnail_id = get_post_thumbnail_id( $post_id );
if ( $thumbnail_id ) {
@BrookeDot
BrookeDot / Readme.md
Last active July 28, 2021 06:17
MACROPAD Hotkeys with Consumer Key Support
@BrookeDot
BrookeDot / wp-plugins-url.diff
Created May 20, 2018 22:23
Update WP Plugin data plugin to use new Plugin URL
Index: trunk/fergcorp_wp-plugin-data.php
===================================================================
--- trunk/fergcorp_wp-plugin-data.php (revision 1878124)
+++ trunk/fergcorp_wp-plugin-data.php (working copy)
@@ -26,6 +26,9 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly
@BrookeDot
BrookeDot / plugin.php
Created December 22, 2017 02:00
wp_die to admin_notice
Index: trunk/plugin.php
===================================================================
--- trunk/plugin.php (revision 1791008)
+++ trunk/plugin.php (working copy)
@@ -13,8 +13,9 @@
*/
register_activation_hook( __FILE__, 'genesis_tabs_activation_check' );
+
/**
@BrookeDot
BrookeDot / plugin.php
Created December 22, 2017 01:54
Check for genesis_get_image
Index: trunk/Index: trunk/plugin.php
===================================================================
--- trunk/plugin.php (revision 1791008)
+++ trunk/plugin.php (working copy)
@@ -144,7 +144,7 @@
echo '<div id="cat-' . $cat . '" '; post_class( 'ui-tabs-hide' ); echo '>';
- if ( ! empty( $instance['show_image'] ) ) :
+ if ( ( ! empty( $instance['show_image'] ) ) && ( function_exists( 'genesis_get_image' ) ) ) :
@BrookeDot
BrookeDot / plugin.php
Last active December 22, 2017 01:47
Genesis Tabs require Genesis on theme switch.
Index: trunk/plugin.php
===================================================================
--- trunk/plugin.php (revision 1791008)
+++ trunk/plugin.php (working copy)
@@ -144,7 +144,7 @@
echo '<div id="cat-' . $cat . '" '; post_class( 'ui-tabs-hide' ); echo '>';
- if ( ! empty( $instance['show_image'] ) ) :
+ if ( ( ! empty( $instance['show_image'] ) ) && ( function_exists( 'genesis_get_image' ) ) ) :
@BrookeDot
BrookeDot / updater.diff
Created November 19, 2017 00:00
Check if using a child theme before comparing version of GPP themes
@@ -523,8 +524,13 @@
private function get_local_version() {
if ( $this->is_theme() ) {
$theme_data = wp_get_theme();
-
- return $theme_data->Version;
+ if( $theme_data->parent() ){
+ $parent_theme_data = wp_get_theme( $theme_data->Template );
+ return $parent_theme_data->Version;
+ }
@BrookeDot
BrookeDot / led-remote.ino
Last active August 30, 2022 18:02
Particle LED Remote
/* =================================================================
* LED Remote
* (c) Brooke. 2016-2020
* This file is the firmware to be upload and ran on the photon. It makes use of the particle API.
* All original code is under the GPL v3 except where listed.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or