Adam Hutchinson adjohu

View formvalidator.js
1 2 3 4 5 6 7 8 9 10
(function ($) {
 
/**
* Override console in this scope so we can squash errors.
*/
var con = window.console;
var console = {
log: function () {
con && con.log && con.log(Array.prototype.slice.call(arguments));
},
View simpleeditable.js
1 2 3 4 5 6 7 8 9 10
$(document).on("click", ".edit_trigger", function () {
var $trigger = $(this);
 
// Find linked editable
var editableID = $trigger.data("editable");
var $editable = $("#" + editableID);
 
// Replace editable with input.
var $input = $("<input>").val($editable.html().trim());
$editable
View models.js
1 2 3 4 5 6 7 8 9 10
var A = function (props) {
this.properties = props;
this.constructor.addModel(this);
};
 
A.models = [];
 
A.addModel = function (model) {
model.properties.id = this.models.length + 1;
this.models.push(model);
View createPoller.js
1 2 3 4 5 6 7 8 9 10
var createPoller = function (pollFunc, interval) {
var timeout;
 
var poll = function () {
pollFunc();
timeout = setTimeout(poll, interval);
};
 
return {
start: function () {
View createClass js
1 2 3 4 5 6 7 8 9 10
var createClass = function (methods, staticMethods) {
if (!methods || !methods.hasOwnProperty("init")) {
throw "you must include an init method";
}
var newClass = function () {
this.init();
};
$.extend(newClass.prototype, methods);
$.extend(newClass, staticMethods);
return newClass;
View gist:3913410
1 2 3 4 5 6 7 8 9 10
(function () {
var isObject = function (foo) {
return foo.constructor == Object;
};
 
var mixin = function (a, b) {
for (var property in b) {
if (b.hasOwnProperty(property)) {
if (isObject(b[property])) {
View gist:3913224
1 2 3 4 5 6 7 8 9 10
(withJQuery = function withJQuery() {
// Check for jQuery
if (!window.jQuery) {
return setTimeout(withJQuery, 100);
}
 
var getISODateFor = function (title) {
var selector = ".DtlDetailTbl td:contains('" + title + "') + .ResConfirmValue";
var date = new Date($(selector).text());
return date.toISOString();
View gist:3237325
1 2 3 4 5 6 7 8 9 10
var highest = 16777215;
var steps = 1000;
var step = highest / steps;
var emptyColor = "000000";
 
for (var i=0; i < steps; i++) {
var color = parseInt(step * i, 10).toString(16);
color = emptyColor.slice(0, -color.length) + color;
var span = document.createElement("span");
span.innerHTML = "a"
View gist:3170299
1 2 3 4 5 6 7 8 9 10
//var formContainer = $("#ctl00_ContentPlaceHolder1_ffnpPayBrasPag1_dvBPCC");
var findPrev = function (node, needle) {
var found = false;
do {
node = node.previousSibling;
var nv = node.nodeValue;
if (nv && nv.indexOf(needle) > -1) {
found = true;
}
} while (!found);
View gist:3033885
1 2 3 4 5 6 7 8 9 10
window._qbetc = [
{
clientId: "lowcostholidays",
domain: ".lowcostholidays.com",
experiments: [
{
id: "T004-property-results",
creatives: {
"creative1": {
activation: function () {},
Something went wrong with that request. Please try again.