View more - Cleaning hacked PHP scripts
Posted by andphe on Fri Dec 03 14:31:08 UTC 2010. Language bash

grep -irl base64_encode * | xargs -I {} sed -i -e 's/^error_reporting.*base64_encode.*?>$/?>/' {}
        

View more - Lista de remitentes rechazados por falta de registro SPF en Qmail/Plesk
Posted by andphe on Tue Oct 05 15:37:45 UTC 2010. Language bash

!/bin/bash

for message in $(grep "SPF status: REJECT" /usr/local/psa/var/log/maillog | grep -oP "(\d+)(?=\])" )
do
    grep "\[$message\].*from=" /usr/local/psa/var/log/maillog
done
        

View more - reording array keys from zero
Posted by andphe on Tue Jul 27 16:17:19 UTC 2010. Language php

<?php

//If you have a array that need to re-key from zero
//can use $thearray = array_merge((array),$thearray);

//Example:
$array = array(4 => 'four', 3 => 'Three', 2 => 'Two', 1 => 'One');
var_dump($array);
$array = array_merge(array(),$array);
var_dump($array);
        

View more - Centering the content of a page
Posted by andphe on Fri May 14 21:48:37 UTC 2010. Language css

body {text-align: center;}
#wrapper {width:960px;margin: 0 auto;text-align:left;}

<body>
<div id="wrapper">
 ... blah blah blah
</div>
</body>
        

View more - Botón con efecto hover usando un A y que funciona en todos los navegadores
Posted by andphe on Thu Mar 25 22:04:11 UTC 2010. Language css

/*
*  Notas:
*
*  - Es mejor usar un texto para el enlace porque es mas semántico
*  - En el ejemplo la imagen tiene 48px de lado
*/

<a href="destinodelenlace.html" id="boton">Texto del enlace</a>

#boton{
        

View more - Centering vertically a span within a label
Posted by andphe on Wed Feb 24 21:40:34 UTC 2010. Language css

/*This css contains hacks for IE, you could put the styles that begins with * under his own stylesheet for IE.

this centers vertically a span within a label <label for="foo"><span>foo</span></label>, tested in Chrome, Firefox 3.6, IE6, IE7, IE8

*/
label {
    display: table;
    *display: block;
    *position: relative;
    width:105px;
        

View more - Generar archivos para MS Excel en CakePHP usando PHPExcel
Posted by andphe on Sat Feb 20 01:05:10 UTC 2010. Language php

<?php
/**
* Esta vista genera al vuelo un archivo en formato MS Excel 2007
* restringiendo los valores que las columnas de los atributos
* pueden tomar.
*
* Requiere http://phpexcel.codeplex.com/ instalado la carpeta 
* app/vendors
*
*/