Skip to content

Instantly share code, notes, and snippets.

View mcaskill's full-sized avatar
🥃

Chauncey McAskill mcaskill

🥃
View GitHub Profile
@mcaskill
mcaskill / _objects.modal.scss
Created June 17, 2014 21:36
/locomotivemtl/sass/helpers/_stack-context.scss
@import '_zindex.scss'
.modal {
z-index: index($site-order, modals);
.field {
z-index: index($modal-order, fields);
}
.form-controls {
@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.

Keybase proof

I hereby claim:

  • I am mcaskill on github.
  • I am mcaskill (https://keybase.io/mcaskill) on keybase.
  • I have a public key whose fingerprint is 9474 2586 E6F7 677D 17C4 E829 C11C ADAB BFC1 D36C

To claim this, I am signing this object:

@mcaskill
mcaskill / _mj.scss
Created November 23, 2014 22:52
A `sass-mq` mixin that uses Jacket
$mq-jacket-support: has-mediaqueries !default;
$mq-jacket-legacy: has-no-mediaqueries !default;
$jacket: append($jacket, $mq-jacket-support) !default;
/// Jacket MQ
///
/// Create a `@media` query based on a named-breakpoint and
/// possibly ignore the wrapper based on the context of $jacket.
///
@mcaskill
mcaskill / wp-nav_trail
Created November 28, 2014 06:59
WordPress : Displays a location breadcrumb trail using WordPress navigation menus.
<?php
/**
* Displays a location breadcrumb trail.
*
* Uses WordPress nav menu items and theme locations to build
* a breadcrumb trail. Overall, this template functon replicates
* most of the procedures found in `wp_nav_menu()`.
*
* @param array $args {
@mcaskill
mcaskill / modernizr-videoautoplay.js
Last active August 29, 2015 14:13
Checks for support of the autoplay attribute of the video element.
/**
* Checks for support of the autoplay attribute of the video element.
*
* Adapted to work for Modernizr 2, based on the detection feature for Modernizr 3.
*
* @link https://github.com/Modernizr/Modernizr/blob/8d2cb3c92e33c36ed3fd8a5ea6e198b3b26ad07a/feature-detects/video/autoplay.js
*/
Modernizr.addTest('videoautoplay', function(){
var timeout;
@mcaskill
mcaskill / recaptchalib-errors.php
Last active August 29, 2015 14:14
ReCAPTCHA 2 Error Code Parsing
<?php
/**
* Parse ReCAPTCHA API verion 2.0 error codes.
*
* @uses mcaskill\ReCAPTCHA or jmcastagnetto\ReCAPTCHA
* @link https://developers.google.com/recaptcha/docs/verify Error code reference
*
* @param mixed $response A Google\ReCaptcha\Response or null
* @param array $arr If the second parameter $arr is present, error messages are stored in this variable as associative array elements instead.
@mcaskill
mcaskill / wp-get_template_view
Last active August 29, 2015 14:16
WordPress : Load a template part into a template and pass scoped variables
<?php
/**
* Load a template part into a template
*
* Makes it easy for a theme to reuse sections of code in a easy to overload way
* for child themes.
*
* Includes the named template part for a theme or if a name is specified then a
* specialised part will be included. If the theme contains no {slug}.php file
@mcaskill
mcaskill / checkbox-toggle.js
Created March 16, 2015 17:49
Simple checkbox toggling with jQuery
/* global jQuery */
/**
* Simple Checkbox Toggling
*
* Hands-free checked/unchecked toggling for all checkboxes.
*
* Requirements:
* - jQuery
* - `name="foo[]"` -- Name attribute must assign checked values to an array.
@mcaskill
mcaskill / Function.Array-Insert.php
Last active April 13, 2020 13:11
PHP : Insert elements from a passed array into the first array
<?php
if (!function_exists('array_insert')) {
/**
* Insert an array into another array before/after a certain key
*
* Merge the elements of the $array array after, or before, the designated $key from the $input array.
* It returns the resulting array.
*
* @param array $input The input array.