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 key_exists_and_equals($array, $key, $value) | |
{ | |
return (isset($array[$key]) && $array[$key] == $value); | |
} |
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
jQuery.fn.highlight = function (text, o) { | |
return this.each( function(){ | |
var replace = o || '<span class="highlight">$1</span>'; | |
$(this).html( $(this).html().replace( new RegExp('('+text+'(?![\\w\\s?&.\\/;#~%"=-]*>))', "ig"), replace) ); | |
}); | |
} | |
jQuery.fn.autolink = function (target) { | |
if (target == null) target = '_parent'; | |
return this.each( function(){ |
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
@mixin custom-font($name, $weight, $font_type) { | |
$fallbacks:Helvetica, Arial, sans-serif; | |
@if $font_type == serif { | |
$fallbacks:Georgia, "Times New Roman", serif; | |
} | |
font-family: '#{$name} #{$weight}', $fallbacks; | |
font-weight:$weight; |
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
@mixin after-polyfill(){ | |
.ie7 & { | |
/* creates <span class="ie-after"></span> */ | |
zoom: expression( this.runtimeStyle.zoom="1", this.appendChild( document.createElement("span") ).className="ie-after" ); | |
} | |
} | |
@mixin before-polyfill(){ | |
.ie7 & { | |
/* creates <span class="ie-before"></span> */ |
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 centerImage() { | |
$img = $('img'); | |
var newimage = new Image(); | |
var originalImageWidth; | |
var originalImageHeight; | |
newimage.src = $img.attr('src'); | |
newimage.onload = function() | |
{ | |
// resize/reposition image based on aspect ratio relative to viewport aspect to make sure it is always fullscreen and centered |
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
var userAgentNaughtyList = { | |
positionFixed : [ | |
'Android 2', | |
'Android 3', | |
'Android 4.0', | |
'iPhone OS 4', | |
'iPhone OS 5', | |
'Windows Phone OS 7' | |
], | |
vimeo : [ |
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
var preloadImageArray = [ | |
'/path/to/images_1.jpg', | |
'/path/to/images_2.jpg', | |
'/path/to/images_3.jpg', | |
'/path/to/images_4.jpg' | |
]; | |
function preloadImages (preloadImageArray) { | |
var images = preloadImageArray; | |
var count = images.length; |
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
// make it safe to use console.log always | |
(function(b){ | |
function c(){} | |
for(var d="assert,clear,count,debug,dir,dirxml,error,exception,firebug,group,groupCollapsed,groupEnd,info,log,memoryProfile,memoryProfileEnd,profile,profileEnd,table,time,timeEnd,timeStamp,trace,warn".split(","),a;a=d.pop();){ | |
b[a]=b[a]||c | |
} | |
})((function(){ | |
try | |
{ |
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
if ('querySelector' in document && | |
'localStorage' in window && | |
'addEventListener' in window) { | |
// bootstrap the JavaScript application | |
} |
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 request(type, url, opts, callback) { | |
var xhr = new XMLHttpRequest(), | |
fd; | |
if (typeof opts === 'function') { | |
callback = opts; | |
opts = null; | |
} | |
xhr.open(type, url); |
OlderNewer