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 rules = { | |
body: function(val) { | |
if (val.length == 0) return 'requires body'; | |
if (val.length > 140) return 'body has a 140 character limit'; | |
return true; | |
}, | |
username: function(val) { | |
if (val.length > 20) return 'username has a 20 character limit'; |
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
javascript:%20(function(){var%20form=document.createElement('form');form.method='POST';form.action='http://mapy.kayac.com/';form.innerHTML='<div><input%20type="hidden"%20name="url"%20value="'+location.href+'"/></div>';document.body.appendChild(form);form.submit();})(); | |
/* | |
(function() { | |
var form = document.createElement('form'); | |
form.method = 'POST'; | |
form.action = 'http://mapy.kayac.com/'; | |
form.innerHTML = '<div><input type="hidden" name="url" value="'+location.href+'"/></div>'; | |
document.body.appendChild(form); | |
form.submit(); |
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($) { | |
$.fn.getId = function(pattern) { | |
pattern = pattern || /(\d+)/; | |
var id = this.attr('id'); | |
if (!id) return null; | |
var ids = (pattern.exec(id) || []).slice(1); | |
return (ids.length > 1 ? ids : ids[0]) || null; | |
}; | |
})(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
document.write = function(str) { | |
var script = document.getElementsByTagName('script'); | |
script = script[script.length - 1]; | |
var container = document.createElement('div'); | |
container.innerHTML = str; | |
script.parentNode.insertBefore(container, 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
Math.randomInt = function(min, max) { | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
}; |
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
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" focusIn="bg(true)" focusOut="bg(false)" backgroundColor="0xCCCCCC" backgroundImage="none"> | |
<mx:Script> | |
<![CDATA[ | |
private function bg(focus:Boolean):void | |
{ | |
this.setStyle('backgroundColor', focus ? '0x333333' : '0xCCCCCC'); | |
} | |
]]> | |
</mx: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
// so disgraceful.. | |
killContextMenu = function() { | |
$('img').bind('contextmenu', function() { | |
return 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
debug = !(/^test\.example\.com/.test(location.host)); | |
if (typeof console == 'undefined') { | |
console = {}; | |
console.log = function() { | |
try { | |
var res = []; | |
for (var i = 0, l = arguments.length; i < l; i++) | |
res.push(arguments[i].toString()); | |
if ($.browser.opera) |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
<title>Function.prototype.bind</title> | |
<link rel="stylesheet" type="text/css" href="http://github.com/jquery/qunit/raw/master/qunit/qunit.css"/> | |
<script type="text/javascript" src="http://github.com/jquery/qunit/raw/master/qunit/qunit.js"></script> | |
<script type="text/javascript" src="Function.prototype.bind.js"></script> | |
</head> | |
<body> |
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
Array.prototype.split = function(n) { | |
var ret = [], i = 0; | |
while (n && (ret[i++] = this.splice(0, n)).length == n && this.length); | |
return ret; | |
}; |