When a yom tov (festival) falls right before Shabbat, a person may not intentionally cook on yom tov for Shabbat. However, he may cook for yom tov, and if there are leftovers, eat them on Shabbat. And he may cook a dish before yom tov and rely on it for Shabbat [see comments]. The Shammai Institute teaches that this requires two cooked dishes, but the Hillel Institute says one cooked dish [suffices]. And they agree that a cooked fish or an egg is like two cooked dishes. If he ate it or lost it, he should not rely on it to cook more food. But if even a bit of the food was left, he can use it to prepare more food for Shabbat.
Rabbinic law allows cooking food on yom tov [Pesah, Shavu'ot, Rosh Hashanah, and Sukkot], but only for yom tov. What, then, will one eat on the day immediately following Shabbat? This Mishnah describes a rabbinic loophole called the “eruv tavshilin” (which is nearly impossible to translate). An eruv is a legal device that “mixes” different domains so that activities permitted in one domain can be extended to another domain. In this case, the eruv is a dish of cooked food. By cooking some food for Shabbat before yom tov [for example, on Thursday, when Friday is yom tov] and saving that food until Shabbat, any subsequent cooking during yom tov for Shabbat is viewed as just an enhancement of the already prepared meal. It is a stretch, but it remains Jewish practice even today!