Skip to content

Instantly share code, notes, and snippets.

View peterwilsoncc's full-sized avatar

Peter Wilson peterwilsoncc

View GitHub Profile
@peterwilsoncc
peterwilsoncc / index.html
Created May 19, 2011 14:58
320&up pull request 2 test case
<!DOCTYPE html>
<!--
320 and Up boilerplate extension
Author: Andy Clarke
Version: 0.9b
URL: http://stuffandnonsense.co.uk/projects/320andup
-->
<!--[if IEMobile 7 ]><html class="no-js iem7" manifest="default.appcache?v=1"><![endif]-->
@peterwilsoncc
peterwilsoncc / index.html
Created May 20, 2011 03:17
320&up pull request 2 test case
<!DOCTYPE html>
<!--
320 and Up boilerplate extension
Author: Andy Clarke
Version: 0.9b
URL: http://stuffandnonsense.co.uk/projects/320andup
-->
<!--[if lt IE 7 ]><html class="no-js ie6" lang="en"><![endif]-->
@peterwilsoncc
peterwilsoncc / gist:1083991
Created July 15, 2011 03:19
Excessively long jQuery selector
var $maps = $('a[href^="http://maps.google.com.au/maps?"]:has(img[src^="http://maps.google.com/maps/api/staticmap?"]),img[src^="http://maps.google.com/maps/api/staticmap?"]:not(a[href^="http://maps.google.com.au/maps?"] img)');
@peterwilsoncc
peterwilsoncc / link.css
Created July 15, 2011 14:12
Default link styles
@peterwilsoncc
peterwilsoncc / gradient.less
Created September 21, 2011 02:04
conditional values in LESS CSS
.gradient(@start: #dddddd, @end: #ffffff, @background: 'set to start') {
//awful code - less can't access outer scope
@s: @start;
@b: @background;
background-color: ~`(this.b.toJS() == "'set to start'")?this.s.toJS():this.b.toJS()`;
background-image: -moz-linear-gradient(top, @start, @end);
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, @start),color-stop(1, @end));
background-image: linear-gradient(top, @start, @end);
filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorStr='%d', EndColorStr='%d')", @start, @end));
@peterwilsoncc
peterwilsoncc / functions.php
Created October 12, 2011 23:15
Conditional commented JavaScript in WordPress
<?php
function mytheme_html5shiv() {
$result = "";
$result .= '<!--[if lt IE 9]>';
$result .= '<script src="';
$result .= $parent['js'];
$result .= '/html5shiv.js"></script>';
$result .= '<![endif]-->' . "\n";
echo $result;
}
@peterwilsoncc
peterwilsoncc / class-metabox.diff
Created October 13, 2011 01:17
Bugfix WP SEO
--- class-metabox.php (saved version)
+++ (current document)
@@ -514,6 +514,7 @@
public function enqueue() {
$color = get_user_meta( get_current_user_id(), 'admin_color', true );
+ if ($color == '') $color = 'fresh';
wp_enqueue_style( 'metabox-tabs', WPSEO_URL.'css/metabox-tabs.css', WPSEO_VERSION );
wp_enqueue_style( "metabox-$color", WPSEO_URL.'css/metabox-'.$color.'.css', WPSEO_VERSION );
@peterwilsoncc
peterwilsoncc / index.php
Created October 17, 2011 03:51
WordPress - output page title on is_home() when displaying news on a sub page
<?php
if ( (is_home()) && (get_option('show_on_front') == 'page') && (get_option('page_for_posts') != 0) ) {
echo '<h1>' . esc_html(get_the_title(get_option('page_for_posts'))) . '</h1>';
}
?>
@peterwilsoncc
peterwilsoncc / 320up.less
Created November 29, 2011 23:53
“Mobile first” CSS and getting LESS to help with legacy IE
.320up(){
.three20 {
color: #fff;
}
} /* end 320up mixin */
/*
@peterwilsoncc
peterwilsoncc / index.html
Created December 12, 2011 04:22
"Responsive" lightbox -- requires jQuery & fancybox
<html>
<head>
<title>blah</title>
</head>
<body>
<header> ... </header>
<section>... </section>
<footer> ... </footer>