Skip to content

Instantly share code, notes, and snippets.

View mkokes's full-sized avatar

Marty Kokes mkokes

View GitHub Profile
@mkokes
mkokes / Canadian Provinces
Created July 3, 2018 16:06
ACF US State and Canadian Province Abbreviations
AB : Alberta
BC : British Columbia
MB : Manitoba
NB : New Brunswick
NL : Newfoundland and Labrador
NT : Northwest Territories
NS : Nova Scotia
NU : Nunavut
ON : Ontario
PE : Prince Edward Island
@mkokes
mkokes / resize_local_machine.sh
Last active April 19, 2018 15:01 — forked from claygriffiths/resize_local_machine.sh
Resize Local by Flywheel VirtualBox image
# Steps we will take:
# 1. Change Local (Docker Machine) image type (this will take a bit)
# 2. Resize image
# 3. Resize partion
#
# Also see: https://docs.docker.com/articles/b2d_volume_resize/
# IMPORTANT: Make sure Local is not running!
VM_NAME="pressmatic"
NEW_DISK_SIZE=50000
@mkokes
mkokes / Xdebug Limits
Created March 15, 2017 15:09
Set xdebug to display more lines in a var_dump by temporarily putting this within your code
ini_set('xdebug.var_display_max_depth', 5);
ini_set('xdebug.var_display_max_children', 256);
ini_set('xdebug.var_display_max_data', 1024);
@mkokes
mkokes / gflow-complete-step-function.php
Created January 16, 2017 21:17 — forked from Idealien/gflow-complete-step-function.php
Gravity Flow - Different ways to have workflow step(s) trigger post status update
//Update after each step completion - probably executes too often for most use cases
add_action( 'gravityflow_step_complete', 'gravityflow_step_complete_post_publish', 10, 4 );
function gravityflow_step_complete_post_publish( $step_id, $entry_id, $form_id, $status ) {
$entry = GFAPI::get_entry( $entry_id );
$currentPost = get_post( rgar( $entry, 'post_id' ) );
if("draft" == $currentPost->post_status) {
@mkokes
mkokes / function.php
Created September 27, 2016 20:41
Set a vimeo video to continually loop in a soliloquy slider
// Loop Vimeo Videos in Soliloquy
add_filter( 'soliloquy_vimeo_args', 'mdk_vimeo_sol_settings', 10, 3 );
function mdk_vimeo_sol_settings( $args ) {
$loop = array( 'loop' => 1 );
$args = array_merge( $args, $loop );
return $args;
}
@mkokes
mkokes / functions.php
Created September 23, 2016 17:04
Responsive Video embed, filter wraps oembeds in a container and styling will make sure that it remains proportional with a flexible width
// Responsive oEmbed for videos
add_filter( 'embed_oembed_html', 'resp_embed', 10, 3 );
function resp_embed( $html ) {
return '<div class="oembed-container">' . $html . '</div>';
}
@mkokes
mkokes / soliloquy_metaboxes.php
Last active March 9, 2016 18:56
Add custom meta boxes to individual soliloquy slides
// Add Additional Meta Boxes to Soliloquy Slides
add_action('soliloquy_before_image_meta_link', 'mdk_get_soliloquy_metaboxes', 10, 3);
function mdk_get_soliloquy_metaboxes($id, $data, $post_id) {
if (! empty( $data["mdkcustomfield"] )) {
$mdkcustomfield = esc_attr( $data["mdkcustomfield"] );
} else {
$mdkcustomfield = "";
}
@mkokes
mkokes / color-button.css
Created January 7, 2016 17:53 — forked from studiopress/color-button.css
Colored Content Boxes
/* Color Buttons
------------------------------------------------------------ */
.button-blue,
.button-gray,
.button-green,
.button-purple,
.button-red,
.button-yellow {
color: #fff;
@mkokes
mkokes / GetURLParameter.js
Last active December 31, 2015 20:09
Get the URL parameters from a URL using jQuery
//Parse parameters in URL
function getURLParameter(sParam)
{
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam)
{
@mkokes
mkokes / Spark-DHT22.pde
Created December 27, 2015 21:38 — forked from wgbartley/Spark-DHT22.pde
Class for reading DHT22 values on a Spark Core
#define MAXTIMINGS 85
#define cli noInterrupts
#define sei interrupts
#define DHT11 11
#define DHT22 22
#define DHT21 21
#define AM2301 21