Clockwise

by Caleb Jaffa


Archive for the ‘Coding’ Category


Coda Twilight Syntax Highlighting for PHP

I am a fan of using one editor and knowing it well to do everything. I switched to Mac OS X back in the days of Jaguar, and BBEdit was the de-facto standard text editor. My friend who I worked with and was the guiding light was a lifelong Mac user and he felt right at home there. I however found BBEdit lacking for my tastes.

From the first glimpses of TextMate shown to the world in David Heinemeier Hansson’s  first screencasts of Ruby on Rails I was intrigued, and soon to be in love. (I managed to snag license #20 for TextMate.) My favorite color scheme by far is the one called Twilight. Easy on my eyes and still useful for helping work in code.

Along came Panic’s offering of Coda. I surprised myself by purchasing it. Even though the SubEthaEdit editor is not my favorite, it’s the core to Coda’s text editor, I found the integration of SFTP to be an attractive offering, even more so when the file listing gave access to a much improved engine over Panic’s own Transmit. 

On a recent project I’ve been spending more time in Coda as it’s not feasible to develop locally and then push my changes up to the server. I finally broke down after google searches netted me nothing and took the time to change my PHP-HTML syntax highlighting to match Twilight as best I could quickly. I’m sharing my labors with the world cause it might be useful to someone out there. Download the theme file below, go into Coda’s preferences, select the PHP-HTML language and click on import to use this theme.

Update:

I’ve made a few minor changes to the declaration and prologue colors (I had left them alone before so they didn’t fit the theme). Also here is a screenshot of how it looks, I use inverted colors and checked that this style can be imported into SubEthaEdit as well as Coda.

php-html-twilightseestyle1.zip

 

Screenshot of Twilight theme/style for Coda/SubEthaEdit

Screenshot of Twilight theme/style for Coda/SubEthaEdit

Transparent GIF

My old friend the transparent GIF has come back in town. I was putting together some updates for Gough Homes home page. While it wasn’t the most extensive search, I settled on using 24 ways to impress your friends’ transparent PNGs in IE6 solution. Part of this solution was the introduction of a transparent GIF. Not ideal, but a worthwhile sacrifice for ease of development.

With that piece of the puzzle in figured out, I decided to switch over to the other major piece. It was a slideshow, which was to use JavaScript and not Flash. It needed to link to a popup showing home plans. Attempts to work within the system to add the onclick event led nowhere. So the simple solution of placing an invisible layer with the proper link above was used. It worked great and simplified things, though obviously not the most ideal solution. That is the chore of the web developer to balance between the ideal and the practical solution that gets the job done efficiently.

The final piece I added to the home page was a location map that had small hover layers when you placed the cursor over a community. The hover popups worked best as PNGs, and hence the search for a good way to use PNGs as transparently as possible to work in all browsers. This is where it got fun as IE7 will not do anchor tag hover if there is no text, even if it is a block level element. Transparent GIF was employed to give IE7 something to hover over and make the layers work.

So it isn’t the ideal solution, but then not all browsers are ideal. It was interesting to brush the dust off of something that used to be abused in the 90′s from the toolkit. However at the end of the day it’s all about, hopefully, providing all users of a website the best experience efficiently.

You can see the magic on the Gough Homes home page, the two additions are the locations and plans.

Mephisto 0.8 to WordPress 2.5.1 Ruby Script

Not long ago I converted from Mephisto to WordPress for my wife’s blog and a blog I keep for my family. At the time I couldn’t find any scripts to automate the process. I did find someone had written a controller to put into the Mephisto code to convert, but it was the controller only and didn’t include the models. I wanted something simpler to run anyway. I’ve put the rough code up on Pastie.

Some notes about how to use it. First off you’ll need to run it on a computer that can access your Mephisto MySQL server and your target WordPress. You’ll need a default WordPress database to point at, I suggest clearing out the “Hello World” type stuff first. It does Mysql.quote on some fields, but not all, these were the fields that caused problems not being quoted for the two test blogs. It uses REPLACE INTO so in case a problem arises you can fix the script to handle the exception and re-run without worrying about duplicate data.

The Heroku Gem and Git

I signed up for the Heroku beta and got in months ago. It was fun to kick the tires, but I never did more than that. The web interface to edit your application is indeed a technical feat, I’d much rather develop with the tools I know and love. Heroku sort of got pushed off in the back of my mind. Today I came across an article talking about playing with heroku by Josh Nichols at his blog Technical Pickles.

Digging around proved that I never did subscribe to the Heroku blog and that it was time to give it another spin. I’ll refer you to the above article for a good overview of the new features. The skinny is that there is a Heroku gem that allows you to interact with your account. Then you can use it to create a local git repository of an application. After editing locally, committing and pushing your changes Heroku will update your application, run any migrations and restart the mongrel process. This certainly make Heroku more appealing to investigate further. The best part is that with git and rails you aren’t necessarily tied to them, should their eventual pricing plans not suit your tastes.