Skip to content

Instantly share code, notes, and snippets.

View emmgfx's full-sized avatar
🏠
Working from home

Josep Viciana emmgfx

🏠
Working from home
View GitHub Profile
@emmgfx
emmgfx / gist:4530058
Last active December 11, 2015 02:19
Comprobar si archivo remoto existe con PHP
<?PHP
function remote_file_exists($file){
$ch = curl_init($file);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_exec($ch);
$retcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if($retcode==200 || $retcode==302){
return true;
}else{
@emmgfx
emmgfx / gist:4537995
Last active December 11, 2015 03:28
Transiciones para LESS
.transition(@type: All, @seconds: 0.1s, @ease: ease-in){
-webkit-transition:@type @seconds @ease;
-moz-transition:@type @seconds @ease;
-o-transition:@type @seconds @ease;
transition:@type @seconds @ease;
}
/*
USO:
@emmgfx
emmgfx / gist:4538010
Last active December 11, 2015 03:28
Meta viewport con escalas
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
@emmgfx
emmgfx / gist:4538027
Last active December 11, 2015 03:28
Abrir archivo remoto con PHP
<?PHP
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_URL, );
$contents = curl_exec($c);
curl_close($c);
?>
@emmgfx
emmgfx / gist:4538055
Created January 15, 2013 11:42
Media queries con diferentes hojas de estilos
<!-- Se aplicará medium.css si la ventana mide entre 701 y 900px -->
<link rel="stylesheet" media="screen and (min-width: 701px) and (max-width: 900px)" href="css/medium.css" />
@emmgfx
emmgfx / gist:4538109
Last active December 11, 2015 03:29
Media queries en la misma hoja de estilos
/* Se aplica a la versión normal */
@media screen{
body{
width:75%;
}
}
/* Se aplica a la versión para imprimir */
@media print{
body{
@emmgfx
emmgfx / gist:4538141
Created January 15, 2013 11:59
Localstorage (cookies) Javascript
/* Se puede guardar texto o cualquier otra cosa, incluso video (MÁX 5M) */
/* Guarda dato */
localStorage["clave"] = "Valor";
/* Lee dato */
alert(localStorage["Nombre"]);
@font-face{
font-family: Roboto;
src: url('Roboto.ttf');
}
@font-face{
font-family: "Roboto con espacio";
src: url('Roboto2.ttf');
}
/* Uso */
a{
@emmgfx
emmgfx / gist:4540222
Created January 15, 2013 17:16
IE=edge
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
@emmgfx
emmgfx / gist:4545433
Created January 16, 2013 08:11
Convertir segundos a H:i:s
<?PHP
echo gmdate("H:i:s", 685);
?>