Skip to content

Instantly share code, notes, and snippets.

@tvandervossen
tvandervossen / gist:1958155
Created March 2, 2012 12:41
How to define a 400 by 200 px sprite image with a 800 by 400 px retina display version
.ui
{
  background-image: url(sprite.png);
}
@media only screen and (-webkit-min-device-pixel-ratio: 2) {
  .ui
  {
    background-image: url(sprite2x.png);
    background-size: 400px 200px;
  }
@tvandervossen
tvandervossen / gist:2276702
Created April 1, 2012 16:14
Load jQuery on IE instead of Zepto
<script>document.write('<script src="(navigator.userAgent.indexOf('MSIE ') > -1 ? 'jquery' : 'zepto') + '.js"><\/script>');</script>
@tvandervossen
tvandervossen / after.js
Created April 13, 2012 09:06
How I Learned to Stop Worrying and Drop the Semicolon
device = function(){
var flags = {}, ua = navigator.userAgent, el = document.createElement('div')
function flag(names) {
document.body.className += (document.body.className ? ' ' : '') + names
names = names.split(' ')
for (var i = 0; i < names.length; i++) flags[names[i]] = true
}
if (ua.indexOf('MSIE ') > -1) flag('msie');
if (ua.indexOf('Firefox') > -1) flag('firefox')
if (ua.indexOf('(iPad') > -1) flag('ios ipad')
@tvandervossen
tvandervossen / gist:2407384
Created April 17, 2012 16:39
We Didn't Start the Fire
Harry Truman, Doris Day, Red China, Johnny Ray
South Pacific, Walter Winchell, Joe DiMaggio
Joe McCarthy, Richard Nixon, Studebaker, Television
North Korea, South Korea, Marilyn Monroe
Rosenbergs, H Bomb, Sugar Ray, Panmunjom
Brando, The King And I, and The Catcher In The Rye
Eisenhower, Vaccine, England's got a new queen
It might be helpful to add that even though sub-pixel antialiasing is the default text rendering method on Macs with built-in LCD panels, using a third-party external screen can result in all text being rendered using greyscale antialiasing.
It’s also possible for users to switch to greyscale rendering system-wide by unchecking “Use LCD font smoothing when available” in the “General” System Preferences panel.
In Safari and Chrome you can control the antialiasing method by using the -webkit-font-smoothing CSS property which can be set to “subpixel-antialiased”, “antialiased” or even “none”.
On top of that; all text on a non-opaque Core Animation layer will always be rendered without sub-pixel antialiasing (because of the way the GPU does compositing). You can see an example of this in the menu bar when you enable “Translucent menu bar” in the “Desktop” System Preferences panel.
The latter is especially relevant for web pages which use CSS 3D transformations. Since these are hardware accelerated in Safari,
@tvandervossen
tvandervossen / gist:2593810
Created May 4, 2012 10:15
Invoice reminder
Hi Bob,
Just wanted to inform you that we have not yet received payment of
invoice ####-##.
I'm sure you must have mistakenly overlooked this. I've included
a copy of the invoice for your convenience.
If payment has already been sent, please disregard this email. Do
not hesitate to contact me if you have any questions.
;(function( {
function update() {
var h = $(window).height()
$('#wrapper').height(h)
$('aside').height(h)
$('#activity').height(h-30)
$('#conversation').height(h-30)
}
$(document).ready(update)
$(window).resize(update)
@tvandervossen
tvandervossen / test_http_digest_rails3_patch.rb
Created May 21, 2012 19:34 — forked from denisahearn/test_http_digest_rails3_patch.rb
Testing HTTP Digest Authentication in Rails 3
# Add this to test/test_helper.rb
# Allow http digest authentication in functional tests, based on https://gist.github.com/1282275
# Call authenticate_with_http_digest(user, realm, digest) or authenticate_with_http_digest(user, realm, password, false) before you perform a request
class ActionController::TestCase
require 'digest/md5'
def authenticate_with_http_digest(user, realm, password, password_is_ha1 = true)
ActionController::Base.class_eval { include ActionController::Testing }
@tvandervossen
tvandervossen / blink.css
Created May 31, 2012 07:27
Blink element for HTML5
@tvandervossen
tvandervossen / gist:3777281
Created September 24, 2012 17:52
No joke
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" version="XHTML+RDFa 1.0" dir="ltr" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/terms/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:og="http://ogp.me/ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:sioc="http://rdfs.org/sioc/ns#" xmlns:sioct="http://rdfs.org/sioc/types#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" class="js">