Gullane is just under 20 miles from Edinburgh, and the pleasant coastal drive takes between 35 and 40 minutes. The easiest route is from Edinburgh to follow the Edinburgh Ring Route (signposted A1 to Berwick) and then take the A198 (signposted to North Berwick). If travelling from the South, take the A1 and come off on the A6093 exit and follow the A6137 to A198 in Gullane.
As always, Google Maps provides great tools to plan your route.
The train is probably the fastest way into Edinburgh from Gullane. There is no station in Gullane itself, but North Berwick, Long Niddry and Drem are all within a ten minute drive. Train timetables are available here and trains run approximately every hour.
At the time of writing, the 124, X24 and X5 buses run from Edinburgh to Gullane. These are provided by Firstbus and a timetable can be found here. Buses run approximately every half hour.
There is a helpful list of local taxi companies on the Gullane Golf Club website here.