Skip to content

Instantly share code, notes, and snippets.

View trepmal's full-sized avatar
🍪

Kailey Lampert trepmal

🍪
View GitHub Profile
<?php
if ( ! defined( 'WP_CLI' ) ) return;
/**
* Media Fix
*/
class Media_Fix extends WP_CLI_Command {
/**
@trepmal
trepmal / readme.md
Last active March 8, 2016 19:56
Show selected hosts

screenshot

<?php
/**
* HyperDB configuration file
*
* This file should be installed at ABSPATH/db-config.php
*
* $wpdb is an instance of the hyperdb class which extends the wpdb class.
*
* Fully documented config file:
* http://plugins.svn.wordpress.org/hyperdb/trunk/db-config.php
<?php
if ( ! defined( 'WP_CLI' ) ) return;
/**
* Media Fix
*/
class Media_Fix extends WP_CLI_Command {
/**
#!/bin/bash
ARGS=$(getopt -o a:b -l "ay:,bee:,dry-run" -n "cli.sh" -- "$@");
eval set -- "$ARGS";
while (("$#")); do
case "$1" in
-a|--ay)
shift;
if [ -n "$1" ]; then
<?php
/**
* Plugin Name: Robots Crawl Delay
*/
function prefix_robots_crawl_delay( $output, $public ) {
$output .= "Crawl-delay: 8\n";
return $output;
}
add_filter( 'robots_txt', 'prefix_robots_crawl_delay', 10, 2 );
#!/usr/bin/php
<?php
/**
* This works for the following nginx configuration:
*
* fastcgi_cache_path [..] levels=1:2 [..];
* fastcgi_cache_key "$scheme://$host$request_uri";
*
* Make this file executable
* `chmod +x /path/to/this/file`
<?php
$basic_rewrite = new Basic_Rewrite();
class Basic_Rewrite {
function __construct() {
add_action( 'wp_loaded', array( $this, 'wp_loaded' ) );
add_filter( 'rewrite_rules_array', array( $this, 'rewrite_rules_array' ) );
add_filter( 'query_vars', array( $this, 'query_vars' ) );
add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ) );
@trepmal
trepmal / find-new-files.sh
Created January 6, 2015 21:18
regularly look for newly modified files, notify hipchat room on discovery
#!/bin/sh
#
# ./find-new-files [path(.)] [minutes(360)]
#
if [ -z $1 ]
then
dir='.'
else
dir=$1
@trepmal
trepmal / verify-checksums.sh
Last active August 29, 2015 14:12
use wp-cli to verify core integrity, notify hipchat room on failure
#!/bin/sh
#
# cron ex:
# */15 * * * * cd /var/www/html/wordpress; verify-checksums
#
from='Alert'
room_id='HipChat Room Name/ID'
api_key='HipChat API Key'