Want to create a Gist from your editor, the command line, or the Services menu? Here's how.
/* Use this to cause a function to fire no more than once every 'ms' milliseconds. | |
For example, an expensive mousemove handler: | |
$('body').mouseover(ratelimit(function(ev) { | |
// ... | |
}, 250)); | |
*/ | |
function ratelimit(fn, ms) { | |
var last = (new Date()).getTime(); |
/* __ | |
/ _) | |
.-^^^-/ / | |
__/ / | |
<__.|_|-|_| | |
*/ | |
/*_/| | |
=0-0= |
// See comments below. | |
// This code sample and justification brought to you by | |
// Isaac Z. Schlueter, aka isaacs | |
// standard style | |
var a = "ape", | |
b = "bat", | |
c = "cat", | |
d = "dog", |
// ---------------------------------------------------------- | |
// 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) {} |
<?xml version="1.0" encoding="UTF-8"?> | |
<project name="cssembed" default="build_css"> | |
<!-- dirs --> | |
<property name="libdir" value="${basedir}/lib" /> | |
<property name="sourcedir" value="${basedir}/source" /> | |
<property name="outputdir" value="${basedir}/build" /> | |
<!-- ant utils --> |
The common way to use media queries is to group all styling for a specific query. Leenull, a colleague of mine, came with the idea to use media queries on a component level. This might make make complex stylesheets easier to maintain.
I wonder what you think of it. Please let me know in the comments. Here's a link to a working example.
.item1 {
/* | |
Error | |
at treachery (hell.js:49:11) | |
at fraud (hell.js:45:12) | |
at violence (hell.js:41:12) | |
at heresy (hell.js:37:12) | |
at anger (hell.js:33:12) | |
at greed (hell.js:29:12) | |
at gluttony (hell.js:25:12) | |
at lust (hell.js:21:12) |
Jake Archibald (@jaffathecake): The ServiceWorker is coming; look busy
https://speakerdeck.com/jaffathecake/the-serviceworker-is-coming-look-busy
https://github.com/jakearchibald/trained-to-thrill/
https://www.youtube.com/watch?v=SmZ9XcTpMS4
Hunter Loftis (@hunterloftis): We Will All Be Game Progmrammers
http://wwabgp.herokuapp.com/s
http://youtu.be/QX0eauXBKwc
CarterRabasa (@carterrabasa): A Community of People; Not Projects
// per https://docs.npmjs.com/misc/scripts, npm exposes a bunch of variables to | |
// the environment prefixed with npm_config_*, npm_package_* and npm_lifecycle_*. | |
// Here's a list of all variables exposed in my setup. | |
npm_config_access= | |
npm_config_allow_same_version= | |
npm_config_also= | |
npm_config_always_auth= | |
npm_config_argv='{"remain":[],"cooked":["run","foo"],"original":["run","foo"]}' | |
npm_config_auth_type=legacy |