Sometimes it takes a jolt.

Superstorm Sandy wasn’t as bad as it could have been. Yet after the gusts exceeding 80 mph and storm surges had died down, millions of people were left without power and the eastern seaboard faced nearly $50 billion in property damage. Much of that damage was in New York City.

Huge swathes of Breezy Point burned down. Water surged through the streets of downtown Manhattan and along the outer borough coasts, where sand and muck filled single-family houses. Seniors were stranded in the Rockaways. A midtown crane dangled. And local politicians, from Democrats to hard-hit Staten Island Republicans, quickly began pushing to fund the cleanup and ways to mitigate the effects of future extreme weather.

Apparently President Donald Trump, a New Yorker born and bred, missed the memo.

Trump’s mistake

Trump, who campaigned on a vow to “cancel” the Paris Agreement, the landmark 195-nation accord in which countries agreed to reduce their greenhouse gas emissions sufficiently to avoid climate disaster, has spent the week mapping out that “cancellation.” Climate and foreign policy experts on both sides of the aisle have called it a disastrous decision that, at best, reduces American standing around the world. At worst, the move could encourage other nations to renege on their bare minimum commitments, meaning emissions wouldn’t dip enough to avoid climate change’s worst effects.

But is it surprising for the man who busied himself in the aftermath of Sandy tweeting that due to the disaster, he’d extend the deadline for the contest he was then holding: $5 million for the release of President Barack Obama’s college records and applications?

The businessman eventually tweeted about giving away coffee and food to those who needed it in Trump Tower atrium, yet the Daily Beast reported that he also made staff from his reality TV show, “The Apprentice,” trek to work with the subway and much of the city shut down.

Months later, he abandoned a years-in-the-making plan for a Jones Beach catering hall due to fear of future storm damage.

He still had years ahead of him as a social media commentator as opposed to the leader of the free world intent on abdicating leadership responsibility. In the meantime, NYC did what it could to prevent destruction from future storms.

NYC is still working to recover — and prepare

That included a robust $20 billion plan from Mayor Michael Bloomberg, later expanded by Mayor Bill de Blasio.

Sandy was a “pivotal moment for the city,” says Daniel Zarrilli, the mayor’s senior director of climate policy and programs who served both mayors in climate resilience roles after the storm.

Bloomberg’s 2013 plan included initiatives like shoring up critical infrastructure at NYCHA developments, upgrading city hospitals and elevating homes. Some have moved slowly, but many of the larger projects are underway.

Rebuild by Design, a federally subsidized contest for ideas to make a city built on islands more resilient in a world of rising oceans resulted in projects like “The Big U,” which will lift sections of East River parkside along the FDR drive to slow water before it hits the city proper. Zarrilli says groundbreaking is expected in late 2018 or early 2019.

This week, Gov. Andrew Cuomo identified funding from the most recent budget for a sea wall to protect Staten Island’s east shore — a ceremony at which the current and past (non-Democratic) borough presidents were in attendance.

These physical changes are one part of the puzzle, but NYC is also looking to reduce greenhouse gas emissions. De Blasio announced an “80 x 50” campaign to reduce city emissions 80 percent by 2050 through changes to the city’s building codes and vehicle fleets, among other fixes.

That will all be necessary because cities face particular threats from climate change, says Nilda Mesa, the former director of the Mayor’s Office of Sustainability who heads Columbia University’s Earth Institute Urban Sustainability and Equity Planning Program.

Threats include “heat islands” dangerous to senior citizens and those with respiratory problems in treeless, concrete-bound sections of the city. And, of course, flooding — due to our coastal setting and miles of asphalt that leave nowhere for the water to safely seep.

“Cities can do a lot,” says Mesa — climate advocacy network C40 estimates American cities working together can amount for 6 percent of emissions reductions necessary to keep the Paris Agreement target of a 2.7 degrees Fahrenheit increase. “But they can’t do all of it.”

The rest of the work must be done at the national and international level — exactly what the Paris Agreement sets out to do. On Wednesday, on the eve of hurricane season’s Atlantic start, de Blasio committed NYC to the 2.7 degrees Fahrenheit target of Paris, Trump or no Trump.

That’s good New York common sense, faced with floods and storms that we’ve already seen and want to avoid, but it’s by definition only a small step. Shame on the president, who could do more, for swamping the boat.