Let me give away one of my favourites :-)

	// proven local<->live codefork (covers local network testing, i.e. from mobile devices):
	$GLOBALS['is_local'] =	
		in_array( $_SERVER['REMOTE_ADDR'], array("127.0.0.1","::1")) || // simple localhost (IPv4 IPv6)
				  $_SERVER['HTTP_HOST'] == 'local.workblog'          || // call by local name (adjust)
		   substr($_SERVER["REMOTE_ADDR"],0,8) == '192.168.';           // (mobile) device in local network

	$table_prefix  = NULL; // ensure scope

	if ( $GLOBALS['is_local'] )  // LOCAL fork ------------------------
	{
            ....
	}
	else  // STAGE/LIVE fork -------------------
	{

...and then you work your way from there. DB_NAME, DB_USER... table_prefix. Personally I switch on ALTERNATE_WP_CRON on local (to avoid [some annoying warnings][1]), WP_DEBUG of on both (if you're not a developer) or on live-only (if you are), another `ini_set('display_errors', '0');` for live could also do good, ant lastly, as mentioned above: WP_HOME and WP_SITEURL to the respective local/actual url.

That pretty much all, nothing left above the classic WordPress **'That's all, stop editing!'** line...

The 192.168. part allows you to do some local testing (i.e. from pads or phones) within your local network)

The $GLOBALS['is_local'] can come in handy in your theme development, too, for some extra debug output, etc...

  [1]: http://stackoverflow.com/q/3277497