Force www rewrite on nginx

download

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 MacUpdate.com (https://www.macupdate.com/app/mac/34332/cloud).

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: http://jstherightway.org/


Starbucks caught storing passwords in clear text

http://www.computerworld.com/s/article/9245438/Evan_Schuman_Starbucks_caught_storing_mobile_passwords_in_clear_text_?taxonomyId=17&pageNumber=1


Test your Web Apps without writing code…

http://www.tryhoudini.com/


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

Try this:

(Assuming error_log() is your error logging function)

error_log(print_r($myArray,true));

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


Angular JS gotchya!

http://blog.releaseboard.com/2013/12/angular-js-gotcha-2-html5-mode.html


Follow

Get every new post delivered to your Inbox.