I recently wanted to set up a system to allow a client to edit sitewide configuration settings on a custom CodeIgniter site. I didn’t want to hardcode it in a configuration file and I wasn’t sure exactly how it would need to be added to in the future. I decided to use a system much… Continue reading Sitewide settings in CodeIgniter
Month: January 2013
Removing duplicate “Open with” applications on the Macintosh
Starting with Mountain Lion, I have noticed that I will often see the same program listed multiple times when right-clicking on a document to use the “Open With” functionality. For example, I just updated TextMate (which seems to be updated very regularly lately) and my Open With menu looked like this: To fix this problem,… Continue reading Removing duplicate “Open with” applications on the Macintosh
Setting UTF-encoding with a PHP header
Sometimes, I need to write a one-off PHP script to export/import data from a database, for example. Since I am not using any kind of front-end interface, I have found that I sometimes have to specifically set the encoding on the page to avoid any extended character issues with the database. I use: header(‘Content-Type: text/html;… Continue reading Setting UTF-encoding with a PHP header
Protect a cron job from outside access
I recently set up a PHP file that generates an XML-formatted sitemap for a dynamic site and set up a cron job to update the sitemap from time-to-time. I didn’t see any reason to allow outside access to executing the script, so I looked into using .htaccess to restrict access to the script. It turns… Continue reading Protect a cron job from outside access
Tweaking the inline style of an element in Firebug
One thing that I always like about Chrome’s Web Inspector over Firebug in Firefox is that in Chrome, there is an easy way to tweak the CSS of an individual element by editing its inline style. It is always available right at the top of the CSS editing tools in Chrome and I always… Continue reading Tweaking the inline style of an element in Firebug
Coda 2 – Searching multiple files
I have seen a few people post in the Coda Users discussion group and had a friend of mine recently mention that they did not know how to search multiple files in Coda 2. Here is how to do it. You can either use the keyboard shortcut for Find in Files, Shift-Command-F, or select the… Continue reading Coda 2 – Searching multiple files
Right aligning an image with a caption for Outlook HTML email
If you ever wanted a nostalgic trip back to the early days of web development, I recommend coding an HTML email. Nothing brings back the memories of table-based layout like creating an email. Before it was Netscape 4 that we had to worry about… now, we have the joy of working with Outlook’s Word-based HTML… Continue reading Right aligning an image with a caption for Outlook HTML email
Finding the perfect text editor
I have kind of a reputation for not being able to decide on a text editor. Name it and, if it is on the Mac, I have either tried it or perhaps even own it. The text editors that I own for web development are Sublime Text 2, Coda 2, BBedit 10.5, TextMate, DreamWeaver and… Continue reading Finding the perfect text editor
TextMate line number glitch
A rather annoying bug that I keep running into with the TextMate 2 alpha is that the highlighted line number in the line number column often doesn’t represent the actual line I am on. Here is an example: It seems pretty re-create-ableĀ and, to get it to go away, I can simply scroll with the… Continue reading TextMate line number glitch