Force www rewrite on nginx


The best thing for this I’ve found is to setup two server directives in nginx :

  • sudo mate path_to_nginx.conf (sudo mate /usr/local/etc/nginx/nginx.conf) – if you are on Mac and using TextMate (highly recommended by me, it’s a great editor)
  • first directive: server{
    server_name my_domain.local;
    if ($host !~* ^www\.) {
    rewrite ^(.*)$ http://www.$host$1 permanent; #rewrite to force www
  • second directive:server {
    server_name http://www.my_domain.local;
    listen 80;
    root /usr/local/var/www/projects/www.my_domain.local;
    index index.php; #the rest of your fpm config follows…. }

Mac Developers: Share screenshots automatically

At MacUpdate, I use a really slick tool to share screenshots when collaborating with our team.  The App is called ‘Cloud’ and you can get it on (

Once installed, make sure you have the option set to share screenshots automatically.  Once you have that setting confirmed, you can share a screenshot with the key commands, cmd+shift+4 then drag the pointer selection to the area you want a screenshot of and Cloud App (located up in your apps bar) will push out your screenshot to a shortened url and Growl will notify you when it’s ready; just click the Growl alert (or the Cloud App link in your apps bar) and the c/p the url to share.  There is also a sharing button once you visit the shortened url for sociables and what-not.

Javascript The Right Way

Some good patterns and best practices:

Starbucks caught storing passwords in clear text

Test your Web Apps without writing code…

Ever need to see an array in your Error Logs in PHP?

Try this:

(Assuming error_log() is your error logging function)


Pretty cool!  Now can debug those pesky multi-dimensional arrays in your logs…

Angular JS gotchya!


Get every new post delivered to your Inbox.