This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function _debug() { | |
| var tm = "%c[" + (new Date()).toTimeString().split(/\s+/)[0] + "]", | |
| pre = "%c debug ", | |
| args = [].slice.call(arguments, 0), | |
| // styles for: timestamp, prefix, message | |
| styles = ["color: #4682b4", "color: #fff; background-color: #cd5c5c;", "color: #2f4f4f"], | |
| msg = tm + pre + "%c " + args.shift(); | |
| console.log.apply(console, [msg].concat(styles, args)); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // the template | |
| $template = "<h1>{TITLE}</h1>"; | |
| // add any template placeholder key/values here | |
| $map = array( | |
| 'TITLE' => "ExtJS Sucks" | |
| ); | |
| // Quick and dirty template parser, replace occurences of '{KEY}' with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var has_bind_native = Function.prototype.bind ? true : false; | |
| /** | |
| * An ES5 compaitible polyfill for Function.prototype.bind(thisArg, arg1, arg2, ...). Allows you to | |
| * rebind a function to a different this context. This is already available in browsers implementing | |
| * the ES5 standards. | |
| * | |
| * @param {Object} _context - the new object to bind this to in the function | |
| * @returns {Function} - the newly bound function | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| window.serializeFormJSON = function(f) { | |
| var json = {}, | |
| $f = f.jquery ? f : $(f); | |
| $('input.serialize, select.serialize, textarea.serialize', $f).each(function(index, node) { | |
| var keypath = $(this).attr('name').split('.'), | |
| key = keypath.pop(), | |
| item = json; | |
| for (var i=0, l=keypath.length; i < l; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Simple Data Component to handle authorization calls | |
| var Auth = flight.component(function() { | |
| this.defaultAttrs({ | |
| user: 'default' | |
| }); | |
| this.authenticate = function(ev, data) { | |
| console.log("[debug] calling authenticate"); | |
| $.ajax({ | |
| method: 'POST', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (!Array.isArray) { | |
| Array.isArray = function(a) { return Object.prototype.toString.call(a) == '[object Array]'; } | |
| } | |
| if (!Object.isObject) { | |
| Object.isObject = function(a) { return Object.prototype.toString.call(a) == '[object Object]'; } | |
| } | |
| // Clone an object or native type in javascript | |
| // Exceptions (doesn't handle these types): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(document).ready(function() { | |
| "use strict"; | |
| var ident = 0; // generate unique element id | |
| // Find all iframe DFP ads | |
| $('iframe').each(function() { | |
| var width = $(this).width(), | |
| height = $(this).height(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('document').ready(function() { | |
| $('iframe').load(function() { | |
| 'use strict'; | |
| var self = this; | |
| setTimeout(function() { | |
| var iframe = self, | |
| w = $(iframe).width(), h = $(iframe).height(), | |
| docw = iframe.contentWindow.document.width, | |
| doch = iframe.contentWindow.document.height; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var mixin = function(target /*, mixins */) { | |
| var args = [].slice.call(arguments, 1); | |
| target.mixins = target.hasOwnProperty('mixins') ? target.mixins : []; | |
| args.forEach(function(mixin) { | |
| if (target.mixins.indexOf(mixin) === -1) { | |
| if (typeof mixin === 'function') { | |
| // Functional mixin using 'call' | |
| mixin.call(target); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " Set colorscheme to solarized | |
| colorscheme solarized | |
| " Change the Solarized background to dark or light depending upon the time of | |
| " day (5 refers to 5AM and 17 to 5PM). Change the background only if it is not | |
| " already set to the value we want. | |
| function! SetSolarizedBackground() | |
| if strftime("%H") >= 5 && strftime("%H") < 17 | |
| if &background != 'light' | |
| set background=light |