Assigning static IP address to your Raspberry Pi (WiFi)

When I first bought my Raspberry Pi, I had this problem. My router and TV are in different rooms and I don’t have a ethernet cable. This restricts networking ability of my Pi which is quite annoying. I searched for articles on assigning static IP addresses to Raspberry Pi but most of them were talking about assigning it for eth0. I, on the other hand wanted wlan0 static IP.
Now, I could have just got a long ethernet cable and solve this whole problem but I was just annoyed and was constantly asking myself “Why isn’t this working over wifi”. So finally, after significant digging around, I found the solution. Here it goes: