Skip to content

Instantly share code, notes, and snippets.

View implode_oxford.php
<?php
function implode_oxford(array $pieces)
{
$pieces = array_values($pieces);
switch (count($pieces)) {
case 0:
return '';
View press-this-new.js
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
WordPress: When a thumbnail image is requested of a specific width/height (rather than by name), generate it if it doesn't exist.
View generate-thumbnails.php
<?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 Oct 3, 2015
Wrap print_r in a 'pre' tag
View pre-debug.php
<?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 Feb 28, 2011
WordPress Custom Post Type Boilerplate (e.g. Videos)
View videos.php
<?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 Jun 18, 2010
Template .gitignore file for WordPress projects
View .gitignore
# 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
You can’t perform that action at this time.