Skip to content

Instantly share code, notes, and snippets.

View rgadon107's full-sized avatar

Robert Gadon rgadon107

  • St. Louis, MO USA
View GitHub Profile
@rgadon107
rgadon107 / code-challenge-7.js
Last active January 31, 2021 00:10
Solution to Code Challenge 7 from "Refactoring Tweaks Workbook"
/* Code Challenge 7, from “Refactoring Tweaks Workbook” by Tonya Mork ( 2016, LeanPub (https://leanpub.com/littlegreenbookofrefactoringtweaks-workbook) ). */
/***************************************************
*
* Original code to be refactored.
*
**************************************************/
window.PluginName = (function(window, document, $, undefined){
'use strict';
@rgadon107
rgadon107 / code-challenge-6.php
Created January 30, 2021 01:16
Solution to Code Challenge 6 from "Refactoring Tweaks Workbook"
/* Code Challenge 6, from “Refactoring Tweaks Workbook” by Tonya Mork ( 2016, LeanPub (https://leanpub.com/littlegreenbookofrefactoringtweaks-workbook) ). */
/***************************************************
*
* Original code to be refactored.
*
**************************************************/
/**
@rgadon107
rgadon107 / code-challenge-5.php
Created January 29, 2021 21:43
Solution to Code Challenge 5 from "Refactoring Tweaks Workbook"
/* Code Challenge 5, from “Refactoring Tweaks Workbook” by Tonya Mork ( 2016, LeanPub (https://leanpub.com/littlegreenbookofrefactoringtweaks-workbook) ). */
/***************************************************
*
* Original code to be refactored.
*
**************************************************/
class Session {
@rgadon107
rgadon107 / code-challenge-4.php
Last active January 29, 2021 21:45
Solution to Code Challenge 4 from "Refactoring Tweaks Workbook"
/* Code Challenge 4, from “Refactoring Tweaks Workbook” by Tonya Mork ( 2016, LeanPub (https://leanpub.com/littlegreenbookofrefactoringtweaks-workbook) ). */
/***************************************************
*
* Original code to be refactored.
*
**************************************************/
class Prefix_Shortcode_Course_Categories implements Prefix_Shortcode_Interface {
@rgadon107
rgadon107 / code-challenge-3.php
Last active January 27, 2021 21:52
Solution to Code Challenge 3 from "Refactoring Tweaks Workbook"
/* Code Challenge 3, from “Refactoring Tweaks Workbook” by Tonya Mork ( 2016, LeanPub (https://leanpub.com/littlegreenbookofrefactoringtweaks-workbook) ). */
/***************************************************
*
* Original code to be refactored.
*
**************************************************/
class Form {
@rgadon107
rgadon107 / code-challenge-2.php
Created January 27, 2021 02:03
Solution to Code Challenge 2 from "Refactoring Tweaks Workbook"
/* Code Challenge 2, from “Refactoring Tweaks Workbook” by Tonya Mork ( 2016, LeanPub (https://leanpub.com/littlegreenbookofrefactoringtweaks-workbook) ). */
/***************************************************
*
* Original code to be refactored.
*
**************************************************/
/* This function grabs the custom header from the current theme so that it can be displayed. */
@rgadon107
rgadon107 / code-challenge-1.php
Last active January 26, 2021 21:52
Solution to Code Challenge 1 from "Refactoring Tweaks Workbook"
// # Code Challenge 1, from “Refactoring Tweaks Workbook” by Tonya Mork ( 2016, LeanPub (https://leanpub.com/littlegreenbookofrefactoringtweaks-workbook) ).
// ## Original code to be refactored
/**
* Check if custom post type exists, to provide data
*/
function prefix_is_post_type( string $type, int $post_id ) {
global $wp_query;
if($type == get_post_type($wp_query->post->ID)) return true;
@rgadon107
rgadon107 / setup-phpunit.sh
Created March 30, 2020 06:19 — forked from keesiemeijer/setup-phpunit.sh
Setup PHPUnit for use in the Local by Flywheel app
#!/usr/bin/env bash
# ===============================================================================
# Script to install PHPUnit in the Local by Flywheel Mac app
# These packages are installed
#
# PHPUnit, curl wget, rsync, git, subversion and composer.
#
# WordPress is installed in the `/tmp/wordpress` directory for use by PHPUnit.
# The WordPress test suite is installed in the `/tmp/wordpress-tests-lib` directory.
@rgadon107
rgadon107 / single-event.php
Created August 19, 2018 03:41
Render an event venue when calling 'single-event.php'.
add_action( 'genesis_entry_header', __NAMESPACE__ . '\add_content_wrap_markup_open', 3 );
/*
* Add content wrap around Event entry_header & render post thumbnail on single.
*
* @since 1.0.0
*
* return void
*/
function add_content_wrap_markup_open() {
$event_id = (int) get_the_ID();
@rgadon107
rgadon107 / Set Cookie on Form Submit and Close
Created July 19, 2017 01:17
Custom function to pass in a jQuery script to set a cookie via manual JS during 'on_click' trigger event and on form close.