This is now an actual repo:
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
| Drop in replace functions for setTimeout() & setInterval() that | |
| make use of requestAnimationFrame() for performance where available | |
| http://www.joelambert.co.uk | |
| Copyright 2011, Joe Lambert. | |
| Free to use under the MIT license. | |
| http://www.opensource.org/licenses/mit-license.php |
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
| //******************************************* | |
| // Level 1, basic API, minimum support | |
| //******************************************* | |
| /* | |
| Modules IDs are strings that follow CommonJS | |
| module names. | |
| */ | |
| //To load code at the top level JS file, | |
| //or inside a module to dynamically fetch |
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
| /* | |
| * margin-top or marginTop? | |
| * When to use lower-case and camel-case property names in JavaScript. | |
| */ | |
| // Setting style: camel-case | |
| elem.style.marginTop = '10px'; | |
| // Getting style: camel-case | |
| var value = elem.style.marginTop; |
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
| $(document).bind("scroll", function (e) { | |
| scrolling = true; | |
| }); | |
| setInterval(function () { | |
| if (scrolling) { | |
| //console.profile("scroll"); | |
| scrolling = false; | |
| var temp_top = win.scrollTop(), | |
| down = scroll_top - temp_top < 0 ? true : 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
| // Note that this uses my Pub/Sub implementation, which is slightly different than | |
| // phiggins' in that jQuery custom events are used, and as such the first event handler | |
| // argument passed is the event object. | |
| // | |
| // jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery | |
| // https://gist.github.com/661855 | |
| // The "traditional" way. |
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
| <script> | |
| // test for localStorage support | |
| if(('localStorage' in window) && window['localStorage'] !== null){ | |
| var f = document.getElementById('mainform'); | |
| // test with PHP if the form was sent (the submit button has the name "sent") | |
| <?php if(isset($_POST['sent']))){?> | |
| // get the HTML of the form and cache it in the property "state" | |
| localStorage.setItem('state',f.innerHTML); |
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
| // ---------------------------------------------------------- | |
| // A short snippet for detecting versions of IE in JavaScript | |
| // without resorting to user-agent sniffing | |
| // ---------------------------------------------------------- | |
| // If you're not in IE (or IE version is less than 5) then: | |
| // ie === undefined | |
| // If you're in IE (>=5) then you can determine which version: | |
| // ie === 7; // IE7 | |
| // Thus, to detect IE: | |
| // if (ie) {} |
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
| /* | |
| * Bookmarklet for viewing source in iPad Safari | |
| */ | |
| javascript:(function(){ | |
| var w = window.open('about:blank'), | |
| s = w.document; | |
| s.write('<!DOCTYPE html><html><head><title>Source of ' + location.href + '</title><meta name="viewport" content="width=device-width" /></head><body></body></html>'); | |
| s.close(); | |
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
| // geo-location shim | |
| // currentely only serves lat/long | |
| // depends on jQuery | |
| // doublecheck the ClientLocation results because it may returning null results | |
| ;(function(geolocation){ | |
| if (geolocation) return; |