Skip to content

Instantly share code, notes, and snippets.

View chrisvanpatten's full-sized avatar

Chris Van Patten chrisvanpatten

View GitHub Profile
@chrisvanpatten
chrisvanpatten / jquery.fullscreenr.js
Created December 22, 2011 20:54
jQuery Fullscreenr
/**
* Fullscreenr - lightweight full screen background jquery plugin
* By Jan Schneiders
* www.nanotux.com
*
* Modifications by Chris Van Patten
* http://www.vanpattenmedia.com
* Version 1.5
**/
@chrisvanpatten
chrisvanpatten / plugin.php
Created March 3, 2012 19:32
admin_enqueue_scripts
<?php
/**
*
* admin_enqueue_scripts is the preferred hook[1] for adding style to the admin, but
* documentation is frankly sparse and a bit confusing, especially for beginners.
*
* This gist has everything you need to load style for a plugin directly to a hook
* of your choice. Enjoy!
*
@chrisvanpatten
chrisvanpatten / README.md
Created March 7, 2012 16:27
WordPress Admin Tabs

Huh?

Believe it or not, WordPress doesn't have a fully-fleshed out common tab style for plugins or theme authors to use in metaboxes.

The style exists for categories, but it hasn't been fully adapted for the half-complete wp-tab setup. Trac ticket #17959 has a solution that not only fleshes the style but it also adds a global JavaScript file to give the wp-tab HTML some action. Until that ticket is accepted into core, this Gist adapts that code so it's available to use independently in your theme or plugin.

How?

Just enqueue the CSS and JavaScript in the admin_enqueue_scripts script hook and drop the tab HTML in a metabox. It will automatically adapt to the normal and side column widths, much like category tabs.

@chrisvanpatten
chrisvanpatten / wp-config.php
Created March 26, 2012 01:32
WordPress staging
<?php
//...
$urlParts = explode('.', $_SERVER['HTTP_HOST']);
if ($urlParts[0] == 'staging') {
// Do some stuff if we're on staging
define('WB_DEBUG', true);
// I want to rewrite the site_url and home_url here
@chrisvanpatten
chrisvanpatten / title-tag.php
Created April 1, 2012 23:00 — forked from nacin/title-tag.php
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() {
@chrisvanpatten
chrisvanpatten / index.php
Created April 20, 2012 17:48
Rach5 index file
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<?php get_template_part('head'); ?>
<body <?php body_class(); ?>>
<?php get_header(); ?>
@chrisvanpatten
chrisvanpatten / base.php
Created April 27, 2012 13:50
base.php example
<?php $base = theme_template_base(); ?><!DOCTYPE html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<?php get_template_part('head'); ?>
<body <?php body_class(); ?>>
<div id="wrap">
<div id="content-top"></div>
@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);

@chrisvanpatten
chrisvanpatten / gitpushguide.md
Created May 13, 2012 00:39
Git push for website publication

This tutorial walks you through the process of setting up git so you can easily push to staging and production remotes.

Expectations

You should have a local development copy of your website (located anywhere) and staging and production websites in the same directory on your remove server; e.g. two directories named staging.website.com and website.com.

You can certainly locate them anywhere you want (just change the path to the remotes in step three) but I'm not planning for that in this guide.

Step one: initialization/setup

get '/login' do
openid_user = get_user(params[:token])
user = User.first_or_create(
:identifier => '123456',
:email => 'chris@vanpattenmedia.com',
:nickname => 'Chris',
:photo_url => 'http://blah.com/cvp'
)
end