Skip to content

Instantly share code, notes, and snippets.

@oriolrivera
oriolrivera / gist:6055235
Last active December 20, 2015 02:19
Ordenar alfabéticamente elementos del html con jquery
<!doctype html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Ordenar alfabéticamente elementos del html con jquery</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>
@oriolrivera
oriolrivera / gist:6430291
Last active December 22, 2015 06:19
get token
<?php
$getToken=$_SESSION;
$clave = array_keys($getToken);
echo $token= $getToken[$clave[1]]; # Imprime la posicion del token
?>
<!doctype html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Varias columnas con css</title>
</head>
<style type="text/css">
.colum {
@oriolrivera
oriolrivera / validarFormJs.html
Last active December 25, 2015 10:49
Validación de formulario con jquery
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Validar formulario con jquery</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
$(function(){
$("#send").click(function(){
@oriolrivera
oriolrivera / dataNow.js
Created October 17, 2013 17:05
Fecha actual con javascript
var dias_semana = new Array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado");
var meses = new Array ("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre", "Diciembre");
var fecha_actual = new Date();
alert("Hoy es " + dias_semana[fecha_actual.getDay()] + " dia " + fecha_actual.getDate() + " de " + meses[fecha_actual.getMonth()] + " de " + fecha_actual.getFullYear());
@oriolrivera
oriolrivera / index.php
Created November 12, 2013 17:02
php mysql convertir listado de datos separado por comas en un array para recorrerlo e insertar cada dato en una base de datos
<?php
$var="Alfa Romeo,Aston Martin,Audi,Autovaz,Bentley,Bmw,Cadillac,Caterham,Chevrolet,Chrysler,Citroen,Daihatsu,Dodge,Ferrari ,Fiat,Ford,Honda,Hummer,Hyundai,Isuzu,Jaguar,Jeep,Kia,Lamborghini,Lancia,Land Rover,Lexus,Lotus,Maserati,Mazda,Mercedes Benz,MG,Mini,Mitsubishi,Morgan,Nissan,Opel,Peugeot,Porsche,Renault,Rolls Royce,Rover,Saab,Seat,Skoda,Smart,Ssangyong,Subaru,Suzuki,Tata,Toyota,Volkswagen,Volvo";
$arraisico=split(",",$var);
for($i=0;$i<count($arraisico);$i++) {
echo $arraisico[$i];
mysql_query("INSERT INTO marcas (marca) VALUES ('".$arraisico[$i]."')");
<?php
if(isset($_POST['email'])) {
// Edit these two lines with your email address and the subject that you want to receive
$email_to = 'mail@gmail.com';
$email_subject = "You've got an email from your website!";
// - Do not edit below this line :)
if(!isset($_POST['name']) ||
@oriolrivera
oriolrivera / imagen.php
Created November 16, 2013 22:21
Escalando imagen con php
<?php
$ruta_imagen = 'images/3rd.jpg';
$escala = 0.20;
$info_fuente = getimagesize($ruta_imagen);
$recurso_fuente = imagecreatefromjpeg($ruta_imagen);
$ancho_nuevo = round($info_fuente[0] * $escala);
$alto_nuevo = round($info_fuente[1] * $escala);
<?php
$idioma = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
echo $idioma;
?>
@oriolrivera
oriolrivera / Countdown.php
Created November 26, 2013 15:11
Countdown con fecha vía php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>jQuery Countdown</title>
<link rel="stylesheet" href="jquery.countdown.css">
<style type="text/css">
#defaultCountdown { width: 240px; height: 45px; }
</style>
<script type="text/javascript" src="http://localhost/mixtv/public/js/jquery-1.8.0.min.js"></script>