In the fairy tale Rumpelstiltskin, the afore-named magical creature spins straw into gold.

That image came to mind during a recent visit to Cuba, a country that if not actually turning anything into gold, has certainly “seized victory from the jaws of defeat,” more than once in the 50 years since January, 1959.

The first few months of the revolution, which overthrew the bloody Batista regime, saw some huge changes, the ones you’d expect: land reform, the start of a massive literacy campaign, a judicial overhaul.

Not long after, as the young revolution struggled to implement ambitious plans to feed, house, employ and educate the entire population, it also nationalized land, properties and big enterprises, many of whose owners fled with Batista, cleaning out bank accounts before they left.

For most Americans, that’s the end of the story of how the revolution changed Cuba, but in fact it was just the beginning.

What struck me most in the short time I spent there was the way that the revolution has coped, time and time again, with huge problems, both man-made and natural. Cuban socialism has “taken a lickin’ but kept on tickin.”

The biggest example is that they survived the economic disaster produced by the collapse of the Soviet Union and the other European socialist countries in the early 90s. Almost from one day to the next, Cuba found itself out of gas, fertilizer, and technical assistance, pesticides, spare parts, credit, shipping access.

But they were not out of energy and creativity – and so the big state farms were split up, into much smaller cooperatives. Alongside traditional methods (like using oxen for plowing), innovative techniques were developed. Transportation was organized; people from urban areas, and students were once again brought to help with the harvests.

The Cubans had to develop organic farming methods out of necessity – but they have done it so successfully that they now host conferences on sustainable agriculture – an achievement for what they themselves describe as a poor, developing country.

Last year, the country was hit by three hurricanes – two of which swept from east to west, causing unprecedented destruction; in some areas, crops and housing were completely lost.

And so the production of food has continued to be a problem, and the revolution is again innovating, offering city-dwellers the opportunity to become farmers, with free land, credit, and assistance. And there are also urban farmers – people who take over and farm unused parcels of land within the cities.

Another example of how the Cuban revolution has adapted and changed is on the problem of housing.

For a long period after the revolution, the construction industry was devoted to building clinics, schools, hospitals, etc. But at a certain point the problem of inadequate and substandard housing reached a crisis, and so there was a shift, and plans were made to build 50,000 new housing units annually.

Progress had been made towards that goal, but last year’s hurricanes destroyed 400,000 housing units. So once again, there has been a shift in policy and approach, towards trying to make up that extra-large deficit. Families are being given materials to build or repair their own homes. Research is going on to develop new building materials that are both stronger and lighter. And the government has responded to people’s complaints about buildings in Havana that were reserved for official use, releasing some of them for public housing.

With mainly sugar and nickel to trade, and being a small country, Cuba has invested heavily in the field of health care, training tens of thousands of doctors and other medical personnel, whose work (including research and development of new biomedical products) has brought income to the economy and won their country the respect and admiration of people around the world.

How have they been able to spin gold from the straw that history and geography gave them?

Cuba’s most valuable resource – its people – has also been its top priority, and from the early days of the revolution, its aim has been to provide every Cuban with an education, health care, food, employment, and shelter. And so Cuba has become an ownership society — not in the way George Bush meant the phrase! – rather, in that the majority of the Cuban people have a sense of ownership — of their revolution, their government, their fate. No one’s skills, talents or energy are wasted due to inequality or poverty – and that’s pure gold.