Skip to content

Instantly share code, notes, and snippets.

View stevenberggists's full-sized avatar

stevenberggists

View GitHub Profile
@stevenberggists
stevenberggists / gist:3925373
Created October 21, 2012 01:08
JavaScript: jQuery PubSub
(function($) {
var o = $({});
$.each({
on: 'subscribe',
trigger: 'publish',
off: 'unsubscribe'
}, function(key, api) {
$[api] = function() {
o[key].apply(o, arguments);
@stevenberggists
stevenberggists / gist:3925370
Created October 21, 2012 01:06
CSS: Image Replacement
.ir {
border :0;
font: 0/0 a;
text-shadow: none;
color: transparent;
background-color: transparent;
}
@stevenberggists
stevenberggists / gist:3925369
Created October 21, 2012 01:05
JavaScript: PubSub
// Works in modern browsers + IE9, but Modernizr has a polyfill baked in for
// function.bind.
// Via Paul Irish
var o = $({});
$.subscribe = o.on.bind(o);
$.unsubscribe = o.off.bind(o);
$.publish = o.trigger.bind(o);
@stevenberggists
stevenberggists / gist:3925360
Created October 21, 2012 01:00
HTML: Starting Template
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="jquery.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>