Skip to content

Instantly share code, notes, and snippets.

View markjaquith's full-sized avatar

Mark Jaquith markjaquith

View GitHub Profile
@markjaquith
markjaquith / lists.php
Created December 7, 2011 21:18 — forked from trepmal/lists.php
WordPress: Testing bulleted and numbered lists
<?php
//Plugin Name: Bulleted Lists
new Bulleted_List();
class Bulleted_List {
function __construct() {
@markjaquith
markjaquith / no-howdy.php
Created December 25, 2011 04:16
Removes "Howdy" from the WordPress 3.3 toolbar
<?php
/*
Plugin Name: No Howdy
Description: Removes "Howdy, " from the toolbar
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
@markjaquith
markjaquith / login-logo-custom-css.php
Created January 15, 2012 01:30
Login form CSS customization
<?php
/*
Plugin Name: Login Logo Custom CSS
Description: Custom CSS for the login screen
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
@markjaquith
markjaquith / moderation-buddy.php
Created January 17, 2012 10:12
Moderation Buddy
<?php
/*
Plugin Name: Moderation Buddy
Description: A friendly assistent to make sure you don't get behind on your comment moderation tasks.
Version: 0.1
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
class CWS_Moderation_Buddy_Plugin {
@markjaquith
markjaquith / gist:1645537
Created January 20, 2012 05:44
CWS_Plugin — Exploratory WordPress plugin parent class
<?php
if ( !class_exists( 'CWS_Plugin_v2' ) ) :
class CWS_Plugin_v2 {
public function hook( $hook ) {
$priority = 10;
$method = $this->sanitize_method( $hook );
$args = func_get_args();
unset( $args[0] );
foreach ( (array) $args as $arg ) {
if ( is_int( $arg ) )
@markjaquith
markjaquith / .all
Last active October 10, 2018 15:38
Bash stuff
for f in ~/Dropbox/bash/*; do source $f; done
@markjaquith
markjaquith / gist:2312948
Last active March 13, 2017 20:32
How to get PHP Unit working for WordPress Unit Tests using MAMP Pro

WordPress Unit Tests using MAMP Pro

Note: Work in progress document.

Note: Change the PHP version number as appropriate to your MAMP Pro install.

  1. Add the following you your PATH, making sure that it is first: /Applications/MAMP/bin/php/php5\.3\.6/bin:/Applications/MAMP/bin/apache2/bin:/Applications/MAMP/bin
  2. mv /Applications/MAMP/bin/php/php5.3.6/conf/pear.conf /Applications/MAMP/bin/php/php5.3.6/conf/pear.conf.bak
  3. source ~/.profile (or where ever you made your PATH changes)
  4. sudo pear update-channels &amp;&amp; sudo pear upgrade pear
@markjaquith
markjaquith / gist:2628225
Last active March 29, 2023 23:30
Script to sync WordPress SVN to GitHub
#!/bin/bash
# cd into the directory
cd ~/gitsync/github-wordpress-sync/;
# Make sure we are not already running
if [ -f .sync-running ];then
if test ! `find ".sync-running" -mmin +10`;then
# Currently running, but not stuck
exit 1;
fi
fi;
@markjaquith
markjaquith / gist:2653957
Created May 10, 2012 15:36
WordPress Fragment Caching convenience wrapper
<?php
/*
Usage:
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL
if ( !$frag->output() ) { // NOTE, testing for a return of false
functions_that_do_stuff_live();
these_should_echo();
// IMPORTANT
$frag->store();
// YOU CANNOT FORGET THIS. If you do, the site will break.
@markjaquith
markjaquith / plugindiff.rb
Created July 13, 2012 22:15
Run this from a WordPress plugin SVN checkout to see what has changed in trunk vs your stable tag
#!/usr/bin/ruby
# NOTE: uses local diffs (MUCH faster). So make sure you've `svn up`d.
path = `svn info`[/Working Copy Root Path: (.*)\n/, 1]
stable_tag = nil
File.open path + '/trunk/readme.txt', 'r' do |file|
while line = file.gets
break if stable_tag = line[/stable tag: ?(.*)\n/i, 1]
end
end