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
attrTests: { | |
testAccept: function(_el) { | |
return !!(_el.accept === '') && !!(_el.accept !== 'undefined'); | |
}, | |
testAutocomplete: function(_el){ | |
return !!(_el.autocomplete === '') && !!(_el.autocomplete !== 'undefined'); | |
}, | |
testAutofocus: function(_el){ |
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
// find all elements with a z-index and indicate what they are. | |
function contrast(color){ return '#' + | |
(Number('0x'+color.substr(1)).toString(10) > 0xffffff/2 ? '000000' : 'ffffff'); | |
} | |
jQuery('*') | |
.filter(function(){ return $(this).css('zIndex') !== 'auto'; }) | |
.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
//The jQuery validate plugin validates on the name attribute, | |
//which is problematic in Rails because every checkbox | |
//gets a hidden input with the same name. | |
//Here's how to validate the checkbox, not the hidden input: | |
var validate = function(){ | |
$(':input:hidden').attr('name', 'new_name'); | |
$('form').validate({ | |
rules: {"checkbox": "required"}, | |
messages: {"checkbox": "CHECK ME"}, |
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
//bookmarklet to validate html5 docs using the experimental validator(.nu). | |
//adapted from http://tantek.com/favelets/ | |
javascript:void(document.location='http://validator.nu/?doc='+escape(document.location)+'&parser=html5&profile=pedagogical&showsource=yes') |
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
// based on methodology developed by PPK: | |
// http://www.quirksmode.org/blog/archives/2009/08/when_to_read_ou.html | |
(function($){ | |
$.benchmark = function(times, result_selector, func){ | |
var startTime = new Date().getTime(); | |
while (times != 0){ | |
func(); | |
times--; | |
} |
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
$ spawn 3 | |
# => open 5 new Terminal tabs, cd to the current directory | |
$ spawn 5 ~/Code/project-x | |
# => Open 5 new Terminal tabs, cd to ~/Code/project-x |
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
// Attempt to make a drop-and-forget bunch of scripts that mimick some missing html5 goodies automatically | |
// Example: | |
// $(document).ready(function() { | |
// ProvideHtml5.autofocus() | |
// ProvideHtml5.datepicker() | |
// ProvideHtml5.forcenumber() | |
// }) | |
var ProvideHtml5 = { | |
autofocus = 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
<!--[if IE]> | |
<script> | |
(function(){var elems="abbr article aside audio canvas datalist details figure footer header hgroup mark menu meter nav output progress section time video".split(" ");for(i=elems.length+1;--i;)elem=doc.createElement(elems[i]);elem=null;})(); | |
</script> | |
<![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
/* | |
* Titan - Javascript Web Framework | |
* Version 1.1 | |
* Copyright 2009 Valio, Inc. | |
* | |
* Visit the Titan website for more information and documentation: | |
* http://www.titanproject.org | |
* | |
* --------------------------------------------------------------------------- | |
* |
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
// original (http://html5shiv.googlecode.com/svn/trunk/html5.js) | |
(function(){if(!/*@cc_on!@*/0)return;var e = "abbr,article,aside,audio,canvas,datalist,details,figure,figcaption,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,summary,time,video".split(','),i=e.length;while(i--){document.createElement(e[i])}})() |
OlderNewer