What is a good way to prevent gas?

Less fiber. Generally gas is caused by consumption of foods high in fiber and other undigestable carbohydrates (sugars used in diabetic foods for instance). Plenty of exercise and avoiding constipation may also help.
Low FODMAP diet... Eat a diet low in fodmaps. Use google to search for "stanford low fodmap diet" - this should yield a pdf file that is very good at identifying foods to choose/avoid related to gas production.
Diet, simethicone. I'll avoid giving the most obvious answer, since you probably know how to do that already. You can reduce gas by modifying your diet (the web is full of lists of gas- causing foods). You can also take over-the-counter simethicone-containing medications, such as phazyme or gas-x.