Skip to content

Instantly share code, notes, and snippets.

View jonsamwell's full-sized avatar

Jon Samwell jonsamwell

  • Australia
View GitHub Profile
@jonsamwell
jonsamwell / IE8 Logger
Created July 6, 2013 07:45
Added console support to older browsers (IE8 / 9)
(function (window, Function, $, YourNamespace) {
"use strict";
if (Function.prototype.bind && typeof console == "object" && typeof console.log == "object") {
var logFns = ["log", "info", "warn", "error", "assert", "dir", "clear", "profile", "profileEnd"];
$.each(logFns, function (i, method) {
console[method] = Function.prototype.call.bind(console[method], console);
});
}
@jonsamwell
jonsamwell / handlerbars-momentjs-helpers.js
Created June 4, 2013 20:03
A couple of simple Handlebar helpers to format dates using Moment.js
(function (Handlebars, moment) {
"use strict";
/**
* Format an ISO date using Moment.js
* http://momentjs.com/
* moment syntax example: moment(Date("2013-03-30T19:45:23")).format("MMMM YYYY")
* usage: {{dateFormat somedate format="MMMM YYYY"}}
*/
Handlebars.registerHelper('dateFormat', function (context, block) {