Skip to content

Instantly share code, notes, and snippets.

View alexmoleiro's full-sized avatar
💭
OhMyDown.org

Alex Moleiro alexmoleiro

💭
OhMyDown.org
View GitHub Profile
@alexmoleiro
alexmoleiro / gist:5b2ed65928add0255fa3
Last active August 29, 2015 14:02
Walk through json using jQuery
//I need to walk through a json array recursively in Javascript. To do so I am using
//the command $.each from jQuery.
//Basically I ask for the node type in each node I am walking through.
//If it is an object I call the same function recursively. If not, I just do what I need to do.
function recorrer(json) {
$.each(json, function(index, value) {
@alexmoleiro
alexmoleiro / gist:e70577ebd55afa28979c
Last active August 29, 2015 14:02
Elegir radio button (sin radio button) y con un div
<style>
#panelCestaContienePacks {
width: 95%;
margin: 0 auto;
overflow: hidden;
}
#panelCestaContienePacks input[type=radio]{
display: none;
}
@alexmoleiro
alexmoleiro / gist:4f3b9eb8cecbcf8f83a4
Created June 28, 2014 23:29
Mantener el popup modal siempre en pantalla. Limitarlo al scroll. Ejemplo de miniaturas en moleiro.com
var alturaTop;
Modal.muestraModal = function(html,ancho){
alturaTop = $(window).scrollTop();
$("#mensajeModal").css("top", alturaTop); //pongo la ventana arriba
$(window).scroll(function() {
if ($("#mensajeModal").height() > $(window).height()) //si el modal es más grande que la ventana del navegagor
@alexmoleiro
alexmoleiro / gist:791601967207c35cbd00
Last active August 29, 2015 14:03
Doble left join para evitar unknown column
SELECT SQL_CALC_FOUND_ROWS *,unidades*precio as subtotal FROM (cesta_detalle,producto)
left join diccionario
on diccionario.iddiccionario=producto.iddiccionario_nombre
left join cesta_detalle_dominio cd
on cd.idcesta_detalle_dominio=cesta_detalle.idcesta_detalle
where producto.idproducto=cesta_detalle.idproducto
and cesta_detalle.idcesta='".$idcesta."'
@alexmoleiro
alexmoleiro / gist:21ab3158be58a86b9745
Last active August 29, 2015 14:03
Control de spam en Whm controlando Exim4
<?php
class clase_eximStatsAnalisis {
private $eximstatsStr;
public function __construct() {
$this->setEximStats();
}
@alexmoleiro
alexmoleiro / gist:b9af2ad73e22cccfaf70
Created July 2, 2014 11:20
MySQL (5.5.x) deleting rows in two tables at the same time
DELETE cesta_detalle,cdd
FROM cesta_detalle,cesta_detalle_dominio AS cdd
WHERE idcesta_detalle_parent=' loquesea '
AND cdd.idcesta_detalle_dominio=cesta_detalle.idcesta_detalle
@alexmoleiro
alexmoleiro / gist:621f50fb9baf8f359153
Created July 2, 2014 13:24
Navegar por todos los elementos del DOM con un atributo determinado
function getTldPorId()
{
var IDs = [];
$("#widgetBusqueda").find("[tld]").each(function() {
IDs.push($(this).attr("tld")); //IDs.push(this.id);
});
return IDs;
}
@alexmoleiro
alexmoleiro / ejemplo.tpl
Last active August 29, 2015 14:03
i++ en smarty (solo en algunos casos)
{if $subcategorias neq '0'}
{foreach from=$subcategorias key=idcategoria item=v}
{assign var=var value=1} // Asignación variable
{foreach from=$v.fotos key=k item=it }
{assign var=var value=$var+1} // Modificación variable
@alexmoleiro
alexmoleiro / xml-api-ejemplo.php
Last active August 29, 2015 14:03
XML-API-EJEMPLO
<? // http://docs.cpanel.net/twiki/bin/view/SoftwareDevelopmentKit/XmlApi
$acctconf = array(
"username" =>$username,
"domain" =>$dominio,
//"plan" =>"default",
"password" =>$pin,
"contactemail"=>$email,
"language"=>"es_es",
"mxcheck"=>"remote"
);
@alexmoleiro
alexmoleiro / dominios con hosting.sql
Last active August 29, 2015 14:03
Dominios que tengan hosting contratado
select * from cesta_detalle cd
where idproducto = 'dominio_registro'
and
(
idcesta_detalle=
(select idcesta_detalle_parent
from cesta_detalle cdd
where cd.idcesta_detalle=cdd.idcesta_detalle_parent
)
or