This gfci wiring provides protection to a duplex receptacle. By connecting the load terminals on the last gfci, the receptacle is protected and can be used just as if it were one of the gfci receptacles. One ground fault circuit interrupter at the beginning of the circuit can be used in the same way to protect multiple, subsequent receptacles as illustrated in the diagram below.
This wiring arrangement allows for lowering the lights with a dimmer and controlling the fan with the builtin pull chain. The source is at the ceiling outlet box and 3-wire cable runs from there to the switch box. The neutral from the source is spliced directly to the white wire on the fan kit and the cable, running it through to the switch box.
The hot source is spliced to the black, fan wire and the black wire running to the dimmer. At the other end, the black cable wire is spliced to one of the hot dimmer wires, it doesn’t matter which one. The other dimmer wire is spliced to the red wire in the switch box which is spliced to the blue, light wire at the other end.
Splice both the fan and the light hot wires together with the common wire from the SW2. The traveler wires are spliced together in the ceiling fixture box. To control the fan and light separately, a builtin switch such as a pull chain or remote control is required on the fan/light.