Virginia’s General Assembly voted to appoint a gay judge, reversing its decision last year to reject his nomination.