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 / functions.php
Last active September 7, 2018 15:05 — forked from davoraltman/redirectJD
Redirect to Job Dashboard after job submission when using WP Job Manager Field Editor
<?php
add_filter( 'submit_job_steps', 'replace_done_with_redirect' );
function replace_done_with_redirect( $steps ) {
$steps['done'] = array(
'priority' => 30,
'handler' => function() {
do_action( 'job_manager_job_submitted', WP_Job_Manager_Form_Submit_Job::instance()->get_job_id() );
if ( wp_redirect( job_manager_get_permalink( 'job_dashboard' ) ) ) {
@tripflex
tripflex / functions.php
Last active October 3, 2016 22:09
Automatically set/assign parent taxonomy terms for hierarchical taxonomies in WordPress (specifically WP Job Manager Job Listing Category)
<?php
add_action( 'set_object_terms', 'auto_set_parent_terms', 9999, 6 );
/**
* Automatically set/assign parent taxonomy terms to posts
*
* This function will automatically set parent taxonomy terms whenever terms are set on a post,
* with the option to configure specific post types, and/or taxonomies.
*
@tripflex
tripflex / WordPress.xml
Created February 24, 2016 20:16 — forked from Rarst/WordPress.xml
WordPress Live Templates for PhpStorm
<?xml version="1.0" encoding="UTF-8"?>
<templateSet group="WordPress">
<template name="aa" value="add_action( '$hook$', '$callback$' );&#10;$END$" description="add_action" toReformat="false" toShortenFQNames="true">
<variable name="hook" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="callback" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
@tripflex
tripflex / tunlr
Last active August 26, 2015 01:04 — forked from phiggins42/tunlr
tunlr!
#!/usr/bin/env node
/*
tunlr - simple SSH tunnel management
usage: tunlr [options] [command]
options:
-q quiet. suppress console output.
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 / autodj.bookmarklet.js
Created August 1, 2011 18:05 — forked from azoff/autodj.bookmarklet.js
Turntable.fm DJ Script
javascript:(function(g,d,f){if(f)d.info("Session found:",f);else return d.warn("No session found!");var h={check:10,wait:500},b=g.autodj={api:g[f],available:function(a){return b.api.taken_dj_map[a]<0},spot:function(){return b.api.become_dj.data("spot")},become:function(a){b.api.callback("become_dj",a)},waiter:function(a){return function(){return b.available(a)?(b.become(a),a):(d.info("Waiting..."),-1)}},seated:function(a){return b.api.djs[a]&&b.api.djs[a][0]===b.api.myuserid},wait:function(a,c){var e=c!==void 0,
a=a||h.check,c=c||b.spot();b.seated(c)?d.warn("Spot",c,"taken!"):(e&&d.error("Spot",c,"missed. Restarting..."),d.info("Polling @",a,"ms"),b.check(a,b.waiter(c)))},check:function(a,c){setTimeout(function(){var e=c.call(b);e>0?(d.warn("Spot",e,"open..."),setTimeout(function(){b.wait(a,e)},h.wait)):b.check(a,c)},a)}}})(window,console,function(g,d,f,h,b,a,c,e,i,j,k){try{return g(d)[f](h)[b][a][c][e]()[i](j)[k]}catch(l){return null}}(jQuery,".invite_dj","data","events","click",0,"handler","toString","match