Is this sentence actually grammatical?

>You know **your** having a rough day when kittens don't even make you smile.

The writer of this sentence may intend to mean *you're* instead of *your* but I'm just wondering if having a gerund preceded by a genitive is considered grammatical in this case.


If the sentence above is ungrammatical, why is this sentence grammatical? 

>He resents your being more popular than he is.

What's the difference between these two sentence that determine one to be grammatical and the other to be not?