Most people are familiar with the old rhyme about beans being "the musical fruit". Among other foods--especially the cruciferous vegetables such as cabbage, cauliflower and Brussels sprouts, dairy products, beans and other legumes can produce musical notes evoking eye-watering responses. Such gaseous attacks normally only gag those in the line of fire--the producer is immune, much in the way skunks can tolerate their own spray. The embarrassment factor, however, is eqaually strong for some people. Others exist, unfortunately, who take perverse pride in gagging those around them.
For those wishing to avoid any chance of colonic cacophony, there are two routes to take: treat the food before eating it, or take measures post-digestion. For the first, soaking beans overnite, or adding a pinch of baking soda before cooking, will eliminate the gas before it gets into you. In the second instance, certain other foods and herbs can help dispel gas before it becomes disruptive. Probiotics in yogurt, such as acidophilus, help digest food that would otherwise break down more slowly, emitting methane as a result. Peppermint has been used for eons to settle gassy digestive tracts--hence the popularity of after-dinner mints (and you thought restaurants were just being nice!). Other herbs such as chamomile, cloves, ginger and sage, all help relax the gastro-intestinal tract's muscles that cause spasms. The more you cut the spasms, the less you cut the cheese.
Granted, there are some who will not take any measures to prevent their noxious emissions, thinking it's amusing. For the rest of us, when all else fails, blame it on someone around you. With any luck it'll be one of those who would like to take credit for it.