PHP: How to detect bot user agents

This regular expression checks if the request came from a regular browser (or someone presenting with one), or if the request was made by a bot or crawler. I know my websites don't have any credible traffic from China, so I assume all these request are coming from bots.

function isBot() {
    return (
        isset($_SERVER['HTTP_USER_AGENT'])
        && preg_match('/bot|crawl|slurp|spider|mediapartners|Mb2345Browser|LieBaoFast|MicroMessenger|zh-CN|zh_CN|Kinza/i', $_SERVER['HTTP_USER_AGENT'])
    );
}

How to open file with mouse click on Mac – Razer Synapse

There is no direct way to assign one of your mouse buttons to open a file (that you open often). Fortunately, one of the other actions can be used for this:

Read more...

Simple GIT workflow

Today, I would like to give you small insight into production scheme we use at 2day. This scheme consists of one production server, one testing server and several development instances, depending on the number of programmers working on a project. Read more...

How to add links to Scope portfolio types

Scope's portfolio page is a perfect example of Isotope exquisiteness. Only thing that I missed was the possibility to link directly to a specific portfolio type (eg. link from Homepage directly to Photos in my Portfolio, sending link to a friend..). The only way I found to do this, was to link directly to the post type page (/portfolio-type/photos/), but you were not able to see animated list of the other portfolio types there anymore... So, how to solve this problem without breaking no-javascript compatibility? And wouldn't it be even cooler, if you had hash history and bookmarkable links, too? Read more...