This code
PIND = 0x10; // Toggle Pin 4 (Port D bit 4)
PIND = 0x10; // Toggle Pin 4 back (Port D bit 4)
from johnwasser uses the feature of the PINx register to toggle the value of the selected bits (XOR, documented only in the datasheet 13.2.2).
The usual code for this is direct port manipulation:
PORTD |= 0x10; // Switch on pin 4
PORTD &= 0xEF; // Switch off pin4
It's almost the same as the code from RIDDICK but without affecting all other pins of the same port (pins 0-7).
Both code snippets just tries to switch on and off a single pin as fast as possible, probably faster than you want. That's why you may have to insert the NOP assembler statements to wait some time before toggling the pin back.