Safari can load internet but none of the other apps cannot! This is by far the weirdest problem I've come across, 
My mac can perfectly access internet through safari web browser, but when I tried to do 

ping www.google.com


through the terminal, it's requests is being timed out.

None of the other apps are able to reach internet either. Dropbox, Skype, Spotify all showing offline, except the browser itself

I'm guessing something bad with the DNS, but spend 2 hours trying to fix this with no luck
Since DNS resolves but the ping responses time out, we can rule out a DNS issue.

Things to try to diagnose the source of the problem:


It's possible that IPv6 is working but IPv4 is not.  Try ping6 ipv6.google.com to see if this is the case.
Find out whether a proxy has been configured that Safari might be using. Go to System Preferences, and search for Proxies to jump right to the tab in the Network config (also accessible from Safari preferences > Advanced > Proxies).
Confirm that other devices on the network don't have this same issue. It's possible that a transparent network proxy is filtering traffic.
Restart the computer, because this is a pretty unusual problem.