Skip to content

Instantly share code, notes, and snippets.

View jonathanstegall's full-sized avatar

Jonathan Stegall jonathanstegall

View GitHub Profile
@hlashbrooke
hlashbrooke / class.php
Created February 28, 2014 08:37
A complete, versatile options page class for any WordPress plugin
<?php
if ( ! defined( 'ABSPATH' ) ) exit;
class WordPress_Plugin_Template_Settings {
private $dir;
private $file;
private $assets_dir;
private $assets_url;
private $settings_base;
@sheabunge
sheabunge / autoload.php
Last active October 9, 2024 00:31
Basic PHP class autoloader that follows the WordPress coding standards for class names and class filenames
<?php
namespace Shea\Example_Plugin;
/**
* Enable autoloading of plugin classes in namespace.
*
* @param $class_name
*/
function autoload( $class_name ) {
@ambienttraffic
ambienttraffic / qa-handbook.md
Last active September 14, 2020 01:52
Serious Eats QA Handbook

Serious Eats QA Handbook

Help us find and squash bugs!

Take a look at the QA spreadsheet. Here’s a bit.ly in case you’re using it on a mobile device: http://bit.ly/1Nt6q1W Questions? Throw it into the public #qa Slack channel.

In the “Browsers/OS matrix” tab, find the Browser/OS you’ve been assigned. Either fire up BrowserStack (directions below) or use the actual device. Look at the “URLs” tab in the spreadsheet. URLs are organized by “Type”. You can mix up the URLs in the list, but you must complete at least the following:

  • 2 Landing pages
  • 5 Recipes
@djonsson
djonsson / install_elasticsearch_osx.md
Last active June 12, 2025 07:13
OS X installation instructions for Elasticsearch + Kibana + Marvel

What is this?

Following this guide will set up a local Elasticsearch with Kibana and Marvel using Homebrew and Homebrew Cask

Prerequisites

If you already have Java installed on your system, skip steps Install Cask and Install Java

If you already have Java and Homebrew installed on your system, skip steps Prerequisites, start at Install Elasticsearch and Kibana after running $ brew update

Install Homebrew

  • $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@devinsays
devinsays / jetpack.php
Last active July 26, 2022 12:36
Query by JetPack Related Posts
<?php
/**
* Prevents Related Posts from displaying in content area
*/
function prefix_remove_rp() {
if ( class_exists( 'Jetpack_RelatedPosts' ) ) {
$jprp = Jetpack_RelatedPosts::init();
$callback = array( $jprp, 'filter_add_target_to_dom' );
remove_filter( 'the_content', $callback, 40 );
}
@EricBusch
EricBusch / wordpress_table_column_exists.php
Last active November 6, 2022 11:05
A function for WordPress to check if a column exists in a database table or not. Returns true if a database table column exists. Otherwise returns false.
<?php
/**
* Returns true if a database table column exists. Otherwise returns false.
*
* @link http://stackoverflow.com/a/5943905/2489248
* @global wpdb $wpdb
*
* @param string $table_name Name of table we will check for column existence.
* @param string $column_name Name of column we are checking for.
SELECT
p.ID,
REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( p.post_title, 0xE28098, "'" ), 0xE28099, "'" ), 0xE2809C, '"' ), 0xE2809D, '"' ), 0xE28093, '-' ), 0xE28094, '--' ), 0xE280A6, '...' ), CHAR( 145 ), "'" ), CHAR( 146 ), "'" ), CHAR( 147 ), '"' ), CHAR( 148 ), '"' ), CHAR( 150 ), '-' ), CHAR( 151 ), '--' ), CHAR( 133 ), '...' ) as title,
(
SELECT REPLACE(name, '&amp;', '&' ) FROM wp_terms WHERE term_id IN
(
SELECT REPLACE( REPLACE( meta_value, 'a:1:{s:8:"category";s:5:"', '' ), '";}', '' ) as category_id
FROM wp_posts p2
LEFT OUTER JOIN wp_postmeta m ON p2.ID = m.post_id
WHERE p2.ID = p.ID AND m.meta_key = '_category_permalink'
<?php
/**
* Plugin Name: Comment Moderator
* Plugin URI: https://99robots.com/products/
* Description: Add a new user role, Comment Moderator, that allows a new user to only manage comments.
* Version: 1.3.2
* Author: 99 Robots
* Author URI: https://99robots.com
* License: GPL2
* Text Domain: wpsite-comment-moderator
@jonjack
jonjack / add-update-refresh-github-access-token-on-mac.md
Last active September 15, 2025 13:14
Adding & Updating GitHub Access Token on Mac

Using an Access Token for the first time

Follow the instructions on Github to Create an Access Token in Github

Configure Git to use the osxkeychain

By default, git credentials are not cached so you need to tell Git if you want to avoid having to provide them each time Github requires you to authenticate. On Mac, Git comes with an “osxkeychain” mode, which caches credentials in the secure keychain that’s attached to your system account.

You can tell Git you want to store credentials in the osxkeychain by running the following:-

@davisshaver
davisshaver / class-jwt.php
Last active September 26, 2023 00:25
WordPress/Coral Project Talk JWT integration
<?php
use \Firebase\JWT\JWT as JWT_Wrapper;
/**
* Class wrapper for JWT tokens.
*/
class JWT {
use Singleton;