Skip to content

Instantly share code, notes, and snippets.

🍕
Working hard reviewing and deploying code

Scott Kingsley Clark sc0ttkclark

🍕
Working hard reviewing and deploying code
Block or report user

Report or block sc0ttkclark

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sc0ttkclark
sc0ttkclark / custom-pods-shortcode-total-text.php
Last active May 28, 2019
Custom `[pods]` shortcode handling for total text.
View custom-pods-shortcode-total-text.php
<?php
/*
* Ensure total_found() gets calculated right away, because in the [pods] shortcode
* it does other queries after the initial find().
*/
add_filter( 'pods_data_auto_calculate_total_found', '__return_true' );
/**
* Add custom shortcode handling for total text.
@djrmom
djrmom / custom-hooks.php
Created Feb 8, 2018
facetwp index a field in a related post type
View custom-hooks.php
<?php
/**
** look up and index a value from a post relationship field
** set the datasource to the relationship field
** get the post id of that related post and use it to
** lookup its associated value
** for ACF you may want get_field() instead of get_post_meta()
** remember to do a full re-index after adding code
** check the wp_facetwp_index table if needed to see what values are being indexed
**/
@jamesgol
jamesgol / CPT-Admin-Fields.php
Created Oct 25, 2016
Pods CPT Admin Fields
View CPT-Admin-Fields.php
<?php
/**
* Name: CPT Admin Fields
*
* Description: Allow adding fields to the CPT editor table.
*
* Version: 2.3
*
* Category: Advanced
*
@sc0ttkclark
sc0ttkclark / userscript.js
Created Oct 7, 2016
Papertrail JSON formatter (with addStyle fix)
View userscript.js
// ==UserScript==
// @name Papertrail JSON formatter
// @namespace https://papertrailapp.com/
// @version 0.1
// @description Format and colorize JSON log messages in Papertrail
// @match https://papertrailapp.com/*events*
// @copyright 2014+, Papertrail (http://wiki.creativecommons.org/Public_domain)
// @grant GM_addStyle
// ==/UserScript==
@sc0ttkclark
sc0ttkclark / .htaccess
Last active May 3, 2016
Add these lines to your .htaccess file if you can't get cPanel Let's Encrypt installation or renewal working properly (tested on SiteGround). They MUST go above any WordPress rewrites but below the "RewriteEngine On RewriteBase /" portion.
View .htaccess
# Stop processing any rewrites for /.well-known/ files
RewriteCond %{REQUEST_URI} ^/\.well-known/.*$ [NC]
RewriteRule ^ - [L]
@nkt
nkt / Results.md
Last active Sep 11, 2019
ReactPHP vs Node.js
View Results.md

wrk -t4 -c400 -d10s http://127.0.0.1:1337/

PHP

Running 10s test @ http://127.0.0.1:1337/
  4 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     7.02ms    6.94ms  82.86ms   85.27%
@sc0ttkclark
sc0ttkclark / 0-README.md
Last active Jun 18, 2019
PhpStorm.app Mac integration with Tower.app for diff and merge - https://youtrack.jetbrains.com/issue/WI-26090
View 0-README.md

PhpStorm.app Mac integration with Tower.app for diff and merge

You must place both files in the ~/Library/Application Support/com.fournova.Tower2/CompareTools/ directory and chmod +x phpstorm.sh

This integration is based on the one I found for Beyond Compare's beta integration:

https://github.com/tednaleid/git-tower-beyond-compare-shim

View term-split-update-examples.md

Preparing Plugins for Term Splitting

Historically, two terms in different taxonomies with the same slug (for instance, a tag and a category sharing the slug "news") have shared a single term ID. Beginning in WordPress 4.2, when one of these shared terms is updated, it will be split: the updated term will be assigned a new term ID.

In the vast majority of situations, this update will be seamless and uneventful. However, some plugins and themes store term IDs in options, post meta, user meta, or elsewhere. WP 4.2 will include two different tools to help authors of these plugins and themes with the transition.

The 'split_shared_term' action

When a shared term is assigned a new term ID, a new 'split_shared_term' action is fired. Plugins and themes that store term IDs should hook to this action to perform necessary migrations. The documentation for the hook is as follows:

@sc0ttkclark
sc0ttkclark / bbp-optimize.php
Last active Jun 28, 2019
bbPress Optimize -- Optimizes bbPress queries for large bbPress forums
View bbp-optimize.php
<?php
/*
Plugin Name: bbPress Optimize
Plugin URI: https://www.scottkclark.com/
Description: Optimizes bbPress queries for large bbPress forums
Version: 1.1
Author: Scott Kingsley Clark
Author URI: https://www.scottkclark.com/
*/
@jtsternberg
jtsternberg / README.md
Last active Mar 25, 2018
Create a theme options page with CMB2
View README.md
You can’t perform that action at this time.