Skip to content

Instantly share code, notes, and snippets.

<?php
function implode_oxford(array $pieces)
{
$pieces = array_values($pieces);
switch (count($pieces)) {
case 0:
return '';
var d=document,
w=window,
e=w.getSelection,
k=d.getSelection,
x=d.selection,
s=(e?e():(k)?k():(x?x.createRange().text:0)),
l=d.location,
e=encodeURIComponent,
metas=d.head.getElementsByTagName('meta'),
imgs=d.body.getElementsByTagName('img'),
@Viper007Bond
Viper007Bond / generate-thumbnails.php
Created May 25, 2012 02:33
WordPress: When a thumbnail image is requested of a specific width/height (rather than by name), generate it if it doesn't exist.
<?php /*
**************************************************************************
Plugin Name: Generate Thumbnails On The Fly
Description: When a thumbnail image is requested of a specific width/height (rather than by name), generate it if it doesn't exist.
Version: 1.0.0
Author: Alex Mills (Viper007Bond)
Author URI: http://www.viper007bond.com/
@norcross
norcross / pre-debug.php
Last active October 3, 2015 05:37
Wrap print_r in a 'pre' tag
<?php
function preprint($s, $return = false) {
$code = '<pre>';
$code .= print_r($s, 1);
$code .= '</pre>';
if ($return)
return $code;
else
print $code;
}
@davatron5000
davatron5000 / videos.php
Created February 28, 2011 23:06
WordPress Custom Post Type Boilerplate (e.g. Videos)
<?php
/*
Plugin Name: Videos
Plugin URI:
Author: Dave Rupert
Author URI: http://www.daverupert.com
Description: A custom post type that adds videos and custom taxonomies.
Version: 1.0
*/
@redoPop
redoPop / .gitignore
Created June 18, 2010 22:08
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your