Reverse Polarity Protection.
To power my devices during debugging, I use ordinary phone chargers with a pin header connector soldered to their output.

To tell plus from minus, I file a notch in one of the pins, but through carelessness I still sometimes make a mistake and connect the wires the wrong way round. I won't talk about the consequences of reverse polarity; instead I'll tell you how to avoid it. But first, a couple of words about what reverse polarity is. Usually a DC-powered device has two terminals: the positive terminal of the power source is connected to one, the negative to the other. But nothing prevents you (unless the manufacturer took care of it) from connecting them the other way round, and that's what is called reverse polarity.
The simplest way to protect against reverse polarity is to put a diode in series; then, if the connection is wrong, no current will flow.

This method works, but it has two drawbacks: the first is the large voltage drop across the diode, about 0.7 volts, which is unacceptable for low-voltage circuits (3.3 and 5 volts); the second is the power it dissipates. Since the current powering the entire device flows through this diode, a lot of power is dissipated in it as heat. Suppose our device draws 1A; then the power dissipated by the diode is.

You can improve the situation a little by using a Schottky diode, which has a lower voltage drop of about 0.4 volts, but this solution still isn't suitable for low-voltage circuits.

It turns out that the ideal element for our purposes should have low resistance, so that the voltage drop across it is small. And such an element exists: of course, it's a field-effect transistor; the channel resistance of modern MOSFETs is milliohms or tens of milliohms.

When the power source is connected, current flows through the parasitic body diode (it forms during manufacturing because of the nature of the process), across which about 1V drops; as a result, the source voltage becomes Vsupply - 1, and the gate-source voltage difference turns the field-effect transistor on.
Let's go back to the low-voltage circuit powered from 5V, into which we couldn't fit a diode. Let's take a field-effect transistor from the IRLML series, which is driven by logic levels, namely the IRLML_6401, whose on-resistance is 50 milliohms and threshold voltage VGS(th) is from -0.4V to -0.95V.

The circuit shows that the gate-source voltage is well beyond the threshold given in the datasheet, so we can be sure the transistor will turn on.
At 1A the voltage drop across the transistor will be 0.05V versus 0.4V across a Schottky diode, which is quite acceptable.

But that's only one side of the coin: if this circuit is used at high voltages, it has a drawback, the low gate-source breakdown voltage, so for use in high-voltage circuits the circuit needs to be slightly more complex, as shown below.

This way, we've limited the gate-source voltage with a Zener diode, thereby protecting the transistor, and the excess voltage drops across the resistor.
As it turns out, electronic component manufacturers know about this trick and produce ready-made assemblies, for example the CSD25201W15, which consist of a MOSFET, a Zener diode and a resistor.

Such assemblies are used in the iPhone 4 and 5 to protect the USB input; below is part of the schematic found on the internet.

There is another way to protect against reverse polarity: a diode is placed in parallel with the load, and a fuse is placed in series at the input. With correct polarity, no current flows through the diode; with reverse polarity, current starts flowing through the diode-fuse circuit, and since the current is not limited by anything, the fuse should blow.

The ideal scenario was described above; in reality, it can be the other way round: the diode burns out first, and then the question is whether it fails open or not.
While current flows through the diode, a reverse-polarity voltage equal to the diode's voltage drop is applied to the circuit (sometimes a Schottky diode is used to reduce it), but if the diode fails open, the full supply voltage is applied to the circuit with reverse polarity, i.e. reverse polarity occurs and the circuit is damaged. I wouldn't recommend this method, but you should know about it, and the issue is not so much the method itself (you can take a diode whose maximum current is twice the fuse current and a fuse that blows on a short current surge (fast-blow)) as the quality of modern electronic components, which are often of unknown origin.

To tell plus from minus, I file a notch in one of the pins, but through carelessness I still sometimes make a mistake and connect the wires the wrong way round. I won't talk about the consequences of reverse polarity; instead I'll tell you how to avoid it. But first, a couple of words about what reverse polarity is. Usually a DC-powered device has two terminals: the positive terminal of the power source is connected to one, the negative to the other. But nothing prevents you (unless the manufacturer took care of it) from connecting them the other way round, and that's what is called reverse polarity.
The simplest way to protect against reverse polarity is to put a diode in series; then, if the connection is wrong, no current will flow.

This method works, but it has two drawbacks: the first is the large voltage drop across the diode, about 0.7 volts, which is unacceptable for low-voltage circuits (3.3 and 5 volts); the second is the power it dissipates. Since the current powering the entire device flows through this diode, a lot of power is dissipated in it as heat. Suppose our device draws 1A; then the power dissipated by the diode is.

You can improve the situation a little by using a Schottky diode, which has a lower voltage drop of about 0.4 volts, but this solution still isn't suitable for low-voltage circuits.

It turns out that the ideal element for our purposes should have low resistance, so that the voltage drop across it is small. And such an element exists: of course, it's a field-effect transistor; the channel resistance of modern MOSFETs is milliohms or tens of milliohms.

When the power source is connected, current flows through the parasitic body diode (it forms during manufacturing because of the nature of the process), across which about 1V drops; as a result, the source voltage becomes Vsupply - 1, and the gate-source voltage difference turns the field-effect transistor on.
Let's go back to the low-voltage circuit powered from 5V, into which we couldn't fit a diode. Let's take a field-effect transistor from the IRLML series, which is driven by logic levels, namely the IRLML_6401, whose on-resistance is 50 milliohms and threshold voltage VGS(th) is from -0.4V to -0.95V.

The circuit shows that the gate-source voltage is well beyond the threshold given in the datasheet, so we can be sure the transistor will turn on.
At 1A the voltage drop across the transistor will be 0.05V versus 0.4V across a Schottky diode, which is quite acceptable.

But that's only one side of the coin: if this circuit is used at high voltages, it has a drawback, the low gate-source breakdown voltage, so for use in high-voltage circuits the circuit needs to be slightly more complex, as shown below.

This way, we've limited the gate-source voltage with a Zener diode, thereby protecting the transistor, and the excess voltage drops across the resistor.
As it turns out, electronic component manufacturers know about this trick and produce ready-made assemblies, for example the CSD25201W15, which consist of a MOSFET, a Zener diode and a resistor.

Such assemblies are used in the iPhone 4 and 5 to protect the USB input; below is part of the schematic found on the internet.

There is another way to protect against reverse polarity: a diode is placed in parallel with the load, and a fuse is placed in series at the input. With correct polarity, no current flows through the diode; with reverse polarity, current starts flowing through the diode-fuse circuit, and since the current is not limited by anything, the fuse should blow.

The ideal scenario was described above; in reality, it can be the other way round: the diode burns out first, and then the question is whether it fails open or not.
While current flows through the diode, a reverse-polarity voltage equal to the diode's voltage drop is applied to the circuit (sometimes a Schottky diode is used to reduce it), but if the diode fails open, the full supply voltage is applied to the circuit with reverse polarity, i.e. reverse polarity occurs and the circuit is damaged. I wouldn't recommend this method, but you should know about it, and the issue is not so much the method itself (you can take a diode whose maximum current is twice the fuse current and a fuse that blows on a short current surge (fast-blow)) as the quality of modern electronic components, which are often of unknown origin.