This file contains 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
/** | |
* Bootstrap Datepicker | |
* | |
* Quick editor to create a Bootstrap style datepicker (instead of multiple of dropdowns) | |
* @see: https://github.com/eternicode/bootstrap-datepicker/ | |
* @usage: takes 2 schema options, dateFormat and defaultValue | |
schema: { | |
MyDate: { |
This file contains 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 str_truncate($string, $length) { | |
$bogus = array(",", ".", "?", "!", ";", "/", "$", "%", "*", "&", "#", "+", "="); | |
if (strlen($string) > $length) { | |
$string = substr($string, 0, ($length -3)); | |
$string = substr($string, 0, strrpos($string, ' ')); | |
if(in_array(substr($string, -1), $bogus)){ | |
$string = substr($string, 0, strlen($string)-1); | |
} | |
$string .= "..."; | |
} |
This file contains 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
<IfModule mod_headers.c> | |
Header set X-UA-Compatible "IE=edge" | |
# "mod_headers" can't match based on the content-type, however, we only | |
# want to send this header for HTML pages and not for the other resources | |
<FilesMatch "\.(appcache|crx|css|cur|eot|gif|htc|ico|jpe?g|js|m4a|m4v|manifest|mp4|oex|oga|ogg|ogv|otf|pdf|png|safariextz|svgz?|ttf|vcf|webapp|webm|webp|woff|xml|xpi)$"> | |
Header unset X-UA-Compatible |
This file contains 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
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<system.webServer> | |
<httpProtocol> | |
<customHeaders> | |
<clear /> | |
<add name="X-UA-Compatible" value="IE=10" /> | |
</customHeaders> | |
</httpProtocol> | |
</system.webServer> |
This file contains 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
header('X-UA-Compatible: IE=edge,chrome=1'); |
This file contains 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
/** | |
* 90% faster that native Math.ceil() | |
* http://jsperf.com/math-ceil-v-math-fastceil | |
*/ | |
Math.fastCeil = function (n) { | |
var t = ~~n; | |
return t === n ? n : (n > 0) ? (t + 1) : (t - 1) | |
}; |
This file contains 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
/** | |
* parent document (e.g., modal containing an iframe tag) | |
*/ | |
var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent"; | |
var eventer = window[eventMethod]; | |
var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message"; | |
// Listen to message from child window |
This file contains 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
// bind the listener and config via data-attributes | |
// <textarea data-maxwarn="true" data-maxchars="20" data-warnclass='too-many-characters'></textarea> | |
$(document).on('keyup', '[data-maxwarn=true]', function(e){ | |
var tf = $(e.target); | |
var max = tf.data('maxchars'); | |
if(tf.val().length > max - 10){ | |
tf.data('hitmax', 'true'); |
This file contains 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
/** | |
* Enable route to __noSuchMethod__ when unknown method calling. | |
* | |
* @param {Object} obj Target object. | |
* @return {Object} | |
*/ | |
function enableMethodMissing(obj) { | |
var functionHandler = createBaseHandler({}); | |
functionHandler.get = function(receiver, name) { |
This file contains 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
//todo: memory hit with this loop? | |
//todo: check for valid file names (or use a "cacheThisKey" setting in the model?) | |
DS.ActiveModelSerializer.reopen({ | |
createImageCaches: function(hash){ | |
window.imageCache = window.imageCache || []; | |
var imageKeys = ['url', 'photo_url', 'image_url', 'image']; | |
for(var k in hash){ | |
if(imageKeys.contains(k)){ |
OlderNewer