GEMARA - BERAISOS RELATING TO THE MISHNAH
There is a Beraisa that states three opinions about making Tefilin, Mezuzos and Tzitzis on Chol ha'Mo'ed:
(R. Meir): One may write Tefilin and Mezuzos for his own use, and spin Tzitzis threads with a Shinui (identical to R. Yehudah in our Mishnah). He can also do these jobs for others, but only for free.
(R. Yehudah): He can even get money for doing these jobs for others, in the following manner: He sells them his own Tefillin or Mezuzos and then writes more for himself.
(R. Yosi): He can write as many Tefilin and Mezuzos as he needs to make a living.
Halachah: Rav (or perhaps Rabah) ruled like R. Yosi.
Another Beraisa brings two versions of a disagreement about how to spin Tzitzis on Chol ha'Mo'ed with a Shinui:
Version #1: R. Eliezer says one may spin the thread it by rubbing it against his thigh, but not using a stone. The Chachamim permit even the stone.
Version #2 (R. Yehudah): R. Eliezer says one may spin the thread using a stone, but not a spindle. The Chachamim permit even a spindle.
The Halachah is that it is permitted even with a spindle.
MISHNAH - SHABBOS AND YOM TOV THAT OCCUR DURING SHIV'AH
If a relative is buried three days before Yom Tov, the institution of Shiv'ah is cancelled when Yom Tov arrives. (This Tana holds that a full three-day period of Shiv'ah mourning must be held before Yom Tov in order to be cancelled by Yom Tov.)
If the relative is buried eight days before Yom Yov, the institution of Shloshim is cancelled when Yom Tov arrives. (This Tana holds that the Shloshim must begin before Yom Tov in order to be cancelled by it. He also holds that Shiv'ah is seven full days, and the Shloshim therefore doesn't start until the eighth day.)
Shabbos "counts" (as one of the seven days of Shiv'ah) and does not cancel the Shiv'ah. Yom Tov (and Chol ha'Mo'ed) doesn't "count" and does cancel the Shiv'ah.
Status of one-day holidays in above rule.
(R. Eliezer): Since the destruction of the Temple Shavuos is like Shabbos. (But during Temple times there was a seven-day period of bringing of sacrifices after Shavuos, and it was like the other seven-day holidays.)
(Raban Gamliel): Rosh Hashanah and Yom Kippur (and certainly Shavuos) are like any Yom Tov.
(Chachamim): Shavuos is like Yom Tov, while Rosh Hashanah and Yom Kippur are like Shabbos.
CLARIFICATION OF 2:b.
Question: What is meant by "institiution of Shloshim is cancelled"? Why not just say "Shloshim is cancelled?
(Rav): The Shloshim is in fact not automatically cancelled by Yom Tov. One has to shave before Yom Tov starts, and this enables the Yom Tov to cancel the Shloshim.
(Rav Sheshes): The Shloshim is automatically cancelled by Yom Tov, even if he did not shave. Don't let the word "institution" bother you.
A Beraisa is brought, in which one Tana supports the view of Rav (and the other Tana goes like R. Sheshes - see Tosfos). The Beraisa makes several points:
The Tana Kama holds exactly like Rav said, that Shloshim is only cancelled if the mourner shaved before Yom Tov, on the eighth day.
Aba Shaul disagrees, and holds that the Shloshim is cancelled automatically. He also says that Shloshim is cancelled even if the burial was seven (not eight) days before Yom Tov. This is because he holds that you don't need seven full days of Shiv'ah. The seventh day need be observed only for a small portion of the day. After that, Shiv'ah is over and Shloshim begins (on that same day). Therefore, if the burial was seven days before Yom Tov, the Shloshim will have begun before Yom Tov.
PARTIAL DAYS BEING COUNTED AS WHOLE DAYS.
(Rav Chisda): The Halachah is like Aba Shaul (3:d:2), that the last day of a period of mourning doesn't have to be observed the entire day, but just a small portion of the day. (Henceforth: Miktzas Hayom Kechulo, or MHK.)
(Rav Chisda): In a situation where the eighth day falls on a Shabbos that is also Erev Yom Tov, when he will not be able to shave on the eighth day, even the Chachamim agree that you can say MHK and shave on the seventh day (Friday), in honor of Yom Tov.
Rav also ruled that MHK like Aba Shaul (3:d:2), and therefore said that as soon as the consolers leave the mourner (on the seventh day) he may bathe (i.e., Shiv'ah is over).
(Abaye): The Halachah is like Aba Shaul for day 7. On day 30 even the Chachamim agree that MHK.
(Rava): The Halachah is not like Aba Shaul, and we do not say MHK on day 7. However, on day 30, the Halachah is like Aba Shaul.
(Neharda'ei): The Halachah is like Aba Shaul both on day 7 and day 30.
Conclusion: The Halachah is always like the most lenient known opinion when it comes to matters of mourning - in this case, Neharda'ei.
Tangent: Where does the thirty-day period of mourning come from? A mourner is supposed to grow a Pera (long hair). This word Pera is also found in conjunction with Nazir, and we know that a Nazir's vow lasts for 30 days.
(R. Huna Breih d'Rav Yehoshua): All (even Aba Shaul) agree that you don't say MHK on day 3. Therefore, if day 3 is on Erev Yom Tov (and the Yom Tov is going to cancel the Shiv'ah, so that today, Erev Yom Tov, day 3, is the last day of Shiv'ah), he may not bathe until evening.
SHLOSHIM AND YOM TOV
Question (Abaye): In a case where the burial was during the holiday: It is obvious that one cannot begin counting the days of Shiv'ah during the holiday. This is because the laws of Shiv'ah-mourning are not operative during the holiday. But what about Shloshim? Some prohibitions of Shloshim (shaving and ironing clothing - Rashi) are operative during Yom Tov (when no one may shave or launder), so can one count the days of Yom Tov into the Shloshim?
Answer (Rabah): No, the days of Yom Tov do not count into Shloshim.