jquery+php regex checker and reverse geo-coding service
It happened a million times: I had to check a regex in PHP and did not have a handy tool to see the result. I usually linger on Rubular, which is a great service but based on Ruby, and sometimes the results are a bit different. I decided to implement a simple regex checker similar to Rubular, but based on php preg_match. Another service that I need to use daily is reverse geo-coding, adding an easy way to find latitude and longitude of a specific point on the map, again there are tons of services around, but none is really what I needed. So I decided to develop my own, and share them (you might break them easily, they're just simple tools for manual use, hence there are API limits, and security wasn't my focus, so please don't hit them too hard). I might add a few things from time to time, depending on my needs, but feel free to drop me a line if you either want to contribute or feel something really missing.
PHP + jQuery Regex checker
reverse geo-coding
wordpress authentication – redirect after incorrect login
Few days ago I had to deploy a simple wordpress installation for a project at @therumpusroom_ with my buddy @twentyrogersc. Super simple, yet it presented a little issue: having a personalized authentication form, displayed on a wordpress page, it was re-directing to the default login screen after specifying incorrect credentials. It came out that we needed to implement the whole authentication mechanism on a page, hence tweaking the simple post form to send data to itself instead of submitting to wp-login.php (which, btw is working fine if users provide the correct credentials, and also accept a redirect parameter to make users land on a pre-determined page).
Anonymous functions with PHP / Eclipse
Eclipse is a great IDE, I don't know how could I live without it, but when it comes to PHP development, the PDT plugin shows some flaws unfortunately. It may happen that you need to declare an anonymous function and get a "compiler" error, as shown below:

just ignore it, the code is working perfectly well, so declaring an anonymous function will not give any problem, you just need to cope with the little red error message until the end of the project (or declare the callback as an identified function).
Below the code to declare the inner function for array_filter:
foreach( $sem_clusters as $sem_cluster ) {
$terms = explode(';', preg_replace('/\"/', '', $sem_cluster->terms_meta));
$terms = array_filter( $terms, function($value) { return strlen($value) > 2; });
$tf_idf = array_merge( $tf_idf, $terms );
}





















