While working on an address form for a rails project, I came across this nasty little task of building an array of country, state, and province codes.  I ended up downloading PayPal's official list of country, state, and province codes from their API documentation and making the following:

Country codes:

U.S. state codes:

Canadian province codes:

Other state/province codes:

Hopefully this saves you the time you would have spent converting PayPal's lists of codes into ruby arrays.

Enjoy!