Skip to content

Instantly share code, notes, and snippets.

Peter Wilson peterwilsoncc

Block or report user

Report or block peterwilsoncc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@peterwilsoncc
peterwilsoncc / index.html
Created May 19, 2011
320&up pull request 2 test case
View index.html
<!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
320&up pull request 2 test case
View index.html
<!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 Jul 15, 2011
Excessively long jQuery selector
View gist:1083991
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 Jul 15, 2011
Default link styles
View link.css
@peterwilsoncc
peterwilsoncc / gradient.less
Created Sep 21, 2011
conditional values in LESS CSS
View gradient.less
.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 Oct 12, 2011
Conditional commented JavaScript in WordPress
View functions.php
<?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;
}
View class-metabox.diff
--- 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 Oct 17, 2011
WordPress - output page title on is_home() when displaying news on a sub page
View index.php
<?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 Nov 29, 2011
“Mobile first” CSS and getting LESS to help with legacy IE
View 320up.less
.320up(){
.three20 {
color: #fff;
}
} /* end 320up mixin */
/*
@peterwilsoncc
peterwilsoncc / index.html
Created Dec 12, 2011
"Responsive" lightbox -- requires jQuery & fancybox
View index.html
<html>
<head>
<title>blah</title>
</head>
<body>
<header> ... </header>
<section>... </section>
<footer> ... </footer>
You can’t perform that action at this time.