console.log to find bugs in your code (like me) then this article is written just for you (also me).
I stumbled into an interesting problem the other day. I wanted to animate an element with a random
I'm a particular fan of this style of teaching because it focuses on legibility as much as writing. This ensures that our codebases are friendly to the next developer who comes along, even if it's ourselves.
Comparing the ASYNC and DEFER waterfalls, we see that using DEFER makes DOM Interactive fire sooner and allows rendering to proceed more quickly.
<script async></script> is more commonly seen in the wild,
defer is typically preferable as they can never block other syncronous scripts, as well as load in predictable source order.
Lately, I've been obsessed with optimizing performance through lazy-loading. Recently, I've written on how to lazy-load Google Maps and on how to lazy-load responsive Google Adsense. Now it's time for Disqus, a service for embedding comments on your website. It's a great service. It eliminates the headache of developing your own local commenting system, dealing with spam, etc. Recently, I've been working on implementing the widget in one of my projects.
I think I had the same wooahhhhh coool reaction as so many others did when this tweet was going around:
It wasn't that long ago where you couldn't programmatically copy text to the clipboard from the web without using Flash. But it's getting pretty well supported these days. IE 10+, Chrome 43+, Firefox 41+, and Opera 29+, says Matt Gaunt in writing about it on Google's developer site.
Here's the example from that article:
That article says it's not supported in Safari, but it is as of Safari 10, which only dropped in September.
You don't need a library to do this stuff, as evidenced by the above demo. But, there is one: clipboard.js. It's only 3kb gzipped. The purpose is to give you a bit of a cleaner API to work with, like success and error events, and configuration through
data-* attributes. Here's a demo of that: