Skip to content

Instantly share code, notes, and snippets.

@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
}
@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 / 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 / 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 / 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 / dabblet.css
Created January 4, 2012 16:16 — forked from kizu/dabblet.css
Centered heading with rules
/* Centered heading with rules */
h1 {
position: relative;
overflow: hidden;
white-space: nowrap;
text-align: center;
text-overflow: ellipsis;
font: 1.6em/1.1 Georgia;
padding: .2em 0;
@st3phan
st3phan / jquery.images-loader-deferred.js
Created February 15, 2012 14:48 — forked from joachimdoerr/jquery.images-loader-deferred.js
jquery check: are images loading
// deferred obj callback
function loadImg(selector) {
var dfd = $.Deferred();
$(selector).load(function() { dfd.resolve(); });
return dfd.promise();
}
// more elements
$.when(
loadImg('#img1'),
@st3phan
st3phan / dabblet.css
Created March 26, 2012 09:41 — forked from jakearchibald/dabblet.css
Transitioning via translate (uses sub-pixel == smoother)
.test, .test2 {
width: 200px;
height: 200px;
background: green;
border-radius: 500px;
position: relative;
transition: all 2s linear;
}
.test2:hover {
transform: translate(20px, 0);
@st3phan
st3phan / hack.sh
Created March 31, 2012 14:14 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@st3phan
st3phan / _shared.scss
Created June 4, 2012 10:08 — forked from rickharris/_shared.scss
Media queries with IE support using Sass 3.2 features
// Using this structure, this file should be your canonical stylesheet where
// everything would be imported into, so that you can just `@import "shared";`
// in both your normal and IE stylesheets, only having to add libraries and
// such in one place.
// These styles are just a contrived example.
body {
font-size: 18px;
@include respond-to(desktops) {
color: blue;