Cloning a base project in PhpStorm

2013-09-17

When I first started using PhpStorm (my current IDE) I noticed that I was applying a number of the same project-specific settings during each new project. Being a good (i.e. properly lazy) programmer, I figured that this should be automatable, so I dug into the project metadata that PhpStorm keeps in each project's .idea directory (at least on OS X). I found that with a few string substitutions I could create a template project with all the settings the way I like them, and then clone that metadata directory into each new project I created. You'll find a sanitized version of the script I use in this Github repo. Hope it saves someone out there some time.

Tags: phpstorm, script

Rel=disavow for Twitter

2013-06-23

Last night I was thinking about links posted on Twitter, and how many people I know will regularly or semi-regularly post links to things that they are not endorsing, in the "look at this flaming pile of idiocy" sense rather than the "check out this cool thing" sense. I know Twitter automatically adds rel="nofollow" attributes to outbound links from tweets, but that still doesn't mean that a user clicking on that link isn't providing the destination site with views/hits/ad impressions/etc. It got me wondering if there was a better way to point out notably awful things on the web without rewarding the destination site.

The first thing I was hoping for is something like rel="disavow", similar to what Google put together in their webmaster tools site, only for outbound links instead of inbound. Then again, any link relations would likely be stripped by (or inadvertently targeting) t.co. I eventually came to the conclusion that the only thing to do was hope that like-minded internet users use an ad blocking software or (possibly) link to Google cached versions of the pages instead of their live sites, which also has the benefit of storing the offending content for longer if the owner tries to change or remove it.

So I'm wondering... am I over-thinking this? Does my desire to see sites without rewarding them make me a bad internet user? Some sort of, dare I say it, pirate?

Edit: good enough for me: http://www.donotlink.com/

Testing Practices for Exceptions in unit tests

2013-05-15

Back in 2011 I published a post claiming that using anything but try/catch in unit tests was a bad idea. Since then, after having more discussions with others in the field and reading Chris Hartjes's post about try/catch being a bad practice in unit testing, I've realized my initial post on the topic was a bit short-sighted and didn't explain my views as well as I thought. It also contained no examples. I've decided to post some clarifications here, as well as sum up the arguments on both sides based on Chris's post and the comments.

Read more of this post »

Tags: php, phpunit