Skip to content

Instantly share code, notes, and snippets.

View chrisvanpatten's full-sized avatar

Chris Van Patten chrisvanpatten

View GitHub Profile
@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.
@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});
};
@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 / _fonts.scss
Last active December 10, 2015 17:39
Fonts
/*
* Using Sass's @each loop to automatically generate code for web fonts
*/
$fonts: (vpm, font-awesome);
@each $font in $fonts {
@include font-face( $font,
font-files(
'#{$font}/#{$font}.woff',
@chrisguitarguy
chrisguitarguy / wpse54199.php
Created June 6, 2012 19:24
Per post type revisions
<?php
add_action('pre_post_update', 'wpse54199_pre_update', 1);
function wpse54199_pre_update($post_id)
{
if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
return;
if(get_post_type($post_id) == 'some_type')
{
remove_action('pre_post_update', 'wp_save_post_revision', 10);
@mcfarlan
mcfarlan / look-up-woo-deprecation.sh
Last active September 28, 2017 17:13
Looks for deprecated WooCommerce filters (v3.x.x)
#!/bin/bash
FUNCTIONS="
woocommerce_email_order_schema_markup,
add_to_cart_fragments,
add_to_cart_redirect,
woocommerce_product_width,
woocommerce_product_height,
woocommerce_product_length,
woocommerce_product_weight,
@mudge
mudge / gist:4111082
Created November 19, 2012 14:53
Capistrano task to use relative symlinks instead of absolute.
require "pathname"
namespace :deploy do
task :create_symlink, :except => { :no_release => true } do
deploy_to_pathname = Pathname.new(deploy_to)
on_rollback do
if previous_release
previous_release_pathname = Pathname.new(previous_release)
relative_previous_release = previous_release_pathname.relative_path_from(deploy_to_pathname)
@kingkool68
kingkool68 / pew-infinite-scroll.js
Last active January 4, 2018 21:27
Plugin for handling the URLs to make infinite scrolling work properly on pages like this http://www.pewresearch.org/category/publications/
jQuery(document).ready(function() {
//Set-up some constants.
var scrollTimeout;
var scrollUsePushStateInstead = false; //Set to true to make the history stack of the browser include every point when posts were loaded. It's kind of annoying.
var scrollDelay = 200; //Milliseconds
var scrollLoading = false;
var triggerOffset = $(document).height() - $('#pagination').siblings().eq(-4).offset().top; //The point of this is to do one calculation up front instead of multiple calculations every time the infinite scroll is triggered.
// Simple feature detection for History Management (borrowed from Modernizr)
function supportsHistory() {