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 revealingModulePattern = function() { | |
var privateVar = 1; | |
function privateFunction() { | |
alert('private'); | |
}; | |
var publicVar = 2; | |
function publicFunction() { |
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
jQuery.fn.extend({ | |
reset : function() { | |
return jQuery(this).filter('form').each(function() { | |
return this.reset(); | |
}).end(); | |
} | |
}); | |
$('form').bind('submit', function(e) { |
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
//copiei do http://petelepage.com/presentations/2011/gdd-br/webapps/helpers/dnd-lib.js | |
function habilitarDragAndDrop(id, thumbsId) { | |
var el_ = document.getElementById(id); | |
var thumbnails_ = document.getElementById(thumbsId); | |
this.dragenter = function(e) { | |
e.stopPropagation(); | |
e.preventDefault(); | |
el_.classList.add('dropHere'); |
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 hasFirebugLite = false; | |
runFirebug = function () { | |
if (!hasFirebugLite) { | |
$.getScript('https://getfirebug.com/firebug-lite.js', function () { | |
hasFirebugLite = true; | |
}); | |
} | |
} |
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 kkeys = [], | |
konami = "38,38,40,40,37,39,37,39,66,65"; | |
easterEgg = function (e) { | |
kkeys.push(e.keyCode); | |
if (kkeys.toString().indexOf(konami) == 0) { | |
var ee = $('<div id="ee">TROLOLOL</div>'); | |
ee.css({ |
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
kill = function (e) { | |
if (!e) e = window.event; | |
(e.stopPropagation) ? e.stopPropagation() : e.cancelBubble = true; | |
(e.preventDefault) ? e.preventDefault() : e.returnValue = false; | |
return false; | |
} |
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 enableScrollbar(event, ui) { | |
window.setTimeout(function() { | |
$(document) | |
.unbind('mousedown.dialog-overlay') | |
.unbind('mouseup.dialog-overlay'); | |
}, 100); | |
} | |
//when calling a dialog, override the open method | |
$(...).dialog({ |
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
$.extend({ | |
URLEncode: function (c) { | |
var o = ''; | |
var x = 0; | |
c = c.toString(); | |
var r = /(^[a-zA-Z0-9_.]*)/; | |
while (x < c.length) { | |
var m = r.exec(c.substr(x)); | |
if (m != null && m.length > 1 && m[1] != '') { | |
o += m[1]; |
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
getTweets = function(alvo, usuario, qtdMensagens){ | |
var o = {} | |
o.qtdMensagens = qtdMensagens; | |
o.caixaTwitter = $("#" + alvo); | |
o.caixaTwitter.append("<li><a href='#'>carregando tweets...</a></li>"); | |
$.jTwitter(usuario, o.qtdMensagens, function(data){ | |
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
in_array = function(needle, haystack, argStrict) { | |
// Checks if the given value exists in the array | |
var found = false, | |
key, strict = !! argStrict; | |
for (key in haystack) { | |
if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) { | |
found = true; | |
break; | |
} |