Skip to content

Instantly share code, notes, and snippets.

View jakearchibald's full-sized avatar
💭
Tired

Jake Archibald jakearchibald

💭
Tired
View GitHub Profile
@jakearchibald
jakearchibald / gist:1168514
Created August 24, 2011 16:49
Preventing images & other media downloading
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<script id="whatever">document.write('<!'+'--')</script>
<img src="filth.jpg" />
<!---->
<script>
// filth.jpg will start loading now for users without js.
alias gs='git status'
alias gai='git add --interactive'
alias gsvn='git svn'
alias gsup='gsvn fetch && gsvn rebase'
alias gsp='gsup && gsvn dcommit'
alias gf='git fetch'
alias gr='git rebase'
alias gp='gup && git push'
alias gff='git flow feature'
alias gfr='git flow release'
.whatever {
-webkit-box-shadow: 0 2px 2px rgba(0,0,0,0.5) inset;
-moz-box-shadow: 0 2px 2px rgba(0,0,0,0.5) inset;
-o-box-shadow: 0 2px 2px rgba(0,0,0,0.5) inset;
box-shadow: 0 2px 2px rgba(0,0,0,0.5) inset;
}
var something = 'blah',
whatever = 'spaces, to make the var names line up';
if (something) {
console.log("tabbed, to indicate it's a child of a code block");
}
// But I tend to use 4 spaces when coding in python, as that's what the python
// expert I work with does.
@jakearchibald
jakearchibald / gist:909640
Created April 8, 2011 11:00
Experimenting with IE support
<!--[if IE 8]><meta http-equiv="X-UA-Compatible" content="IE=7"/><![endif]-->
<!--[if gt IE 8]><meta http-equiv="X-UA-Compatible" content="IE=edge"/><![endif]-->
I've been experimenting with this in a couple of projects.
For animations, IE8 compat mode is noticeably quicker/smoother than
IE8 strict. Since I still give 'full' support to IE7 (barring the
odd text-shadow etc which IE8 doesn't support anyway) I use the tags
above to push IE8 into compat mode for smoother animations, but allow
the much faster IE9 to try its standardsy best.
/**
* @private
* @function
* @description Get a supported css property name for a css property
* Will search common vendor prefixes for supported value.
*
* @param {string} propertyName Name without any prefix
*
* @return {string} Supported property name.
* This will be an empty string for unsupported properties.
function asyncQueue(/* function, function, ... */) {
var slice = Array.prototype.slice,
funcs = slice.call(arguments, 0),
baseArgs = [function() {
next(arguments);
}],
next = function(args) {
var nextFunc = funcs.shift();
nextFunc && nextFunc.apply(
this, baseArgs.concat( slice.call(args, 0) )
function asyncQueue(/* function, function, ... */) {
var slice = Array.prototype.slice,
funcs = slice.call(arguments, 0),
baseArgs = [function() {
next(arguments);
}],
next = function(args) {
var nextFunc = funcs.shift();
nextFunc && nextFunc.apply(
this, baseArgs.concat( slice.call(args, 0) )
function asyncQueue(/* function, function, ... */) {
var funcs = Array.prototype.slice.call(arguments, 0),
baseArgs = [function() {
next(arguments);
}],
next = function(args) {
var nextFunc = funcs.shift();
nextFunc && nextFunc.apply( this, baseArgs.concat(args) );
};
next();
<link rel="stylesheet" href="anothersheet.css" type="text/css" charset="utf-8">
<style type="text/css" media="screen">
@font-face {
/* etc */
}
</style>
<!--
The above causes rendering to block in IE6-8 until the external font has downloaded.
So, to avoid blocking in IE: