Skip to content

Instantly share code, notes, and snippets.

@ksdSnippets
ksdSnippets / gist:3854252
Created October 8, 2012 19:00
CSS: Image Replacement
.ir {
border:0;
font: 0/0 a;
text-shadow: none;
color: transparent;
background-color: transparent;
}
@ksdSnippets
ksdSnippets / gist:3903624
Created October 17, 2012 03:55
CSS: Image Replacement #2
.ir {
display: block;
text-indent: -999em;
overflow: hidden;
background-repeat: no-repeat;
text-align: left;
direction: ltr;
}
@ksdSnippets
ksdSnippets / TBS starter index.html
Created October 30, 2012 07:08
TBS: starter index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bootstrap, from Twitter</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le styles -->
@ksdSnippets
ksdSnippets / gist:3983130
Created October 30, 2012 21:19
HTML: Starting Template
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title></title>
<link rel="stylesheet" href="style.css">
</head>
<body>
@ksdSnippets
ksdSnippets / gist:3983184
Created October 30, 2012 21:26
JS: Modern PubSub
//Works in modern browsers + IE9, but Modernizr has a polyfill baked in for function.bind
var o = $( {} );
$.subscribe = o.on.bind(o);
$.unsubscribe = o.off.bind(o);
$.publish = o.trigger.bind(o);
@ksdSnippets
ksdSnippets / gist:3983200
Created October 30, 2012 21:30
jQuery: PubSub
(function($) {
var o = $( {} );
$.each({
on: 'subscribe',
trigger: 'publish',
off: 'unsubscribe'
}, function( key, api ) {
$[api] = function() {
o[key].apply( o, arguments );
@ksdSnippets
ksdSnippets / gist:3998055
Created November 2, 2012 01:24
WP PHP: Show Template File Path on Front End
//add to functions.php
add_action('wp_head', 'show_template');
function show_template() {
global $template;
echo '<span style="color: #000;">' . $template . '</span>';
}
@ksdSnippets
ksdSnippets / gist:4171757
Created November 29, 2012 20:39
GA code
<script>
var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview']];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
s.parentNode.insertBefore(g,s)}(document,'script'));
</script>
@ksdSnippets
ksdSnippets / gist:4450208
Created January 4, 2013 05:38
JS: load 3rd party script
$.ajax({
url: '//third-party.com/resource.js',
dataType: 'script',
cache: true, // otherwise will get fresh copy every page load
success: function() {
// script loaded, do stuff!
}
}
@ksdSnippets
ksdSnippets / gist:4632144
Created January 25, 2013 06:08
WP: WP_Query boilerplate
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; //this line only needed for pagination
$args = array(
'cat' => 7,
'paged' => $paged //this line only needed for pagination
);
// The Query
$the_query = new WP_Query( $args );
// The Loop