I needed to be able to switch between two Wi-Fi connections in OS X during development of a certain project and it quickly became disruptive to my workflow to always reach for the mouse and use the menu bar.
So I made the following alias commands for use within Terminal on the command line interface.
alias adhoc='networksetup -setairportnetwork en1 <adhoc SSID>' alias wifi='networksetup -setairportnetwork en1 <my wifi SSID> <WPA2 password>'
Hope this helps others, as it greatly improved my own efficiency.