How can I prevent OS X from resetting/disconnecting from wifi when left idle? Doing work at home, I noticed that OS X would drop my wifi connection when I left my 2011 MacBook Pro and it went into idle mode (screen black, but still powered on). 

When I moved the mouse or touched a key, OS X would "wake up" but not have a wifi connection. Then it would not connect to the wifi for a minute or two, before resuming normal connectivity.

This was new to me since I have had the machine for more than two years and had never experienced this, but recently updated OS X to Mavericks.
Goto System Preferences -> Energy Saver -> Check "Prevent computer from sleeping automatically when the display is off"

The options may be slightly different depending on what generation macbook you have, but this should help point you to the right place. :)