Well, I loved physics when i went to school. But that's a few years ago. Looking at the picture, my first thought is that the whole structure would fall off the table. The only thing I thought of was that the weight beneath the ruler would make it so that everything would fall down. However, as the previous post stated, as long as the center of gravity is beneath the table, there will be upwards pressure from the shaft of the hammer, this will effectuate a upward force upon the ruler, and placed correctly, it will balance, like in the picture.
Honestly, I thought the picture was a hoax in the beginning, but when I tried it out for real, I could see how it worked, and I could feel the upward force. No pic needed for proof, as anyone who doesn't believe us, can try for themselves.
It's just physics at play, but a pretty neat trick to show off!
Cool, you just convinced me!