The way I got rid of the gun is the energy ball... You can use the portals to transport the ball and topple it over.
Put a portal above you and one below. You should go in a loop. Place the portal which is currently on the ground to your left so it lines up with the gun. Then put the portal on the ceiling in the path of the ball and wait for the ball to do its job.
Bookmarks