Skip to content

Instantly share code, notes, and snippets.

View chrisvanpatten's full-sized avatar

Chris Van Patten chrisvanpatten

View GitHub Profile
<?php
/*
Plugin Name: Instrument Hooks for WordPress
Description: Instruments Hooks for a Page. Outputs during the Shutdown Hook.
Version: 0.1
Author: Mike Schinkel
Author URI: http://mikeschinkel.com
*/
if (isset($_GET['instrument']) && $_GET['instrument']=='hooks') {
@janfabry
janfabry / on-demand-resize.php
Created November 13, 2010 16:03
WordPress On-Demand image resizer plugin (first public attempt)
<?php
/*
Plugin Name: On-Demand image resizer
Plugin URI: http://www.monkeyman.be
Description: Create and store images in different sizes on demand
Version: 1.0
Author: Jan Fabry
This plugins monitors 404 requests to the uploads directory and created new images of a requested size. They are saved as new files in the upload directory, not cached somewhere, so future requests are served directly by the server. This allows you to eliminate the creation of intermediate image sizes [see monkeyman-virtual-intermediate-images] or resize images based on the size used in the editor [see monkeyman-resize-image-tags].
@janfabry
janfabry / resize-img-tags.php
Created November 13, 2010 16:04
WordPress Resize img tags plugin (first public attempt)
<?php
/*
Plugin Name: Resize img tags
Plugin URI: http://www.monkeyman.be
Description: Change image src's based on width and height specified in tag
Version: 0.1
Author: Jan Fabry
This plugin rewrites <img> tags so that the src contains width and height information. It is supposed to be used together with a plugin that can generate these resized images on the fly, like monkeyman-on-demand-resizer.
@janfabry
janfabry / virtual-intermediate-images.php
Created November 13, 2010 16:05
WordPress Virtual intermediate images plugin (first public attempt)
<?php
/*
Plugin Name: Virtual intermediate images
Plugin URI: http://www.monkeyman.be
Description: Prevent creation of actual intermediate image sizes
Version: 0.1
Author: Jan Fabry
This plugin prevents the creation of actual intermediate image sizes. It does, however, fill in all metadata attributes as if the intermediate sizes exist. It is designed to work together with a plugin that can create these images on the fly, like monkeyman-on-demand-resizer.
@marcgg
marcgg / gist:733592
Created December 8, 2010 17:26
Regex to get the Facebook Page ID from a given URL
# Matches patterns such as:
# https://www.facebook.com/my_page_id => my_page_id
# http://www.facebook.com/my_page_id => my_page_id
# http://www.facebook.com/#!/my_page_id => my_page_id
# http://www.facebook.com/pages/Paris-France/Vanity-Url/123456?v=app_555 => 123456
# http://www.facebook.com/pages/Vanity-Url/45678 => 45678
# http://www.facebook.com/#!/page_with_1_number => page_with_1_number
# http://www.facebook.com/bounce_page#!/pages/Vanity-Url/45678 => 45678
# http://www.facebook.com/bounce_page#!/my_page_id?v=app_166292090072334 => my_page_id
# http://www.facebook.com/my.page.is.great => my.page.is.great
@nacin
nacin / title-tag.php
Created August 29, 2011 19:19
Replacement for wp_title()?
<?php
// In a theme:
add_action( 'after_setup_theme', function() {
add_theme_support( 'title-tag', array( 'option' => true ) );
} );
// In core:
add_action( 'wp_head', '_wp_render_title_tag' );
function _wp_render_title_tag() {
@dshafik
dshafik / fuzzydate.php
Created September 20, 2011 15:04
Fuzzy Date Function
<?php
function fuzzyDate($date, $inputFormat = DateTime::ATOM, $outputDateFormat = "l, F dS, Y", $outputTimeFormat = "H:ia") {
if (!$inputFormat) {
$inputFormat = DateTime::ATOM;
}
if (!$outputDateFormat) {
$outputDateFormat = "l, F dS, Y";
}
<script src="LAB.js"></script>
<script>
// put whatever here, for your page's other scripts that you load with <script> tags.
$LAB.script("my_script1.js").script("my_script2.js").wait().script("my_script3.js");
window.fbAsyncInit = function() {
FB.init({appId: 'your app id', status: true, cookie: true,
xfbml: true});
};
@barraponto
barraponto / git-submodule-rm.sh
Created April 25, 2012 16:36
git submodule-rm
#!/bin/bash
function actual_path() {
if [ [ -z "$1" ] -a [ -d $1 ] ]; then
echo $(cd $1 && test `pwd` = `pwd -P`)
return 0
else
return 1
fi
}
@chrisvanpatten
chrisvanpatten / README.md
Created May 7, 2012 19:01
Awesome CSS3 buttons with Compass and Sass

Awesome CSS3 buttons with Compass and Sass

This is a mixin I built for quick CSS3 buttons on the new VanPattenMedia.com. It's designed to be very flexible, and has a lot of options so you can customize it quickly and easily.

Documentation

Defaults are in bold, if they exist.

@include vpm-button($background-color, $text-color, $state, $spread, $radius);