Right click Melee in Dolphin, then Properties. At the bottom left corner of the window, click Edit Config. This opens the .ini file where codes are stored.
Gecko codes are formatted like this in the .ini file. Make sure that you enable them on the Gecko Codes tab after adding them to the config file.
[gecko] (must have this tag)Line 1 of code 1
$Title of code 1
Line 2 of code 1
*Optional note about code 1 (must be at end)
$Title of code 2
Line 1 of code 2
Line 2 of code 2
*Optional note about code 2 (must be at end)

Brawl
Kirby Fighters 2
Melee
Project+
Rock Paper Scissors
Sm4sh 3DS
Sm4sh Wii U
Smash 64
Smash Crusade
SSF2
Ultimate