Skip to content

Instantly share code, notes, and snippets.

View tanrax's full-sized avatar

Andros Fenollosa tanrax

View GitHub Profile
@tanrax
tanrax / gist:8056985
Created December 20, 2013 16:08
CSS: Estilo de letra negra
color: black;
@tanrax
tanrax / gist:8161358
Created December 28, 2013 16:38
PHP: Cargador de librerías
<?php
/** Autocargador de librerias **/
spl_autoload_register('autocargador');
function autocargador($insNom)
{
include $insNom . '.class.php';
}
@tanrax
tanrax / gist:8164364
Created December 28, 2013 21:24
PHP: Varios constructores (Multiconstructor)
We couldn’t find that file to show.
@tanrax
tanrax / gist:8164393
Created December 28, 2013 21:26
PHP: Varios constructores (Multiconstructor)
<?php
/**
* Multiconstructs
*/
class nomClass {
function __construct() {
$a = func_get_args();
$i = func_num_args();
@tanrax
tanrax / gist:8169143
Created December 29, 2013 10:26
PHP: Constante fin de línea o salto de línea
PHP_EOL
@tanrax
tanrax / gist:8290314
Created January 6, 2014 21:44
JS: Número al azar entre dos (random, aleatorio)
function randomFromInterval(from,to) {
return Math.floor(Math.random()*(to-from+1)+from);
}
@tanrax
tanrax / gist:8290936
Created January 6, 2014 22:26
JS: Gestion multidioma
<script src="lang/en.js" type="text/javascript"></script>
<script src="lang/es.js" type="text/javascript"></script>
<script type="text/javascript">
var sIdioma = 'en';
if(localStorage['idioma']) {
sIdioma = localStorage['idioma'];
}
$('#bandera').css('background-image', 'url("img/Flag-' + sIdioma + '.png")');
$("#text0").html(eval('sText0' + sIdioma));
@tanrax
tanrax / gist:8458356
Created January 16, 2014 16:43
PHP: Ejemplo bucles
<?php
//For
for ($i = 0; $i < 5; $i++) {
echo $i;
}
//While
$iNum = 0;
while ($iNum <= 10) {
@tanrax
tanrax / gist:8580622
Created January 23, 2014 15:34
PHP: Comprobar datos GET
$_SERVER['REQUEST_METHOD'] == 'GET'
@tanrax
tanrax / gist:8650942
Created January 27, 2014 15:48
PHP: Comprobar datos POST
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST') {
}
?>