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
// Provided an array, remove all duplicated items. | |
removeDuplicates : function(anArray) { | |
var a = anArray.concat(); | |
for(var i=0; i<a.length; ++i) { | |
for(var j=i+1; j<a.length; ++j) { | |
if(a[i] === a[j]) a.splice(j, 1); | |
} | |
} | |
return a; |
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 IEMobile]> | |
<link rel="stylesheet" media="screen" href="styles/mobile_wp.css" /> | |
<![endif]--> |
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
$elem.animate({ | |
'customScale': someScaleValue | |
}, { | |
step: function(now, fx){ | |
if ( fx.prop == 'customScale' ) { | |
$elem.css({ | |
'-webkit-transform': 'scale('+now+')' | |
}); | |
} | |
} |
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
c = document.createElement('script'); | |
c.type = 'text/javascript'; | |
c.src = 'URL TO SCRIPT'; | |
(document.getElementsByTagName('head')[0] || document.getElemntsByTagName('body')[0]).appendChild(c); |
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
<link rel="stylesheet" media="screen" href="basic.css" /> <!-- Everything --> | |
<link rel="stylesheet" media="screen and (min-device-width: 1px)" href="awesome.css" /> <!-- Modern --> |
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 CustomClass = Backbone.CustomClass = function(options) { | |
this.cid = _.uniqueId('CustomClass'); | |
this._configure(options || {}); | |
this.initialize.apply(this, arguments); | |
}; | |
var classOptions = ['attributes']; | |
_.extend(CustomClass.prototype, null, { |
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 y = [25, 8, 7, 41, 22, 11, 2, 1000]; | |
var randomize = function(array) { | |
var output = [], | |
arrLen = array.length; | |
for ( var i = 0; i < array.length; i++ ) { | |
output[i] = false; | |
} |
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 x = [1,3,'b',5,2,4,'a']; | |
x.sort(function(a,b){ | |
if ( typeof a === typeof b ) { | |
return (a > b); | |
} else { | |
return typeof a > typeof b; | |
} | |
}); |
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
// Add support for outerHTML, which in FF was only added at version 11. | |
// Only use elem.outerHTML once support for FF<11 is no longer needed. | |
(function($){ | |
$.fn.outerHTML = function() { | |
var a = this.get(0).outerHTML; | |
return a ? a : $('<p/>').append(this.clone()).html(); | |
} | |
})(jQuery); |
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
#foo { display: block; float: left; | |
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=40)"; | |
filter:alpha(opacity=40); | |
opacity: 0.4; | |
} |
OlderNewer