Skip to content

Instantly share code, notes, and snippets.

View BenjaminGuV's full-sized avatar

Benjamín Guerrero BenjaminGuV

View GitHub Profile
@BenjaminGuV
BenjaminGuV / uso horario javascript
Created March 9, 2012 11:48
calcular la zona horaria de una ciudad
// funcion para calcular la hora local en una ciudad dada la diferencia horaria.
function calcTime(city, offset) {
// creamos el objeto Date (la selecciona de la máquina cliente)
d = new Date();
// lo convierte a milisegundos
// añade la dirferencia horaria
// recupera la hora en formato UTC
utc = d.getTime() + (d.getTimezoneOffset() * 60000);
@BenjaminGuV
BenjaminGuV / style.css
Created March 15, 2012 12:17
css de un pop up simple
.fadebox{
display: none;
position: absolute;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
background-color: black;
z-index:1001;
-moz-opacity: 0.8;
@BenjaminGuV
BenjaminGuV / simple pop up en javascript
Created March 15, 2012 12:22
codigo javascript de pop up simple
<script type="text/javascript">
function showLightbox() {
document.getElementById('over').style.display='block';
document.getElementById('fade').style.display='block';
}
function hideLightbox() {
document.getElementById('over').style.display='none';
document.getElementById('fade').style.display='none';
}
</script>
@BenjaminGuV
BenjaminGuV / html movil jquery
Created March 19, 2012 00:02
estructura de html movil
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
<title>Titulo</title>
</head>
<body>
@BenjaminGuV
BenjaminGuV / animate jquery background-imagen
Created March 22, 2012 12:17
cambiar la imagen de background con jquery
(function(){
var i = 2;
var cambiar = setInterval( function(){
//$('#cambiante').css( 'background-image', 'url("2.jpg")' );
$('#cambiante').animate({
opacity: 0
}, 'slow', function(){
$(this).css( {'background-image': 'url("' + i + '.jpg")'} )
.animate({opacity: 1});
i++;
@BenjaminGuV
BenjaminGuV / ftpphp
Created May 14, 2012 22:46
Ejemplo de FTP en php
<?php
set_time_limit(0);
function leerDierctorio($ruta){
if($dir = opendir($ruta)){
chdir($ruta);
//Creamos los array de archivos y carpetas
$archivos=array();
$carpetas=array();
<?php
/**
*
*/
class Validar
{
function __construct()
{
# code...
@BenjaminGuV
BenjaminGuV / fecha.class.php
Created May 28, 2012 11:23
procesar fecha
<?php
class Fecha
{
private $dia = array();
private $mes = array();
private $anio = array();
function __construct()
@BenjaminGuV
BenjaminGuV / validar.js
Created May 28, 2012 11:24
validar datos con jquery prototype
function Validar(){
//this.id = id;
}
Validar.prototype.vacio = function( id ) {
this.id = id;
if ( this.id == "" ) {
this.id = false;
}
@BenjaminGuV
BenjaminGuV / FTP.class.php
Created June 15, 2012 10:41
Clase FTP en php
<?php
/**
* clase de FTP
*/
class Ftp
{
private $server;