Skip to content

Instantly share code, notes, and snippets.

@marcusbaguley
Created February 14, 2010 21:03
Show Gist options
  • Save marcusbaguley/304261 to your computer and use it in GitHub Desktop.
Save marcusbaguley/304261 to your computer and use it in GitHub Desktop.
Country,CountryCode,Currency,Code
New Zealand,NZ,New Zealand Dollars,NZD
Cook Islands,CK,New Zealand Dollars,NZD
Niue,NU,New Zealand Dollars,NZD
Pitcairn,PN,New Zealand Dollars,NZD
Tokelau,TK,New Zealand Dollars,NZD
Australian,AU,Australian Dollars,AUD
Christmas Island,CX,Australian Dollars,AUD
Cocos (Keeling) Islands,CC,Australian Dollars,AUD
Heard and Mc Donald Islands,HM,Australian Dollars,AUD
Kiribati,KI,Australian Dollars,AUD
Nauru,NR,Australian Dollars,AUD
Norfolk Island,NF,Australian Dollars,AUD
Tuvalu,TV,Australian Dollars,AUD
American Samoa,AS,Euros,EUR
Andorra,AD,Euros,EUR
Austria,AT,Euros,EUR
Belgium,BE,Euros,EUR
Finland,FI,Euros,EUR
France,FR,Euros,EUR
French Guiana,GF,Euros,EUR
French Southern Territories,TF,Euros,EUR
Germany,DE,Euros,EUR
Greece,GR,Euros,EUR
Guadeloupe,GP,Euros,EUR
Ireland,IE,Euros,EUR
Italy,IT,Euros,EUR
Luxembourg,LU,Euros,EUR
Martinique,MQ,Euros,EUR
Mayotte,YT,Euros,EUR
Monaco,MC,Euros,EUR
Netherlands,NL,Euros,EUR
Portugal,PT,Euros,EUR
Reunion,RE,Euros,EUR
Samoa,WS,Euros,EUR
San Marino,SM,Euros,EUR
Slovenia,SI,Euros,EUR
Spain,ES,Euros,EUR
Vatican City State (Holy See),VA,Euros,EUR
South Georgia and the South Sandwich Islands,GS,Sterling,GBP
United Kingdom,GB,Sterling,GBP
Jersey,JE,Sterling,GBP
British Indian Ocean Territory,IO,USD,USD
Guam,GU,USD,USD
Marshall Islands,MH,USD,USD
Micronesia Federated States of,FM,USD,USD
Northern Mariana Islands,MP,USD,USD
Palau,PW,USD,USD
Puerto Rico,PR,USD,USD
Turks and Caicos Islands,TC,USD,USD
United States,US,USD,USD
United States Minor Outlying Islands,UM,USD,USD
Virgin Islands (British),VG,USD,USD
Virgin Islands (US),VI,USD,USD
Hong Kong,HK,HKD,HKD
Canada,CA,Canadian Dollar,CAD
Japan,JP,Japanese Yen,JPY
Afghanistan,AF,Afghani,AFN
Albania,AL,Lek,ALL
Algeria,DZ,Algerian Dinar,DZD
Anguilla,AI,East Caribbean Dollar,XCD
Antigua and Barbuda,AG,East Caribbean Dollar,XCD
Dominica,DM,East Caribbean Dollar,XCD
Grenada,GD,East Caribbean Dollar,XCD
Montserrat,MS,East Caribbean Dollar,XCD
Saint Kitts,KN,East Caribbean Dollar,XCD
Saint Lucia,LC,East Caribbean Dollar,XCD
Saint Vincent Grenadines,VC,East Caribbean Dollar,XCD
Argentina,AR,Peso,ARS
Armenia,AM,Dram,AMD
Aruba,AW,Netherlands Antilles Guilder,ANG
Netherlands Antilles,AN,Netherlands Antilles Guilder,ANG
Azerbaijan,AZ,Manat,AZN
Bahamas,BS,Bahamian Dollar,BSD
Bahrain,BH,Bahraini Dinar,BHD
Bangladesh,BD,Taka,BDT
Barbados,BB,Barbadian Dollar,BBD
Belarus,BY,Belarus Ruble,BYR
Belize,BZ,Belizean Dollar,BZD
Benin,BJ,CFA Franc BCEAO,XOF
Burkina Faso,BF,CFA Franc BCEAO,XOF
Guinea-Bissau,GW,CFA Franc BCEAO,XOF
Ivory Coast,CI,CFA Franc BCEAO,XOF
Mali,ML,CFA Franc BCEAO,XOF
Niger,NE,CFA Franc BCEAO,XOF
Senegal,SN,CFA Franc BCEAO,XOF
Togo,TG,CFA Franc BCEAO,XOF
Bermuda,BM,Bermudian Dollar,BMD
Bhutan,BT,Indian Rupee,INR
India,IN,Indian Rupee,INR
Bolivia,BO,Boliviano,BOB
Botswana,BW,Pula,BWP
Bouvet Island,BV,Norwegian Krone,NOK
Norway,NO,Norwegian Krone,NOK
Svalbard and Jan Mayen Islands,SJ,Norwegian Krone,NOK
Brazil,BR,Brazil,BRL
Brunei Darussalam,BN,Bruneian Dollar,BND
Bulgaria,BG,Lev,BGN
Burundi,BI,Burundi Franc,BIF
Cambodia,KH,Riel,KHR
Cameroon,CM,CFA Franc BEAC,XAF
Central African Republic,CF,CFA Franc BEAC,XAF
Chad,TD,CFA Franc BEAC,XAF
Congo Republic of the Democratic,CG,CFA Franc BEAC,XAF
Equatorial Guinea,GQ,CFA Franc BEAC,XAF
Gabon,GA,CFA Franc BEAC,XAF
Cape Verde,CV,Escudo,CVE
Cayman Islands,KY,Caymanian Dollar,KYD
Chile,CL,Chilean Peso,CLP
China,CN,Yuan Renminbi,CNY
Colombia,CO,Peso,COP
Comoros,KM,Comoran Franc,KMF
Congo-Brazzaville,CD,Congolese Frank,CDF
Costa Rica,CR,Costa Rican Colon,CRC
Croatia (Hrvatska),HR,Croatian Dinar,HRK
Cuba,CU,Cuban Peso,CUP
Cyprus,CY,Cypriot Pound,CYP
Czech Republic,CZ,Koruna,CZK
Denmark,DK,Danish Krone,DKK
Faroe Islands,FO,Danish Krone,DKK
Greenland,GL,Danish Krone,DKK
Djibouti,DJ,Djiboutian Franc,DJF
Dominican Republic,DO,Dominican Peso,DOP
East Timor,TP,Indonesian Rupiah,IDR
Indonesia,ID,Indonesian Rupiah,IDR
Ecuador,EC,Sucre,ECS
Egypt,EG,Egyptian Pound,EGP
El Salvador,SV,Salvadoran Colon,SVC
Eritrea,ER,Ethiopian Birr,ETB
Ethiopia,ET,Ethiopian Birr,ETB
Estonia,EE,Estonian Kroon,EEK
Falkland Islands (Malvinas),FK,Falkland Pound,FKP
Fiji,FJ,Fijian Dollar,FJD
French Polynesia,PF,CFP Franc,XPF
New Caledonia,NC,CFP Franc,XPF
Wallis and Futuna Islands,WF,CFP Franc,XPF
Gambia,GM,Dalasi,GMD
Georgia,GE,Lari,GEL
Gibraltar,GI,Gibraltar Pound,GIP
Guatemala,GT,Quetzal,GTQ
Guinea,GN,Guinean Franc,GNF
Guyana,GY,Guyanaese Dollar,GYD
Haiti,HT,Gourde,HTG
Honduras,HN,Lempira,HNL
Hungary,HU,Forint,HUF
Iceland,IS,Icelandic Krona,ISK
Iran (Islamic Republic of),IR,Iranian Rial,IRR
Iraq,IQ,Iraqi Dinar,IQD
Israel,IL,Shekel,ILS
Jamaica,JM,Jamaican Dollar,JMD
Jordan,JO,Jordanian Dinar,JOD
Kazakhstan,KZ,Tenge,KZT
Kenya,KE,Kenyan Shilling,KES
Korea North,KP,Won,KPW
Korea South,KR,Won,KRW
Kuwait,KW,Kuwaiti Dinar,KWD
Kyrgyzstan,KG,Som,KGS
Lao PeopleÕs Democratic Republic,LA,Kip,LAK
Latvia,LV,Lat,LVL
Lebanon,LB,Lebanese Pound,LBP
Lesotho,LS,Loti,LSL
Liberia,LR,Liberian Dollar,LRD
Libyan Arab Jamahiriya,LY,Libyan Dinar,LYD
Liechtenstein,LI,Swiss Franc,CHF
Switzerland,CH,Swiss Franc,CHF
Lithuania,LT,Lita,LTL
Macau,MO,Pataca,MOP
Macedonia,MK,Denar,MKD
Madagascar,MG,Malagasy Franc,MGA
Malawi,MW,Malawian Kwacha,MWK
Malaysia,MY,Ringgit,MYR
Maldives,MV,Rufiyaa,MVR
Malta,MT,Maltese Lira,MTL
Mauritania,MR,Ouguiya,MRO
Mauritius,MU,Mauritian Rupee,MUR
Mexico,MX,Peso,MXN
Moldova Republic of,MD,Leu,MDL
Mongolia,MN,Tugrik,MNT
Morocco,MA,Dirham,MAD
Western Sahara,EH,Dirham,MAD
Mozambique,MZ,Metical,MZN
Myanmar,MM,Kyat,MMK
Namibia,NA,Dollar,NAD
Nepal,NP,Nepalese Rupee,NPR
Nicaragua,NI,Cordoba Oro,NIO
Nigeria,NG,Naira,NGN
Oman,OM,Sul Rial,OMR
Pakistan,PK,Rupee,PKR
Panama,PA,Balboa,PAB
Papua New Guinea,PG,Kina,PGK
Paraguay,PY,Guarani,PYG
Peru,PE,Nuevo Sol,PEN
Philippines,PH,Peso,PHP
Poland,PL,Zloty,PLN
Qatar,QA,Rial,QAR
Romania,RO,Leu,RON
Russian Federation,RU,Ruble,RUB
Rwanda,RW,Rwanda Franc,RWF
Sao Tome and Principe,ST,Dobra,STD
Saudi Arabia,SA,Riyal,SAR
Seychelles,SC,Rupee,SCR
Sierra Leone,SL,Leone,SLL
Singapore,SG,Dollar,SGD
Slovakia (Slovak Republic),SK,Koruna,SKK
Solomon Islands,SB,Solomon Islands Dollar,SBD
Somalia,SO,Shilling,SOS
South Africa,ZA,Rand,ZAR
Sri Lanka,LK,Rupee,LKR
Sudan,SD,Dinar,SDG
Suriname,SR,Surinamese Guilder,SRD
Swaziland,SZ,Lilangeni,SZL
Sweden,SE,Krona,SEK
Syrian Arab Republic,SY,Syrian Pound,SYP
Taiwan,TW,Dollar,TWD
Tajikistan,TJ,Tajikistan Ruble,TJS
Tanzania,TZ,Shilling,TZS
Thailand,TH,Baht,THB
Tonga,TO,PaÕanga,TOP
Trinidad and Tobago,TT,Trinidad and Tobago Dollar,TTD
Tunisia,TN,Tunisian Dinar,TND
Turkey,TR,Lira,TRY
Turkmenistan,TM,Manat,TMT
Uganda,UG,Shilling,UGX
Ukraine,UA,Hryvnia,UAH
United Arab Emirates,AE,Dirham,AED
Uruguay,UY,Peso,UYU
Uzbekistan,UZ,Som,UZS
Vanuatu,VU,Vatu,VUV
Venezuela,VE,Bolivar,VEF
Vietnam,VN,Dong,VND
Yemen,YE,Rial,YER
Zambia,ZM,Kwacha,ZMK
Zimbabwe,ZW,Zimbabwe Dollar,ZWD
FasterCSV.foreach(File.join(RAILS_ROOT, 'db/data/country_currency_codes.csv' ), :headers => true) do |row|
raise "Invalid row #{row.inspect}" unless row.size == 4
currency = Currency.find_or_initialize_by_code(row['Code'])
currency.description = row['Currency']
currency.save!
country = Country.find_or_initialize_by_code(row['CountryCode'])
country.description = row['Country']
country.currency = currency
country.save!
end
@mohitesachin217
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment