Skip to content

Instantly share code, notes, and snippets.

@st3phan
st3phan / CSS3 Media Queries Template
Created December 27, 2011 15:02
CSS3 Media Queries template
/*
* Author: http://stuffandnonsense.co.uk/blog/about/hardboiled_css3_media_queries/
*/
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
@st3phan
st3phan / gist:1445179
Created December 7, 2011 23:02 — forked from bergantine/gist:1445036
Responsive JS
window.onresize = function() {
responsiveLoad();
}
window.onload = function() {
responsiveLoad();
}
function responsiveLoad() {
console.log('resized');
@st3phan
st3phan / style.sass
Created November 4, 2011 09:16 — forked from destroytoday/style.sass
Prevents iOS from changing the font size of paragraphs in landscape
@media only screen and (min-device-width: 320px) and (max-device-width: 1024px)
html
-webkit-text-size-adjust: none
@st3phan
st3phan / deferred-img.js
Created July 27, 2011 13:12 — forked from fcalderan/deferred-img.js
Image loader / preloader achieved by deferred objects in jQuery 1.6
/**
* For a current project I need to wait to execute a code until some images have been loaded.
* Beside, I also need to execute a callback (in my specific code I want to show the image
* with a fade-in effect) every time a single image has been loaded.
*
* So basically I used two deferred objects: the nested one which is resolved for a single
* image successfull load event (or when image has been discarded) and the outside one,
* which is resolved when all deferred objects on single images have been resolved or rejected.
*
* This snippet also takes care all frequent issues when trying to load an image (excessive
@st3phan
st3phan / gist:756278
Created December 27, 2010 16:46 — forked from getify/gist:603980
// HOWTO: load LABjs itself dynamically!
// inline this code in your page to load LABjs itself dynamically, if you're so inclined.
(function (global, oDOC, handler) {
var head = oDOC.head || oDOC.getElementsByTagName("head");
function LABjsLoaded() {
// do cool stuff with $LAB here
}