This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ES5, using Bluebird */ | |
var isMomHappy = true; | |
// Promise | |
var willIGetNewPhone = new Promise( | |
function (resolve, reject) { | |
if (isMomHappy) { | |
var phone = { | |
brand: 'Samsung', | |
color: 'black' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var i,c,y,v,s,n; | |
v = document.getElementsByClassName("youtube"); | |
if(v.length>0){ | |
s = document.createElement("style"); | |
s.type="text/css"; | |
s.innerHTML='.youtube{background-color:#000; max-width:100%;overflow:hidden;position:relative;cursor:hand;cursor:pointer}.youtube .ythumb{bottom:0;display:block;left:0;margin:auto;padding:0;max-width:100%;position:absolute;right:0;top:0;width:100%;height:auto}.youtube .play{filter:alpha(opacity=80);opacity:.8;left:50%;margin-left:-38px;margin-top:-38px;position:absolute;top:50%;width:77px;height:77px;background:url(http://lh6.googleusercontent.com/-KM0uGaLlhKc/UznnNWfT-wI/AAAAAAAAKS0/Nnz3WwdoLxk/s77/play.png) no-repeat}'; | |
document.body.appendChild(s)} | |
for(n = 0; n < v.length; n++){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$this->languages['es'] = array( | |
'days' => array(1 => 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado','Domingo'), | |
'daysShort' => array(1 => 'Lun', 'Mar', 'Mie', 'Jue', 'Vie', 'Sab','Dom'), | |
'daysMin' => array(1 => 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa','Do'), | |
'months' => array(1 => 'Enero','Febrero','Marzo','Abril','Mayo','Junio', 'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'), | |
'monthsShort' => array(1 => 'Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic') | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Pasar de Kg a toneladas o al reves | |
*/ | |
function formatKgtoTon($peso,$ton = false){ | |
return $ton ? $peso*1000 : $peso/1000; | |
} | |
/** | |
* Formato europeo + separador decimal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/************************ | |
* FUNCTION DATE | |
************************/ | |
/** | |
* Devolver la fecha de hoy con o sin hora | |
*/ | |
function dateToday($format = 'Y-m-d',$time = false){ | |
$date = new DateTime(); | |
return $time ? $date->format($format.' H:i:s') : $date->format($format); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Saber si es un numero | |
*/ | |
function isNumeric(n) { | |
return !isNaN(parseFloat(n)) && isFinite(n); | |
} | |
/** | |
* Saber si es un integer | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Limpiar el formulario | |
*/ | |
function clearForm(id_class_form) { | |
$(id_class_form).find(':input').each(function() { | |
switch(this.type) { | |
case 'password': | |
case 'select-multiple': | |
case 'select-one': | |
case 'text': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* var name = $_GET('name'); | |
* OR | |
* var $_GET = $_GET(), name = $_GET['name'] | |
*/ | |
function $_GET(param) { | |
var vars = {}; | |
window.location.href.replace( location.hash, '' ).replace( | |
/[?&]+([^=&]+)=?([^&]*)?/gi, // regexp | |
function( m, key, value ) { // callback |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#JS | |
function generatePasswordRand(length,type) { | |
switch(type){ | |
case 'num': | |
characters = "0123456789"; | |
break; | |
case 'alf': | |
characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
break; | |
case 'rand': |