Skip to content

Instantly share code, notes, and snippets.

View mikeschinkel's full-sized avatar

Mike Schinkel mikeschinkel

View GitHub Profile
@mikeschinkel
mikeschinkel / TCB_JSON_API.php
Created November 2, 2011 16:44
Creates JSON class for Tom C. Barret to load tickets via a RESTful API
<?php
/**
* Creates JSON class for Tom C. Barrett to load tickets via a RESTful API:
*
* @example:
*
* URL: http://example.com/api/ticket/12345
*
* @see:
*
@mikeschinkel
mikeschinkel / parks-and-features.php
Created November 5, 2011 23:16
Plugin demonstrates how to route parent post/child post URLs WordPress 3.3
<?php
/**
* Plugin Name: MMC Parks and Features
* Description: This plugin demonstrates how to route parent/child URLs like http://example.com/parks/yosemite/half-dome/in WordPress 3.3
* Author: Mike Schinkel
* Author URL: http://about.me/mikeschinkel
* Notes:
* To answer http://lists.automattic.com/pipermail/wp-hackers/2011-November/041486.html
* Assumes a metabox that sets $post->post_parent field for a park feature with it's park's $post->ID.
*
@mikeschinkel
mikeschinkel / suppress-test.php
Created November 18, 2011 00:20
Testing suppression of error using @sign
<?php
/*
TESTING:
http://programmers.stackexchange.com/questions/120378/is-error-suppression-acceptable-in-role-of-logic-mechanism/120386#120386
Elapsed Time[µseconds]
Check, Exists :
50000 - Check, Exists : 94718 (user), 342 (system)
EACH - Check, Exists : 1.89436E-6 (user), 6.84E-9 (system)
@mikeschinkel
mikeschinkel / the-lone-cuber.php
Created November 21, 2011 05:00
Sample WordPress Plugin for @TheLoneCuber
<?php
/*
* Plugin Name: The Lone Cuber
*/
add_filter( 'wp_title', 'thelonecuber_wp_title', 10, 3 );
function thelonecuber_wp_title( $title, $sep, $seplocation ) {
return "THE LONE CUBER STRIKES AGAIN, MUHAHAHAHAH! - {$title}";
}
@mikeschinkel
mikeschinkel / Sunrise_for_WordPress.xml
Created December 1, 2011 23:50
Sunrise for WordPress Coding Standards for PhpStorm
<?xml version="1.0" encoding="UTF-8"?>
<code_scheme name="Sunrise for WordPress">
<option name="USE_SAME_INDENTS" value="true" />
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="false" />
@mikeschinkel
mikeschinkel / root-based-category-urls.php
Created December 2, 2011 01:28
Enabled Root-based Category URLs in WordPress (Any bugs? Post comments below.)
<?php
/*
* Plugin Name: Root-based Category URLs
* Description: Enables root-based Category URLs, i.e. Makes /category/my-category/ URLs route as /my-category/
* Author: Mike Schinkel
* Author URI: http://about.me/mikeschinkel
* Plugin URI: https://gist.github.com/1421235
* Version: 0.1.1
* License: GPL 2+
*/
@mikeschinkel
mikeschinkel / gist:1445728
Created December 8, 2011 01:48
WordPress URL $rewrite Array
Array
(
[category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?category_name=$matches[1]&feed=$matches[2]
[category/(.+?)/(feed|rdf|rss|rss2|atom)/?$] => index.php?category_name=$matches[1]&feed=$matches[2]
[category/(.+?)/page/?([0-9]{1,})/?$] => index.php?category_name=$matches[1]&paged=$matches[2]
[category/(.+?)/?$] => index.php?category_name=$matches[1]
[tag/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?tag=$matches[1]&feed=$matches[2]
[tag/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?tag=$matches[1]&feed=$matches[2]
[tag/([^/]+)/page/?([0-9]{1,})/?$] => index.php?tag=$matches[1]&paged=$matches[2]
[tag/([^/]+)/?$] => index.php?tag=$matches[1]
@mikeschinkel
mikeschinkel / jills_properties.php
Created December 13, 2011 03:20
Ad-hoc Plugin Example for Atlanta WordPress Developer Meetup - 2011-12-12
<?php
/*
* Plugin Name: Jill's Properties
* Description: Ad-hoc Plugin Example for Atlanta WordPress Developer Meetup - 2011-12-12
* Author: Mike Schinkel
* Author URI: http://about.me/mikeschinkel
* Version: 0.1
*/
class Jills_Properties {
static function on_load() {
@mikeschinkel
mikeschinkel / wordpress-vs-sunrise-way.php
Created December 21, 2011 00:50
Extending WordPress the WordPress Way vs. the Sunrise Way
<?php
/**
* This is a hypothetical example showing how to add two columns to a 'person' post type using
* WordPress' way vs. the a potential future Sunrise Way:
*/
/**
* Here is how you might do it in the WordPress way.
*/
@mikeschinkel
mikeschinkel / sunrise-admin-skins-usage.php
Created December 21, 2011 01:04
Example Code showing how to configure a WordPress admin menu using Sunrise Admin Skins.
<?php
/**
* Example Code showing how to configure a WordPress admin menu using Sunrise Admin Skins.
*
* This code would be put in a plugin or a theme's functions.php file.
*
* Screenshot: http://screenshots.newclarity.net/skitched-20111220-192421.png
*
*/