Didache 1:2
1 There are two Ways: one of Life and one of Death, and there is a significant difference between the two Ways. 2 The way of life is as follows: First, you should love the God who created you; secondly, love your neighbor as yourself. Treat others as you would want to be treated. 3 Now, the teaching behind these words is this: Bless those who curse you, pray for your enemies, and fast for those who persecute you. What credit is it to you if you love only those who love you back? Don't even the non-believers do the same? Instead, love those who hate you, and you will have no enemies. 4 Refrain from indulging in carnal and bodily desires. If someone strikes you on the right cheek, turn to them the other cheek also, and you will be perfect. If someone compels you to go one mile, go two. If someone takes your coat, offer them your shirt as well. If someone takes from you what belongs to you, do not refuse, even if you can.
Shabbat 31a
Babylonian TalmudThere was another incident involving one gentile who came before Shammai and said to Shammai: Convert me on condition that you teach me the entire Torah while I am standing on one foot. Shammai pushed him away with the builder’s cubit in his hand. This was a common measuring stick and Shammai was a builder by trade. The same gentile came before Hillel. He converted him and said to him: That which is hateful to you do not do to another; that is the entire Torah, and the rest is its interpretation. Go study.
Notes and References
"... If the Didachist did not employ a non-canonical source as he composed the whole of chapters 1–5, his second verse may still present a challenge to that general conclusion. There one encounters what has often been called the “Negative Golden Rule.” Didache 1:2 states, “[A]s many [things] as you might wish not to happen to you, likewise, do not do to another.” This is certainly similar to Jesus’ statement in Matthew 7:12, where it is expressed positively. A pre-Christian history to this piece of ethical advice exists, however. Tobit’s advice to his son in 4:15 is similar: “And what you hate, do not do to anyone.” Furthermore, the famous dictum of Hillel to the inquiring Gentile in Babylonian Shabbat 31a also sounds very similar to Didache 1:2. Did the Didachist deliberately alter the Dominical saying in accord with Jewish tradition, or could this be an example of a genuine agraphon - an unwritten saying of Jesus? No one knows, but anyone should recognize this as a further example of the definitely Jewish character of the Didache, even in its Christian dress ..."
Varner, William The Didache's Use of the Old and New Testament (pp. 127-151) The Master's Seminary Journal 16/1, 2005