I'm sure I'm like most folks in that I have a well-stocked "spare parts box" on my test bench. There are three components that seem to give me the most trouble because they are so difficult to identify: infrared transmitters, photo transistor receivers and clear LEDs. Most are manufactured in the familiar T1¾ package.
So, I've trained myself that when I purchase these components (or remove them from other equipment) I take a second or two using a permanent marker so I remember what I have. I draw a straight line from the tip to the bottom of the infrared transmitters, a single ring or short line for the photo transistors and two rings around or two short lines across the width of the bottom for the LEDs. Don't stop there. Add a few more colors and you'll never be confused again.
If you are worried you will forget the code, you might consider making your very own decoder ring!