According to the NEC, extension cords and cables should NOT be used:
• As a substitute for the fixed wiring of a device or structure. If the extension cord is a permanent fixture in your home theater or office setup, you should look to other options. (In the case of surge protectors, it's OK if you're using it as a device to protect equipment from unexpected surges in voltage and not to merely extend the reach of a cord.)
• When run through holes in walls, ceilings, or floors, or concealed behind walls, ceilings, or floors.
• Where run through doorways, windows, or similar openings.
• Where attached to walls or buildings' surfaces (like snaked around the top of a doorway to avoid the rule right above this one).
It might not seem like a big deal to run a small cable through an open doorway, but extension cord safety should be a concern to everyone for two big reasons: safe use of cords can reduce harm to people from electrocution or fire, and also prevent damage to your devices.
There's probably no safety inspector coming around your apartment checking to see if you're wired up safely (unless you live in a dorm), but these rules are written out for a reason: stick to these guielines to keep your home, tech, and family members safe. To avoid fires or other electrical hazards, make sure you're using the right extension cord for each of your devices and that you're using it the right way.