Skip to content

Instantly share code, notes, and snippets.

View rhyswynne's full-sized avatar

Rhys Wynne rhyswynne

View GitHub Profile
<?php
/*
Plugin Name: WP eBay Product Feeds - Extra Spam Checker
Plugin URI:
Description: A stronger spam checker for WP eBay Product Feeds
Version: 0.1
Author: Winwar Media
Author URI: https://www.winwar.co.uk/?utm_source=author-link&utm_medium=plugin&utm_campaign=ebayfeedsforwordpress
Text Domain: ebay-feeds-for-wordpress
20:46:23.137: CPU Name: Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz
20:46:23.137: CPU Speed: 2600MHz
20:46:23.137: Physical Cores: 2, Logical Cores: 4
20:46:23.137: Physical Memory: 8192MB Total
20:46:23.138: OS Name: Mac OS X (NSMACHOperatingSystem)
20:46:23.138: OS Version: Version 10.14.6 (Build 18G3020)
20:46:23.138: Kernel Version: 18.7.0
20:46:23.145: hotkeys-cocoa: Using layout 'com.apple.keylayout.British'
20:46:23.148: Portable mode: false
20:46:23.451: OBS 24.0.6 (mac)
@rhyswynne
rhyswynne / gist:655f0d658b4c23a20d0f5223efe7e537
Created May 19, 2020 07:26
Log with a successful (ish) stream
10:59:27.611: CPU Name: Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz
10:59:27.611: CPU Speed: 2600MHz
10:59:27.611: Physical Cores: 2, Logical Cores: 4
10:59:27.611: Physical Memory: 8192MB Total
10:59:27.611: OS Name: Mac OS X (NSMACHOperatingSystem)
10:59:27.611: OS Version: Version 10.14.6 (Build 18G3020)
10:59:27.611: Kernel Version: 18.7.0
10:59:27.619: hotkeys-cocoa: Using layout 'com.apple.keylayout.British'
10:59:27.624: Portable mode: false
10:59:27.928: OBS 24.0.6 (mac)
@rhyswynne
rhyswynne / update-death-count.lua
Created March 1, 2020 16:00
Lua script that will update a death counter or file by 1
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "W", function()
-- This opens the file and reads the file into a variable (t)
local deathcounterfile = assert(io.open("[full path to the text file you created]", "r"))
local deathcount = deathcounterfile:read("*all")
-- This adds 1 to the value of deathcount and closes the file
deathcount = deathcount + 1
deathcounterfile:close()
@rhyswynne
rhyswynne / gist:20e158c075770dbc0c286e79a9357603
Created September 12, 2018 07:40
Rename Products in WooCommerce
function winwar_rename_products_in_woocommerce( $args ) {
$newname = 'Painting';
$args['labels'] = array(
'name' => __( $newname . 's', 'woocommerce' ),
'singular_name' => __( $newname, 'woocommerce' ),
'all_items' => __( 'All ' . $newname . 's', 'woocommerce' ),
'menu_name' => _x( $newname .'s', 'Admin menu name', 'woocommerce' ),
'add_new' => __( 'Add New', 'woocommerce' ),
'add_new_item' => __( 'Add new ' . $newname, 'woocommerce' ),
'edit' => __( 'Edit', 'woocommerce' ),
@rhyswynne
rhyswynne / gdpr.php
Created June 20, 2018 18:18
Adding the GDPR eraser functionality in WordPress to your plugin
<?php
/**
* Register the Plugin Eraser for WP Email Capture Premium
*
* @param array $erasers All erasers.
* @return array $erasers All erasers with the WP Email Capture one.
*/
function wp_email_capture_register_premium_plugin_eraser( $erasers ) {
$erasers['wp-email-capture'] = array(
@rhyswynne
rhyswynne / gdpr.php
Created June 18, 2018 10:40
Hook the GDPR exporter into WordPress
<?php
/**
* Hook function adding the wp-email-capture array to the GDPR friendly plugin exporter.
*
* @param array $exporters All current Exporters
* @return array All exporters plus the WP Email Capture one.
*/
function wp_email_capture_register_plugin_exporter( $exporters ) {
$exporters['wp-email-capture'] = array(
'exporter_friendly_name' => __( 'WP Email Capture' ),
@rhyswynne
rhyswynne / gdpr.php
Created June 18, 2018 10:14
How WP Email Capture adds content to the Privacy Policy Page
<?php
/**
* Add Privacy Policy Content to WP Email Capture
*
* @return void
*/
function wp_email_capture_add_privacy_policy_content() {
if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) {
return;
@rhyswynne
rhyswynne / index.php
Created March 23, 2015 18:29
Getting WordPress Downloads Stats
function peadig_remote_request( $key, array $payload ) {
$body = false;
if ( false === ( $body = get_site_transient( 'peadig_rapi_'.$key ) ) ) {
$body = wp_remote_post( 'http://api.wordpress.org/plugins/info/1.0/', array( 'body' => $payload) );
// cache for 3 days
set_site_transient( 'peadig_rapi_'.$key, $value, 60 * 60 * 24 * 3);
}
return $body;
}
@rhyswynne
rhyswynne / gist:70801cff76a3ce23ec7d
Created November 11, 2014 21:28
My Sublime Text 2 Key Bindings
[
{ "keys": ["command+shift+i"], "command": "reindent", "args": {"single_line": false} },
{ "keys": ["ctrl+s"], "command": "snippets" }
]