Create a file called twitter-proxy.php and place it somewhere publicly accessible on your server.
Be sure to update the $config variable with the tokens, keys and secrets provided by Twitter when you create an app on their developer site (this is free).
This is a handy little terminal script I’ve used a lot recently which lists the current active connections on OSX. It’s really handy for seeing if Apache / Node.js / Ruby stuff is running on ports correctly.
I am a big fan of podcasts, here is a handful of really good podcasts that I’ve been listening to over the last month on my commute to work. If you use Google Reader (With Google Listen), you can quickly subscribe to this via the bundle I created.
MySQL always surprises me in the sheer amount of stuff you can do in it. For example I recently found it has a bunch of String Functions. The main one I found to be useful was the REPLACE function, which works like this:
Fast loading times are a really important factor when it comes to website ranking, so it’s important to remove as much unnecessary data as possible. A good method to do this is via cookieless domains.
Cookieless domains are (as the name suggests) are domains, in which the user will not send cookies (Which can add quite a few kilobytes to a request). For example, say I want a user to load a static image it would be silly of them to also send me the cookie data. Luckily they are super easy to set up.
It may surprise you to hear, that using the mysql_connect() function in PHP has recently be marked as “old hat” coding because it’s slow in comparison with newer methods. A better alternative is PDO (PHP Data Objects), a lightweight method for accessing databases. Here is a quick overview to help you get started with PDO.
Reasons to use PDO
It’s Fast - it talks to the database via a database specific PDO-driver.
It’s Object Oriented – The methods within the class are the same for each database driver, so you can easily change your database driver without lots of extra coding.
It’s Flexible- You can easily change between such database drivers as PostgreSQL, MySQL or SQLite by pretty much just changing your construct statement.
It’s Safer – PDO encourages you to bind parameters to your SQL query’s, meaning that it’s significantly less likely your website will suffer from a SQL injection based attack.
In a nutshell, these methods behave exactly the same as the jQuery selector but comes integrated into the browser, meaning you input the CSS selector (e.g. “#myDiv” or “.MyClass”) and out pops the first element in the tree, or a StaticNodeList of the elements (depending on whether you use the All part) .
In a nutshell they are a group of PHP functions why can be used to check strings to see if they are alphanumeric, numeric etc without using regex (So they are fast!). The key thing to remember is that they return TRUE or FALSE, unlike filter_var which returns FALSE or the string.
Here is the code example:
Validating an email address is a great way to reduce spam on your website, but there are several methods to do it. You could use a messy regex approach or alternatively you could also use PHP built in functions, it’s really up to you. Here is the function I use: