zen of coding

Type checking vs too much typing…

This had me pondering for a minute. Quite often I write code along the lines of: public function doStuff($stuff, $complex = FALSE) {   if ($complex) {       echo ‘Doing complex stuff<br />’;   } else {       echo ‘Doing simple stuff<br />’;   } }[…]

Read More »

Show git branch in your bash prompt

Quite a convenient little snippet. Thought I would share it with all my dear readers and git lovers. (Thanks to the original author, whom I cannot remember right now. I’ll gladly post the link to the original source if someone reminds me) Add the snippet below to your .bash_profile (Don’t[…]

Read More »

Helpful jQuery modals

This post is actually mostly about jQuery (with some cake sprinkles), but why not… Let’s examine a typical situation: We have a Product model, which belongsTo a Category model. Now we need to add some products… An admin interface would have a category select input (or drop-down) and a few[…]

Read More »

Very hacky way to get client’s country code based on IP

You’d think that by now there should be an easier way to accomplish something like this. (i.e. Send a client IP to some service, and get their country or other location information). All my research just pointed to some some API’s, complicated components and way to much extra leg work[…]

Read More »
%d bloggers like this: