Get height of a hidden element using jQuery

It’s known that hidden elements doesn’t take space in the document unless they are not really hidden but invisible, using visibility:hidden.

Sometimes you need to know something about a hidden element before you actually show it, let’s say the height property of a DIV element. You can easily get that property value making the element displayable but invisible, that way the element would take space in the document and you can get the height or any other property value that isn’t available while the element is hidden.

The following code is a small jQuery plugin that takes a function as argument. The plugin clones a jQuery element, make it displayable but invisible, then inserts the clone right after the original element, executes the function on the context of the cloned element and returns the function result. The clone is removed from the DOM after the passed function returns.

[gist id=1085787]

To solve the problem of the height property I explained above you could use the following code:

var height = $('#i-am-hidden').sandbox(function(){ return this.height(); });

How to add a GMail filter for multiple accounts

Let’s say you want to filter messages sent to [email protected] and [email protected] and apply the ‘MyCompany’ label to those messages. You may think that typing the following in the ‘To’ field of the filter will work:

[email protected], [email protected]

but it doesn’t. It doesn’t work with ; either.

In order to add multiple addresses to the filter you have to separate them with a | or wrap them in parentheses and use OR as the separator. The following are working examples:

[email protected] | [email protected]
([email protected] OR [email protected])

The same can be applied when searching email.

Deshabilitar WP-SynHighlight en el contenido mostrado en los feeds

WP-SynHighlight es un plugin para WordPress que permite mostrar codigo fuente con sintaxis resaltada en el contenido de los posts. Este plugin hace uso de GeShi para resaltar el código y por tanto soporta todos los lenguajes soportados por GeShi.

Hoy estaba revisando como se ven los posts  en este blog cuando son leidos desde un  FeedReader como Google Reader o Liferea. El problema con resaltar el código con una solución del lado del servidor como WP-SynHighlight es que no importa como se acceda el contenido, WordPress siempre va a incluir en la respuesta una cantidad de elementos HTML con el mero objetivo de mejorar la presentación. Creo que cuando un usuario está leyendo el contenido a través de un FeedReader está mas interesado en la estructura y el contenido, no tanto su presentación, de otro modo iría directamente a la fuente. Así, enviar contenido con código fuente resaltado a quienes usan FeedReaders me parece innecesario porque a) sin las hojas de estilo utilizadas en el sitio fuente el contenido no aparece realmente resaltado y b) los elementos HTML que antes permitían resaltar el código ahora dificultan que el lector lo manipule: un simple copy-paste da como resultado código mal formado y numeros de línea entre las linea de código. Vea como evitarlo…