Skip to content

Instantly share code, notes, and snippets.

View getsource's full-sized avatar

Kira Schroder getsource

View GitHub Profile
@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.
@nacin
nacin / gist:2323060
Created April 6, 2012 21:23
Nacin's SVN override
# SVN override to prevent commits that try to implicitly commit more than one file.
# Has weaned me off of svn ci -m very effectively. I now almost always use svn ci,
# which usually results in me writing longer and more helpful commit messages.
# Also, it prevents me from committing unrelated code, so there's that.
#
# Also checks for error_log, var_dump, and console.log, and rejects these commits.
function svn() {
if [ "$1" == "ci" ] && [ "$2" == "-m" ] && [ -z "$4" ] && [ "$(svn stat --ignore-externals | grep '^[^?X]' | wc -l | awk '{print $1}')" -gt 1 ]; then
svn stat --ignore-externals | grep '^[^?X]'
@i3inary
i3inary / wp_install_default.sh
Created April 3, 2012 22:55
Default Install Script for WordPress Setup on MAMP localhost
#!/bin/bash
##############################
# DEFAULT WORDPRESS AND PLUGIN INSTALL SCRIPT
#
# 2012-04-03
# 1.0
# TODO: PUT A YES/NO PROMPT BEFORE RUNNING SCRIPT
#!!!!! EXITS UNLESS YOU MANUALLY COMMENT OUT THE LINE BELOW
exit
@kovshenin
kovshenin / image-shortcode.php
Created March 6, 2012 06:41
Image shortcode for WordPress
<?php
/**
* Image shortcode callback
*
* Enables the [kovshenin_image] shortcode, pseudo-TimThumb but creates resized and cropped image files
* from existing media library entries. Usage:
* [kovshenin_image src="http://example.org/wp-content/uploads/2012/03/image.png" width="100" height="100"]
*
* @uses image_make_intermediate_size
*/
@tott
tott / export.php
Created December 20, 2011 13:21
Exporter for WP_CLI
<?php
WP_CLI::addCommand('export', 'ExportCommand');
/**
* Implement export command
*
* @package wp-cli
* @subpackage commands/internals
*/
@boogah
boogah / WP_Bag_of_Tricks.txt
Created April 30, 2010 00:51
Things I've learned by being a WordPress nerd.
WP Bag of Tricks
1. Helpful Scripts/Plugins:
Hacks:
http://wordpress.org/extend/plugins/tac/
http://wordpress.org/extend/plugins/exploit-scanner/ (Can be extremely resource intensive.)
http://wordpress.org/extend/plugins/wp-malwatch/