Skip to content

Instantly share code, notes, and snippets.

View andr3's full-sized avatar

André Luís andr3

View GitHub Profile
@andr3
andr3 / Upgrading images smoothly
Created April 3, 2013 14:49
Sometimes I have to explain this logic, this gist makes it easier. ;)
// Quick implementation of ResponsiveEnhance by Josh Emerson
// Original implementation: https://github.com/joshje/Responsive-Enhance
// <img src="sd.jpg" data-hd="hd.jpg">
function quickUpgrade (obj) {
var tmp = new Image(); // prepare a loose image to make the request & cache it
var newsrc = obj.getAttribute('data-hd'); // grab the URL of hd version
if (newsrc) { // make sure it's there
@andr3
andr3 / Detecting High Density screens
Created April 3, 2013 14:41
How to detect whether we're dealing with a high density screen in javascript?
if ("devicePixelRatio" in window && window.devicePixelRatio>1) {
// HD code
} else {
// SD code
}
@andr3
andr3 / dabblet.css
Created February 16, 2013 15:26
Exercicio
/**
* Exercicio
* Nomes:
* ________________
* ________________
* ________________
* (Enviar para [email protected])
*/
body {
background: #f06;
@andr3
andr3 / dabblet.css
Created February 16, 2013 15:23
Exercicio
/**
* Exercicio
*
*/
body {
background: #f06;
background: linear-gradient(45deg, #eee, #fff);
min-height: 100%;
font-family: helvetica, sans-serif;
}
@andr3
andr3 / dabblet.css
Created February 16, 2013 01:44
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
body {
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
font-family: helvetica;
}
li {
@andr3
andr3 / dabblet.css
Created February 16, 2013 01:38
Linkare Aula 3 - Exercicio
/*
* Linkare Aula 3 - Exercicio
*
* Nome: _______________________
* (No final do exercicio enviar para [email protected])
**/
body {
font-family: helvetica, sans-serif;
}
@andr3
andr3 / dabblet.css
Created February 16, 2013 01:34
Linkare Aula 3 - Exercicio
/*
* Linkare Aula 3 - Exercicio
*
* Nome: _______________________
* (No final do exercicio enviar para [email protected])
**/
body {
font-family: helvetica, sans-serif;
}