Getting Bash Right on Your Mac

Posted on Oct 15, 2016 in Code Samples | 0 comments

If you spend a lot of time maintaining your servers, you probably have a few aliases and other bash-shell tweaks that you’d like to be part of your terminal experience on your Mac. For years I have been frustrated that my alias for l=’ls -la’ doesn’t seem to get executed even though it is in my .bashrc file!

SOLUTION: It turns out that bash on your Mac terminal doesn’t automatically read .bashrc so you have to force it. To do this, add the following to your .bash_profile file:

[[ -s ~/.bashrc ]] && source ~/.bashrc

And Voila! Every time you enter terminal now your .bashrc will be executed.

You’re welcome. 🙂

Read More

Useful Code Tip – Clearpixel

Posted on May 14, 2014 in Code Samples | 0 comments

Even in today’s CSS3 world, it is often useful to use the old ‘clear pixel‘ trick to create gaps and spaces of finite pixel widths. But often, in the middle of a project, it is difficult to find that old single pixel transparent GIF file and get it into your images directory.

There is an easier way! Use the base 64 encoded version Just keep this string handy…


Use this as the image “src” attribute and you’ll have instant clear pixel of width 1 to use as you like.

A php example:

$clr =”data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAA

<img src=”<?=$clr?>” width=”20″ />

creates a gap of 20 pixels.

NOTE: The string had to wrap to fit this blog post. Please be sure to use both parts!


If you have a tip for me to share, let me know.


Read More