Skip to content

Instantly share code, notes, and snippets.

View colegeissinger's full-sized avatar

Cole Geissinger colegeissinger

View GitHub Profile
@colegeissinger
colegeissinger / Fancy CSS3 Box Shadows with SCSS
Created February 7, 2013 09:03
Fancy CSS3 Box Shadows with SCSS. Requires SASS and Compass to be installed.
// Import some requiredness from compass
@import "compass/reset";
@import "compass/css3/box-shadow";
@import "compass/css3/transform";
// Define our mixin
@mixin fancy-box-shadow($color:rgba(0,0,0,.5), $left_shadow:-4deg, $right_shadow:4deg, $bottom:8px) {
position:relative;
background:#fff;
a:5:{i:0;O:8:"stdClass":5:{s:5:"title";s:50:"Install the standpipe and underground drain pipe.";s:5:"lines";a:2:{i:0;O:8:"stdClass":4:{s:4:"text";s:408:"My design uses a 2" ABS standpipe that runs down from the washer and connects to a gently sloping horizontal pipe buried under a garden path. At the other end, the water splits and travels a bit farther in 2 directions, then flows out through perforated pots and bark chip mulch, and into the soil beneath some water-loving plants and trees. The area to be watered was 40' away and 10' below the washer.";s:8:"text_raw";s:403:"My design uses a 2" ABS standpipe that runs down from the washer and connects to a gently sloping horizontal pipe buried under a garden path. At the other end, the water splits and travels a bit farther in 2 directions, then flows out through perforated pots and bark chip mulch, and into the soil beneath some water-loving plants and trees. The area to be watered was 40' away and 10' below the washer.";s:6:"bullet";s:5:"black";s:5:"lev
@colegeissinger
colegeissinger / script.js
Last active December 12, 2015 07:59
A response to @whyisjake about simplify some JavaScript in a Gist found here https://gist.github.com/whyisjake/4736577. View this on Codepen http://codepen.io/colegeissinger/pen/qdvGB
jQuery(document).ready(function(){
jQuery('#tabs li').click(function() {
id = $(this).attr('id');
//alert(id);
$('#steps div#js-' + id).slideDown();
$('#steps div:not(#js-' + id + ')').slideUp();
});
});
@colegeissinger
colegeissinger / wptuts-upload-3.5-ready.js
Last active April 2, 2018 14:32
Integrating the WP Media Uploader, version 3.5, Into Your Theme With jQuery. Based off the original tut found on http://wp.tutsplus.com/tutorials/creative-coding/integrating-the-wp-media-uploader-into-your-theme-with-jquery/ But updated to use the 3.5 Media Uploader. While I'm not the biggest JavaScript nerd out there, I understand enough to get…
(function($) {
$(function() {
$.fn.wptuts = function(options) {
var selector = $(this).selector; // Get the selector
// Set default options
var defaults = {
'preview' : '.preview-upload',
'text' : '.text-upload',
'button' : '.button-upload',
};
@colegeissinger
colegeissinger / gist:5146253
Created March 12, 2013 19:37
Use this to load the WP Bootstrap anywhere. Of course, if you aren't loading this into multiple scripts, just use the code inside the function and paste it directly into your PHP script.
function load_wp_bootstrap() {
// Traverse the directory back to the root of the WordPress install.
// Adding a dirname() will go back one directory (equivilent to ../).
$root = dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) );
// Load the WordPress Bootstrap
if ( file_exists( $root . '/wp-load.php' ) ) require_once( $root . '/wp-load.php' );
}
@colegeissinger
colegeissinger / import-csv-makerfaire.php
Last active December 17, 2015 03:09
Read a CSV file and export it to an importable XML file for WordPress. Code is setup to import "exhibits" for Maker Faire.
<?php
/**
* Allows us to convert CSV/Spread Sheets and generate an XML file for the import of WordPress.
*
* Save this file into the root of your WordPress install to run. Other wise, modify the file path for the wp-load.php.
*
* EG. Use this URL to generate the XML. Or use cURL to save the file.
* http://localhost/import-csv-makerfaire.php?file_name=BazBizMF13_Vendor-IMPORT.csv&url=http://localhost/imports/
* curl "http://localhost/import-csv-makerfaire.php?file_name=BazBizMF13_Vendor-IMPORT.csv&url=http://localhost/imports/" -o "makerfaire-exibit-import.xml"
function make_author_bio() {
global $post;
// Get our author meta
$author_id = $post->post_author;
$author = get_userdata( $author_id );
$url = 'http://en.gravatar.com/' . $author->data->user_login . '.json';
$contents = wpcom_vip_file_get_contents( $url );
//echo '<pre>'; print_r( $author ); echo '</pre>';
@colegeissinger
colegeissinger / wp-header-home-js.php
Last active December 18, 2015 11:38
Add JS to homepage of WordPress site
// Save your JavaScript to a file like mobile-redirect.js and we'll assume it's in a directory called "js" in your themes root
// Now use this code to add to your WordPress theme in your functions.php
function cg_add_custom_js_script() {
// more info on this function here http://codex.wordpress.org/Function_Reference/wp_enqueue_script
if ( is_home() || is_front_page() )
wp_enqueue_script( 'custom-js-id', get_stylesheet_directory_uri() . '/js/mobile-redirect.js' );
}
add_action( 'wp_enqueue_scripts', 'cg_add_custom_js_script' );
function make_post_statuses() {
global $wp_post_statuses;
foreach ( $wp_post_statuses as $status => $name ) {
if ( $status != 'trash' && $status != 'publish' && $status != 'auto-draft' )
$statuses[] = $status;
}
return $statuses;
}
@colegeissinger
colegeissinger / index.php
Last active December 21, 2015 20:39
An example of a small PHP script for a presentation I gave on August 28th, 2013 for WIMP (Web and Interactive Media Professionals) http://www.meetup.com/beawimp/events/130142102/
<?php
// Setup some static variables for us to use
$title = 'Our Simple PHP Page'; // We'll create a string for the title tag of the page
$year = 2013; // We'll also create a variable that will contain the year which is used in the footer
// We'll also create an array that holds multiple author information
// If we leave the array key's blank, that makes this an "indexed" array.
// Each key-pair will work on a base of 0 and count up (E.G. 0 => 'value', 1 => 'value 2')
$authors = array(
'Author 1',