Last active
August 29, 2015 14:22
-
-
Save schuetz/dc4f58ad587a8d788ae2 to your computer and use it in GitHub Desktop.
Just some useful snippets
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
| // Avoid `console` errors in browsers that lack a console. | |
| (function(){var method;var noop=function(){};var methods=['assert','clear','count','debug','dir','dirxml','error','exception','group','groupCollapsed','groupEnd','info','log','markTimeline','profile','profileEnd','table','time','timeEnd','timeStamp','trace','warn'];var length=methods.length;var console=(window.console=window.console||{});while(length--){method=methods[length];if(!console[method]){console[method]=noop;}}}()); |
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
| // debulked onresize handler | |
| function on_resize(c,t){onresize=function(){clearTimeout(t);t=setTimeout(c,100)};return c}; | |
| on_resize(function() { | |
| // handle the resize event here | |
| }); |
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
| // make jQuery :contains-Selector case-insensitive | |
| $.expr[':'].contains = $.expr.createPseudo(function(arg) { | |
| return function(elem) { | |
| return $(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0; | |
| }; | |
| }); |
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 touchsupport = ('ontouchstart' in window || navigator.msMaxTouchPoints) ? true : false; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment