Skip to content

Instantly share code, notes, and snippets.

@clemdev
clemdev / gist:2001566
Created March 8, 2012 15:42
HTML: Starting template
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link rel="stylesheet" href="./css/reset.min.css" />
<link rel="stylesheet" href="./css/main.css" />
</head>
<body>
@clemdev
clemdev / gist:2001600
Created March 8, 2012 15:48
Javascript: Sexy PubSub
// Works in modern browsers + IE9, but Modernizr has a polyfill baked in for function.bind.
// Hat tip Paul Irish
var o = $( {} );
$.subscribe = o.on.bind(o);
$.unsubscribe = o.off.bind(o);
$.publish = o.trigger.bind(o);
@clemdev
clemdev / gist:2001608
Created March 8, 2012 15:49
CSS: Image replacement
.ir { border: 0; font: 0/0 a; text-shadow: none; color: transparent; background-color: transparent; }
@clemdev
clemdev / gist:2001617
Created March 8, 2012 15:51
Javascript: jQuery PubSub
(function($)
{
var o = $( {} );
$.each({ on: 'subscribe', trigger: 'publish', off: 'unsubscribe' }, function(key, api)
{
$[api] = function(){ o[key].apply(o, arguments); }
});
})(jQuery);
@clemdev
clemdev / gist:2001626
Created March 8, 2012 15:52 — forked from padolsey/gist:527683
Javascript: Detect IE
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}