Skip to content

Instantly share code, notes, and snippets.

@kurtpayne
kurtpayne / cache.htaccess
Created June 13, 2012 00:10
.htaccess caching rules
<IfModule mod_mime.c>
# Text
AddType text/css .css
AddType application/x-javascript .js
AddType text/html .html .htm
AddType text/richtext .rtf .rtx
AddType text/plain .txt
AddType text/xml .xml
@kurtpayne
kurtpayne / phpl.sh
Last active April 8, 2019 01:17
WordPress Unit Tests Jenkins Config
#!/bin/bash
find $1 \( -type f -and \( -name "*.php" -or -name "*.inc" -or -name "*.phtml" \) \) -exec php -l {} \; | grep -v "No syntax errors"
@kurtpayne
kurtpayne / provision.sh
Created May 23, 2018 22:06
Install Netflix Conductor On Centos7
#!/bin/sh
# Install pre-reqs
yum -y update
yum -y install epel-release
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
yum -y install abuild ack autoconf automake binutils build-base bzip2 bzip2-devel curl docker docker-compose gcc gcc-c++ java-1.8.0-openjdk java-1.8.0-openjdk-devel libjpeg-turbo libjpeg-turbo-devel libpng libpng-devel libpng12 libpng12-devel libstdc++ libtool make nasm nodejs npm python strace tar unzip wget yarn yum-utils
# Install gradle
mkdir -p /opt/gradle
@kurtpayne
kurtpayne / keybase.md
Created December 2, 2017 07:17
keybase.md

Keybase proof

I hereby claim:

  • I am kurtpayne on github.
  • I am kpayne (https://keybase.io/kpayne) on keybase.
  • I have a public key ASBQryJbLLHpQoZX3m-GUoMVhZBbYd4YGatkPFU9KyfzmAo

To claim this, I am signing this object:

@kurtpayne
kurtpayne / p3-scanner.php
Created November 20, 2012 20:41
Customize P3's Auto Scan URLs
<?php
/*
Plugin Name: P3 Custom Scanner
Plugin URI: http://inside.godaddy.com/
Description: Customize the pages scanned by P3's auto scan mode
Author: GoDaddy.com
Version: 1.0
Author URI: http://www.godaddy.com/
*/
<?php
/**
* A very simple php code profiler. No extensions required.
*
* Example usage:
* <code>
* declare(ticks=1);
* require_once('./SimpleProfiler.class.php');
* SimpleProfiler::start_profile();
@kurtpayne
kurtpayne / rarst.php
Created December 3, 2013 15:00
Super subtle troll
<?php
/**
* Plugin Name: Rarst's favorite plugin
* Description: SHUT UP
* Version: INF
* Author: The unholy army of trolls
* License: GPLv2 or MIT (they're equivalent, right?)
*/
add_action( 'all', function() {
global $wp_filter;
{
"offers": [
{
"response": "upgrade",
"download": "https:\/\/wordpress.org\/wordpress-3.7.1.zip",
"locale": "en_US",
"packages": {
"full": "https:\/\/wordpress.org\/wordpress-3.7.1.zip",
"no_content": "https:\/\/wordpress.org\/wordpress-3.7.1-no-content.zip",
"new_bundled": "https:\/\/wordpress.org\/wordpress-3.7.1-new-bundled.zip",
@kurtpayne
kurtpayne / mysql_error_catcher.php
Last active December 20, 2015 15:28
First pass at catching rogue mysql_* calls in themes and plugins.
<?php
set_error_handler( function( $errno, $errstr, $errfile) {
if ( 'wp-db.php' !== basename( $errfile ) ) {
if ( preg_match( '/^(mysql_[a-zA-Z0-9_]+)/', $errstr, $matches ) ) {
_doing_it_wrong( $matches[1], 'Please talk to the database using $wpdb', '3.7' );
return apply_filters( 'wpdb_drivers_raw_mysql_call_trigger_error', true );
}
}
@kurtpayne
kurtpayne / cookies.php
Created February 6, 2013 17:39
WordPress and cURL cookies
<?php
// Create a cookie file
require_once ABSPATH . 'wp-admin/includes/file.php';
$cookie_file = wp_tempnam();
// Create a callback to let curl save cookies there
$cookie_saver = function( $ch ) use ( $cookie_file ) {
curl_setopt( $ch, CURLOPT_COOKIEJAR, $cookie_file );
curl_setopt( $ch, CURLOPT_COOKIEFILE, $cookie_file );