This is a little contraption I made for rewarding a player in a map. For instance, you can say that 1 baked potato = 1 diamond. When dropping the baked potato into the hopper, the diamond gate detects that if there is a baked potato, emit a redstone signal. The simple autarchic gate says that if you receive a redstone signal, emit a single energy pulse. The chest has 1 diamond in it and send it to a chest above, or an ender chest that gives it to the player. If you wanted two items, use a Diamond AND gate. This could be helpful in survival challenge maps for rewarding the player.
In the picture, ignore the second chest. It is not needed for this to work.