Below are some helpful and interesting comedy writing tips I came across:
Understand that a joke occurs at the intersection of two ideas.
Connect ideas that go together or are wildly opposite.
Manipulate your audience. Take them down a particular road and then surprise them with something else.
Pull the rug out from under your audience. Employ good timing so that they don't step on the rug too early or get on it and then get off before you've had a chance to deliver the humor.
It could be helpful for a variety of writing, I think.