How do you beat Wheatley in Portal 2?

Quick answer: Let a bomb break the Conversion Gel pipe, then send his bombs back into him through portals. Use Repulsion Gel to reach his body and attach each corrupted core to the blinking red light.
Show walkthrough (story spoilers)
Break the gel pipe
At the start, hide behind the white Conversion Gel pipe in front of you. One of Wheatley’s bombs breaks it, and the gel covers the area so you can place portals there.
Bounce bombs into him
Put one portal on the floor near you and the other on one of the panels hanging from the ceiling, aimed at Wheatley. Stand behind the floor portal so a bomb falls into it. It flies out of the panel portal and stuns him.
Attach the cores
When Wheatley is stunned, a corrupted core arrives: first the Space Core, then the Adventure Core, then the Fact Core. Grab it, bounce on the blue Repulsion Gel to get close to his body and point the core at the blinking red light. It plugs in by itself.
Later stages
Each round gets harder, and bombs rain down during a countdown. Place portals under Wheatley and on the floor so his bombs hit him from below. A pipe of orange Propulsion Gel also bursts, which lets you run fast along the runway.
After the third core
With all three cores on, the Stalemate Resolution Annex opens. Get inside with portals to start the core transfer. See the Part Where He Kills You walkthrough and how to shoot the moon for the finish.
