Skip to content

Instantly share code, notes, and snippets.

View tripflex's full-sized avatar
🦋
in the zone

Myles McNamara tripflex

🦋
in the zone
View GitHub Profile
@tripflex
tripflex / gist:15159cb1d67b3930e99c
Created July 15, 2014 15:19
Jobify TGMPA Bug Fix, replace the contents of /inc/tgmpa/class-tgm-plugin-activation.php with the code below
<?php
/**
* Plugin installation and activation for WordPress themes.
*
* @package TGM-Plugin-Activation
* @version 2.4.0
* @author Thomas Griffin <thomasgriffinmedia.com>
* @author Gary Jones <gamajo.com>
* @copyright Copyright (c) 2012, Thomas Griffin
* @license http://opensource.org/licenses/gpl-2.0.php GPL v2 or later
SecRequestBodyAccess On
SecResponseBodyAccess On
SecResponseBodyLimitAction ProcessPartial
SecResponseBodyMimeType text/xml
<FilesMatch "xmlrpc.php">
# Block brute force attempts using xmlrpc.php as the vector
# Increment our counter when the xmlrpc API indicates a failure
SecRule REQUEST_BODY "wp\.getUsersBlogs" "id:13504,deny,chain,status:406,\
phase:4,t:none,t:urlDecode,chain,deny,\
@tripflex
tripflex / gist:e964bd36a6d95341859e
Created October 22, 2014 23:28
bash/shell progress function
process_progress() {
[ -z $1 ] && exit 0
PROGRESS=(". " " .. " " ... " " .. " " ." " .. " " ... " " .. ")
COUNTER=0
echo -n "$2 "
while `ps -p $1 > /dev/null`; do
[ $COUNTER -eq 8 ] && COUNTER=0
echo -n "${PROGRESS[$COUNTER]}"
echo -n " Running "
sleep 0.5
$interests = get_resume_field( 'careers_interest' );
if ( ! empty( $interests ) ) {
if ( is_array( $interests ) ) {
foreach ( $interests as $selected_value ) {
$tax = get_term_by( 'id', (int) $selected_value, 'careers_interest' );
echo "<li>" . $tax->name . "</li>";
}
} else {
/**
* Submit Step
*/
public static function submit() {
global $job_manager, $post;
self::init_fields();
// Load data if neccessary
if ( ! empty( $_POST['edit_resume'] ) && self::$resume_id ) {
$fromEmail = "Server <server@mydomain.com>"
$smtpServer = "10.10.10.10"
$subject = "Random Subject"
$body = "Random Body"
$emailTo = "Myles <myles@myles.com>", "Bill <bill@bill.com>", "John <john@john.com>"
send-mailmessage -to $emailTo -from "$fromEmail" -subject "$subject" -body "$body" -smtpServer "$smtpServer" -BodyAsHtml
@tripflex
tripflex / confToHashTable.ps1
Last active August 29, 2015 14:09
Powershell RegEx to Hash Table Key->Value pairs
$configData = "system_date='2014/11/13'
system_time='14:40:15'
system_ntp='192.168.150.48'
system_daylight_enable='1'
system_updateinterval='3600'
"
$regex = [regex]("(\w+)(?=='(.*)')")
@tripflex
tripflex / array_column_recursive.php
Last active June 17, 2021 13:07
PHP customized array_column function for recursion, named array_column_recursive
<?php
if ( ! function_exists( 'array_column_recursive' ) ) {
/**
* Returns the values recursively from columns of the input array, identified by
* the $columnKey.
*
* Optionally, you may provide an $indexKey to index the values in the returned
* array by the values from the $indexKey column in the input array.
*
* @param array $input A multi-dimensional array (record set) from which to pull
@tripflex
tripflex / date.min.js
Created December 2, 2014 20:03
date picker select from any dates
jQuery(function(a){a(".jmfe-date-picker").each(function(){a(this).datepicker({dateFormat:jmfe_date_field.date_format,monthNames:jmfe_date_field.monthNames,monthNamesShort:jmfe_date_field.monthNamesShort,dayNames:jmfe_date_field.dayNames,dayNamesShort:jmfe_date_field.dayNamesShort,dayNamesMin:jmfe_date_field.dayNamesMin})})});