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
<?php
/*
Plugin Name: Dominable.com
Description: Ejemplo de plugin para animar a hacerlos
Author: Alex Moleiro
Version: 0.1 Beta
Author URI: http://twitter.com/MoleiroAlex
License: WTFPL
License URI: http://www.wtfpl.net/
private function bloquerEntradaTraficoPorIp($ip){
$comando = "/sbin/iptables -I INPUT -s " . $ip . " -j DROP"; //178.33.133.172
shell_exec($comando);
}
@alexmoleiro
alexmoleiro / gist:1771ae2ecdbb7612964e
Created July 13, 2015 18:06
Ip conectadas a mi server
private function setStrIPsConectadas(){
echo $this->ipConectadasStr= shell_exec("netstat -atun | awk '{print $5}' | cut -d: -f1 | sed -e '/^$/d' |sort | uniq -c | sort -n");
}
@alexmoleiro
alexmoleiro / util.js
Created October 3, 2014 16:17
¿Está el elemento del DOM dentro de la vista?
Util.isScrolledIntoView=function(elem)
{
var docViewTop = $(window).scrollTop();
var docViewBottom = docViewTop + $(window).height();
var elemTop = $(elem).offset().top;
var elemBottom = elemTop + $(elem).height();
return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
};
@alexmoleiro
alexmoleiro / youtube.html
Created July 29, 2014 13:09
Como responsivizar un Youtube embeded
<style>
.embed-container {
position: relative; padding-bottom: 69.25%; height: 0; overflow: hidden; max-width: 100%; height: auto;
min-width: 250px;}
.embed-container iframe, .embed-container object, .embed-container embed
{ position: absolute; top: 0; left: 0; width: 100%; height: 100%;
}
</style>
<div class='embed-container'>
<iframe src='http://www.youtube.com/embed/MtgwHazD1Ok' frameborder='0' allowfullscreen></iframe>
@alexmoleiro
alexmoleiro / gist:f36c23ee35217f05a9d0
Last active August 29, 2015 14:04
Activar el PureFtpD Passive
http://docs.cpanel.net/twiki/bin/view/AllDocumentation/WHMDocs/FTPPassiveMode
nano /etc/pure-ftpd.conf
service iptables restart
nano /etc/sysconfig/iptables-config
@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
@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 / 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 / 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;
}