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 / 0-README.md
Last active May 21, 2020
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

Note: For Tower 3 you will need ot place them in the ~/Library/Application Support/com.fournova.Tower3/CompareTools/ directory

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

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

@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==
View rest.json
{
"namespace": "pods/v1",
"routes": {
"/pods/v1": {
"namespace": "pods/v1",
"methods": [
"GET"
],
"endpoints": [
{
@sc0ttkclark
sc0ttkclark / add-product-to-cart.php
Last active Mar 5, 2020 — forked from kloon/gist:2376300
WooCommerce Automatically add product to cart on site visit
View add-product-to-cart.php
<?php
/*
* This code goes into theme functions.php or a custom plugin
*/
/**
* Add product to cart on page load
*/
function add_product_to_cart() {
View pods-help.php
<?php
//pods: https://imgur.com/a/MflzgtI
$search = sanitize_text_field( $search );
$query = array();
$query[] = 'brand.meta_value = ' . absint( $_REQUEST['brand_id'] );
$query[] = '
d.asset_name LIKE "%' . pods_sanitize_like( $search ) . '%"
OR product_d.sku like "%' . pods_sanitize_like( $search ) . '%"
@sc0ttkclark
sc0ttkclark / event-tickets-support-html-descriptions.php
Last active Oct 8, 2019
Support HTML descriptions on Tickets for the Event Tickets plugin
View event-tickets-support-html-descriptions.php
<?php
// Allow (safe) HTML for ticket descriptions.
add_action( 'tribe_tickets_ticket_add', function( $post_id, $ticket, $data ) {
$ticket->description = isset( $data['ticket_description'] ) ? wp_kses_post( $data['ticket_description'] ) : '';
}, 10, 3 );
@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/
*/
@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.
@sc0ttkclark
sc0ttkclark / debug-ep.php
Created Feb 26, 2019
ElasticPress debugging code for mu-plugins
View debug-ep.php
<?php
/**
* @param string $type
*
* @return bool
*/
function debug_ep_is_debug( $type = 'normal' ) {
if ( ! empty( $_GET['epdebug'] ) || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
@sc0ttkclark
sc0ttkclark / gist:8768847
Created Feb 2, 2014
pods_api_post_save_pod_item_{pod} hook example
View gist:8768847
<?php
/**
* Filter the Pods saving process and run actions / modify values
*
* @param array $pieces An array of different variables you can *change*, see below
*
* List of $pieces variables includes:
*
* array $pieces['fields'] An array of fields on the Pod, 'value' key stores the *new* value if it's been set to save
*
You can’t perform that action at this time.