// jQuery
$(document).ready(function() {
// code
})| // ---------------------------------------------------------- | |
| // 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) {} |
| /* modernizr-test.js | |
| * Daniel Ott | |
| * 3 March 2011 | |
| * Custom Tests using Modernizr's addTest API | |
| */ | |
| /* iOS | |
| * There may be times when we need a quick way to reference whether iOS is in play or not. | |
| * While a primative means, will be helpful for that. | |
| */ |
| DO WHAT YOU WANT TO PUBLIC LICENSE | |
| Version 2, December 2004 | |
| Copyright (C) 2011 Eli Perelman <http://eliperelman.com> | |
| Everyone is permitted to copy and distribute verbatim or modified | |
| copies of this license document, and changing it is allowed as long | |
| as the name is changed. | |
| DO WHAT YOU WANT TO PUBLIC LICENSE |
| 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 |
| /* ----------------------------------------------- | |
| * Accurate Cross-Browser Viewport Width | |
| * https://gist.github.com/2399828 | |
| * ----------------------------------------------- | |
| * Copyright 2012, Brett Jankord. | |
| * http://www.brettjankord.com/ | |
| * | |
| * Licensed under the MIT license: | |
| * http://www.opensource.org/licenses/MIT | |
| * ------------------------------------------------*/ |
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns | |
| Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms | |
| Read 1 MB sequentially from memory 250,000 ns 0.25 ms | |
| Round trip within same datacenter 500,000 ns 0.5 ms | |
| Read 1 MB sequentially from SSD 1,000,000 ns 1 ms 4X memory |
⇐ back to the gist-blog at jrw.fi
Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.
I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.
This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso
| // easing functions http://goo.gl/5HLl8 | |
| Math.easeInOutQuad = function (t, b, c, d) { | |
| t /= d/2; | |
| if (t < 1) { | |
| return c/2*t*t + b | |
| } | |
| t--; | |
| return -c/2 * (t*(t-2) - 1) + b; | |
| }; |