Skip to content

Instantly share code, notes, and snippets.

View mcaskill's full-sized avatar
🥃

Chauncey McAskill mcaskill

🥃
View GitHub Profile
@mcaskill
mcaskill / wp-acf-location-nowhere.php
Created April 16, 2015 19:07
WordPress \ ACF : Add "Nowhere" as a location to "Page Type" rules.
<?php
/**
* Filter: Add "Nowhere" as a location to "Page Type" rules.
*
* Useful for third-parties seeking to dynamically embed
* the field group in a non-traditional manner.
*
* @used-by Filer: 'acf/location/rule_values/page_type'
* @param array $choices
@mcaskill
mcaskill / wp-get_id_by_path.php
Created April 20, 2015 15:43
WordPress : Retrieve a post ID given its path.
<?php
if ( ! function_exists('get_ID_by_path') ) :
/**
* Retrieves an ID given its path.
*
* @global $wpdb
*
* @param string $page_path Page path
@mcaskill
mcaskill / git-multi-status.md
Last active December 7, 2015 17:51 — forked from mzabriskie/README.md
View a summary of the status for multiple repositories.

Name

git-multi-status — View a summary of the status for multiple repositories.

Usage

git-multi-status [<options>…​] [--] [<path>…​]
@mcaskill
mcaskill / charcoal-slim-polyglot.php
Created August 9, 2016 15:35
Charcoal : Adding the Slim\Polyglot middleware
<?php
/**
* Application HTTP Middlewares
*
* @link https://github.com/mcaskill/Slim-Polyglot
* @global App $app The Charcoal application.
* @package Charcoal
*/
@mcaskill
mcaskill / charcoal.admin.elfinder.json
Last active October 7, 2016 19:46
Charcoal : Customize elFinder Connector options
{
"admin": {
"elfinder": {
"connector": {
"bind": {
"upload.pre mkdir.pre mkfile.pre rename.pre archive.pre ls.pre": [
"Plugin.Normalizer.cmdPreprocess",
"Plugin.Sanitizer.cmdPreprocess"
],
"ls": [
@mcaskill
mcaskill / Function.Compose-Sequence.php
Created November 11, 2016 18:15
PHP : Function composition — 'a(b(c(x)))' or 'c(b(a(x)))'
<?php
/**
* Compose the given functions into a new one (`a(b(c(x)))`).
*
* Similar to {@see sequence()}, except the function list is executed in reverse —
* the last function is executed first.
*
* ```
* compose(a, b, c) => a(b(c(x)))
@mcaskill
mcaskill / charcoal-slim-redirections.php
Created December 8, 2016 14:38
Charcoal : Route Aliases & Redirections for Slim
<?php
/**
* Route Aliases & Redirections
*
* @global App $app The Charcoal application.
* @global Container $container The DIC.
* @todo Add support for request method lookup, not just response method.
*/
@mcaskill
mcaskill / String.prototype.explode.js
Created April 25, 2017 02:43
JS : Split a string by string
if (!String.prototype.explode) {
/**
* Split a string by string
*
* Splits a String object into an array of substrings, each of which is formed
* by splitting it on boundaries formed by the string delimiter.
*
* @link http://locutus.io/php/explode/ Created by Kevin van Zonneveld (http://kvz.io)
* @example
* 'Kevin van Zonneveld'.explode(' ') // [ 'Kevin', 'van', 'Zonneveld' ]
@mcaskill
mcaskill / elogram.php
Created June 26, 2017 14:22
Elogram Quickstart
<?php
use Larabros\Elogram\Client;
header('Content-Type: application/json;charset=utf-8');
/** Register the Composer autoloader */
require dirname(__DIR__) . '/vendor/autoload.php';
$clientId = '';
@mcaskill
mcaskill / wp-has_query_var
Last active November 17, 2017 11:11
WordPress : Determine if a query variable is set.
<?php
/**
* Check if the current variable is set, and is not NULL, in the WP_Query class.
*
* @see WP_Query::$query_vars
* @uses $wp_query
*
* @param string $var The variable key to be checked.
* @return bool True if the current variable is set.