Skip to content

Instantly share code, notes, and snippets.

View timnovinger's full-sized avatar

Tim Novinger timnovinger

View GitHub Profile
@mnmldave
mnmldave / reverse-nav-menu.php
Created October 17, 2011 03:59
Reverse wordpress nav menu
/**
* Enables a 'reverse' option for wp_nav_menu to reverse the order of menu
* items. Usage:
*
* wp_nav_menu(array('reverse' => TRUE, ...));
*/
function my_reverse_nav_menu($menu, $args) {
if (isset($args->reverse) && $args->reverse) {
return array_reverse($menu);
}
@mattyoho
mattyoho / ios-test.css
Created October 19, 2011 19:12 — forked from tonywok/ios-test.css
iOS Media Queries
// iOS Media Queries
// Goal: capture styles for iPhone, iPhone 3G, iPhone 3GS, iPhone 4, iPhone 4S, iPad, and iPad 2
//
// Author: Tony Schneider (@tonywok)
// Please tell me where I fail. :)
// iPhone v(4,4S) portrait
// test: black text (overwritten by v* portrait) with blue background
@media all and (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait) {
a {
@timnovinger
timnovinger / jquery.modernizr.placeholder.js
Last active September 27, 2015 16:48
ColorJar: Add HTML5 input placeholder support to older browsers only when HTML5 not supported
// ------------------------------
// Form Input Placeholder
// ------------------------------
if (!Modernizr.input.placeholder)
{
$('input[placeholder], textarea[placeholder]').each(function(i, input){
var $input = $(input);
// Initially load the placeholder value
if ($input.val() === '') { $input.val($input.attr('placeholder')); }
@timnovinger
timnovinger / neat_trim.php
Created November 10, 2011 06:32
ColorJar: PHP neat_trim()
function neat_trim($str, $n, $delim='...') {
$len = strlen($str);
if ($len > $n) {
preg_match('/(.{' . $n . '}.*?)\b/', $str, $matches);
return rtrim($matches[1]) . $delim;
}
else {
return $str;
}
}
@timnovinger
timnovinger / jquery.external_links.js
Created November 18, 2011 03:12
ColorJar: Force all external links to open in a new page
@timnovinger
timnovinger / jquery.navigable_collapsed_list.js
Created November 23, 2011 17:14
Colorjar: Navigable collapsed list of posts
/*
*
* Navigable collapsed list of posts
* Author: Tim Novinger
* Email: tim@colorjar.com
* #colorjar
*/
// ---------------------------------
// PREV/NEXT Content Navigation
@timnovinger
timnovinger / .gitconfig
Created December 2, 2011 07:55
Git config settings
[alias]
s = status
st = stash
c = commit
ca = commit -a
a = add
rma = rm $(git ls-files --deleted)
b = branch
m = merge
f = fetch
@timnovinger
timnovinger / disable-plugins-when-doing-local-dev.php
Created December 12, 2011 14:47 — forked from markjaquith/disable-plugins-when-doing-local-dev.php
Disables specified WordPress plugins when doing local development
<?php
/*
Plugin Name: Disable plugins when doing local dev
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
@timnovinger
timnovinger / get_custom_field.php
Created December 15, 2011 19:35
Colorjar: Get custom field in WP
function custom_field($key) { echo get_custom_field($key); }
function get_custom_field($key, $echo = FALSE)
{
global $post;
$custom_field = get_post_meta($post->ID, $key, true);
if ($echo == FALSE) { return $custom_field; }
echo $custom_field;
}
@timnovinger
timnovinger / image_ptag_remover.php
Created February 16, 2012 16:19
WordPress Image P tag remover plugin
<?php
/*
Plugin Name: Image P tag remover
Description: Plugin to remove p tags from around images and iframes in content outputting, after WP autop filter has added them. (oh the irony)
Version: 1.1
Author: Fublo Ltd
Author URI: http://blog.fublo.net/2011/05/wordpress-p-tag-removal/
*/
function filter_ptags_on_images($content)