Cocky funny depends on a few things. If you're decent looking and you're perceived to have high value already then you need to turn down the cocky and up the funny. If you're not then you can get away with being more cocky.
The reason cocky funny works is because its a little unexpected.
So if you're and average looking guy and you havent established that you're a high value male yet then the girl wouldnt expect you to be cocky, so by being more cocky you throw her off balance.
Here's a good article on cocky funny and how it relates to push pull, but it's not exactly on newbie level.
http://www.thesocialman.com/using-cocky-funny-right