Skip to content

Instantly share code, notes, and snippets.

var Util = {
versionString: '0.12.0.1', // Change this manually each version, or (better) assign Util.versionString from config or build script
isOlderThan: function (thresholdVersionString) {
return (Util.versionStringToFloat(Util.versionString) < Util.versionStringToFloat(thresholdVersionString));
},
// Converts a string of form '1.4.2' to an easily comparable decimal number
// Assumes sub-enumeration cannot reach 1000
versionStringToFloat: function (versionString) {
var splitVersion = versionString.split('.'),
maxEnumeration = 1000;
@privman
privman / backbone-touch-click.js
Created May 21, 2012 17:39 — forked from gryzzly/backbone-touch-click.js
Backbone touch / click events
// WARNING: untested
// Override the default View.extend to automatically parse the events object upon class definition.
Backbone.View.originalExtend = Backbone.View.extend;
Backbone.View.extend = function (protoProps, classProps) {
var downEvent = "touchup" in window ? "touchup" : "click";
if (typeof(protoProps.events) === "object") {
// Replace the word "down" in the events hash with platform-specific event type
_.each(protoProps.events, function replaceDown(triggerString, functionName, events) {
var newTriggerStr = triggerStr.replace(/^down /, downEvent + ' ');