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(_init){ | |
jQuery.fn.init = function(selector, context){ | |
var jQueryObj = new _init(selector, context); | |
jQueryObj.valueOf = function(){ | |
return this.length; | |
}; | |
return jQueryObj; | |
}; | |
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
<script src="http://widgets.twimg.com/j/1/widget.js"> | |
new TWTR.Widget({ | |
search: 'my search query', | |
id: 'twtr-search-widget', | |
loop: true, | |
title: 'what people say about...', | |
subject: 'stuff and things', | |
width: 250, | |
height: 300, | |
theme: { |
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(){ | |
var special = jQuery.event.special, | |
uid1 = 'D' + (+new Date()), | |
uid2 = 'D' + (+new Date() + 1); | |
jQuery.event.special.focus = { | |
setup: function() { | |
var _self = this, | |
handler = function(e) { |
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
/* Place this at the very top of Sizzle() */ | |
var rContextID = /^\s*#(\S+)(?=\s+\S)/; | |
// Looking for "#id _somethingElseHere_" ... | |
if (!context && rContextID.test(selector)) { | |
context = document.getElementById( rContextID.exec(selector)[1] ); | |
selector = selector.replace(rContextID, ''); | |
} |
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
// Usage: | |
// Target all links with an ID starting with "notice" | |
delegateEvent({nodeName:/^a$/i, id: /^notice/}, 'click', function(){ | |
alert(this.id); | |
}); | |
function delegateEvent(props, type, handler) { | |
var fn = function(e) { |
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.equalHeights = function() { | |
return this.height(Math.max.apply(null, | |
this.map(function() { | |
return jQuery(this).height() | |
}).get() | |
)); | |
}; |
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 getDaysInMonth = function(m, y){ | |
return /8|3|5|10/.test(m)?30:m==1?(!(y%4)&&y%100)||!(y%400)?29:28:31; | |
}; | |
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 getters return full set if first arg === true */ | |
$.each( | |
[ | |
'html', 'val', 'text', 'width', 'height', 'scrollTop', | |
'scrollLeft', 'hasClass', 'css', 'attr', 'offset', | |
'position', 'outerHeight', 'outerWidth' | |
], | |
function(){ | |
var _method = $.fn[this]; |
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
<html> | |
<head> | |
<!-- jQuery --> | |
<script src="path/to/jquery.js"></script> | |
<!-- jQuery mod (from StackOverflow) --> | |
<script> | |
... put it here ... (or load it from another file, with src="...") | |
</script> |
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
public void insert(String newWord) { | |
dictionary.add(newWord); | |
Collections.sort(dictionary, new Comparator<String>(){ | |
public int compare(String s1, String s2) { | |
return s1.compareToIgnoreCase(s2); | |
} | |
}); | |
dictReader.save(dictionary); | |
OlderNewer