David Jones » New Zealand Ruby on Rails Developer

Out with Photoshop and in with Pixelmator

Abobe Photoshop is the industry standard image editing software, but today I’ve made the switch to Pixelmator.

Photoshop isn’t that fast on a Mac nor is it very “Mac-like”. And this is where I find Pixelmator really good. It’s simple, insanely fast to startup and takes about 2 seconds to learn if you know Photoshop. Everything is pretty much in the same place as Photoshop which I imagine is why Gimpshop has become so successful. And I really love the black interface they’ve slapped onto it.

For US$59 ($NZ78.74) it’s a steal in comparison to Photoshop so consider making the switch if you’re on a Mac!

How to Fix Validation Alignment Issues in Rails

Here’s a real quick tip which fixes a problem I’ve come across time and time again.

Consider the form below:

Wine Form

Continue reading

How to add Cropping Support to Acts_As_Attachment

Acts_as_attachment really kicks arse when it comes to handling files and images in your Rails application but one thing the file_column plugin has over acts_as_attachment is cropping support. Time and time again at work we have a space in the design for an image which has to be a certain size. By that I mean it must have a set width and height. But the client needs to be able to put any image they want into that space. But what if they upload a bigger image? Or, what if it’s different aspect ratio?

Continue reading

How to Test Change with assert_difference() in Rails

The Rails core team have really been kicking out some cool stuff recently. One addition I’ve been taking full advantage of is the assert_differnce() method (changeset here). This method is only available to those of you who are using Edge Rails.

If you need to test something that changes, then assert_differnce() is perfect. Below is a typical example of something changing. We have a user class and we want to test the destroy method to make sure the user really does get destroyed.

Continue reading

6 Style Guidelines for CSS

It’s important to keep a consistant style when writing CSS. When you have a team of developers you might want to consider writing a guideline that everyone follows and agrees to.

Here are some guidelines I follow…

Continue reading

How to Reduce the Size of your PNGs with CrushPNG

According to Roelofs, it’s a popular misconception that few browsers support PNG. In fact, Microsoft Internet Explorer, Netscape Communicator, and Opera have supported it since 1997.

Roelofs is right, however, full alpha transparency support didn’t exist in Internet Explorer until version 7. With this new support for transparency, the advantages of using PNG only become more and more obvious.

However, the plot thickens when you save a PNG file from Adobe Photoshop. Photoshop does a poor job of compressing PNG images properly.

CrushPNG to the rescue! CrushPNG is a lossless PNG optimiser that will reduce the size of your PNG images in a flash.

To install with Ports simple run:


sudo port install crushpng

Otherwise, download it from here.

Continue reading

How to Export All Your Products From Shopify in XML

As part of some on the side work I’m doing for Hanafins, I needed to syncronise products added in Shopify with Telecom’s Ferrit ecommerce system. To do this, you need to be able to export all the products out of Shopify. This isn’t easy as the Shopify API isn’t ready yet.

In the meantime, use the script below to emulate a browser logging in and request the products.xml file.

Continue reading

How to use RSS to Keep an Eye on your Clients

Sometimes when I have completed a website for a client, I wonder if they are really using it correctly. With some clients, you can build them the coolest backend but they don’t use it to its fullest extent. It’s not that they are stupid, but perhaps something was overlooked which is making it difficult for the client.

If you give a client the tools to update a website themselves you’d like to hope they will actually take advantage of your hard work.

This is where I have found RSS handy in my latest project.

Continue reading

Google Sitemaps in Ruby on Rails

From Google’s website

“If your site has dynamic content or pages that aren’t easily discovered by following links, you can use a Sitemap file to provide information about the pages on your site. This helps the spiders know what URLs are available on your site and about how often they change.”

I thought it would be a good thing to have Google Sitemaps integrated into some of my Ruby on Rails projects. Because Ruby on Rails has excellent XML support, I went ahead and implemented Google Sitemaps into one of my latest projects.

Continue reading

How Would a Business use Blogging as a Customer Relationship Management Tool?

Have you ever wanted to start a blog for your business? If you have, this is a must read before looking any further. This white paper which I wrote as part of my degree, will fully educate you on how you can gain more business from creating the right type of blog for your business.

Continue reading

Processing Credit Cards in New Zealand using Ruby on Rails

Up until now, New Zealand based online stores using Ruby on Rails had to use Paypal to process credit cards. Today, I’m releasing support for a new gateway to Active Merchant which uses a local online payment company called Payment Express.

This has opened up New Zealanders to Shopfiy, one of the best web 2.0 applications around.

Continue reading