Thursday, May 24, 2012

When to use array_merge and union operator (+) in PHP?


array_merge

Use array_merge when you want to merge indexed arrays without keys:


Output:


Array Union Operator (+)


Use the union operator when you want to extend an array or override certain key values. A good use case for this is overriding/extending a default settings array with a user defined array (similar to how you would use $.extend while writing a jQuery plugin):


Output:



References


Saturday, May 19, 2012

Designing Your Startup

This is the video of my talk at Agile India 2012 (it's missing about 5-10 minutes from the beginning). I'm totally winging it, so I've goofed up a lot, but in the spirit of shipping, here it is:

Monday, May 07, 2012

Compatibility is Contextual

I've come to realize that when people don't get along, it's almost always because of the context. The same people get along very well when their context changes. We are not incompatible with people, just the context we find ourselves with them in.

Happiness Efficiency

Consider two types of people: The kind that have big goals and derive happiness by achieving them and the kind that derive happiness from the little things in life. The latter IMO, is more efficient.

Sunday, May 06, 2012

Using Silence for Notification

I keep my phone on silent when I'm listening to music on it. So when someone calls, the phone stops playing music and there is silence. I did this to flip the concept of notification that I'm used to. In a world where more and more things are real-time and crying out for attention via audible alerts, it's refreshing to use silence for notification.