Useful code to highlight text occurences in search results or in a text. How to highlight text in a string with PHP and regular expression? Here is the solution:
Adding rel=”nofollow” to external link is a good SEO practice.
This PHP function lets you reorder records on a table when you have a field used for save the position. If you have a field with position when you are editing records you probably want, for example, to move a record from position 5 to position 2, but if you already have a record in […]
Building a spider or a bot needs some knowledge of regular expressions, you must know and use preg_match or preg_match_all to selectively find tags and extract informations from the html source. Sometimes, while I was watching the html code of a page, I’ve been thinking “If I could only use jQuery to get it! It […]
This small function returns an encoded string to embed images, inline, inside your html/css code and reduce the number of calls to the server and speed up page load. Example of usage to inline an image:
If you need an Email Validator Function, consider this version that includes also the check against common temporary mail services which should be blocked, since their emails work only for some minutes. Temporary emails services are web sites that let you open an anonymous email account that works only for a session. They are used […]
Instagram has an official API to interact with its database of images and users. If you have enough time to understand oAuth protocol and build a bunch of functions to deal with instagram API, that’s the best way… But if you need just a minimal integration and you need to go fast, probably it’s enough […]
More than two years ago I wrote a post about sending push notifications from php to an iOS app called Pushme.To. That code, now, no longer works, and Pushme.to service no longer exists. Now I’m using an Android device and so, I’m going to show you how to send push notifications in a simple way […]
Cron is a software utility, a time-based job scheduler in Unix-like computer operating systems. People who set up and maintain software environments use cron to schedule jobs to run periodically at fixed times or dates. Sometimes, as a developer, I don’t have access to the server at a deep level and, for example on some […]
Small PHP code snippet to make a quick detect if the browser that requests your page is on a mobile device. If it’s a mobile device (that is to say an iphone, an ipad, an android or a blackberry) returns the $device variable. Else it returns false.