James contrasts the peaceful wisdom which is from God (3:13, 17-18; “from above” was a typical Jewish way of saying, “from God”) with the contentious wisdom which is from the devil (3:14-15). Then he warns his audience not to try to hold both perspectives as if they were compatible. Those who try to follow both God’s and the world’s wisdom at the same time are spiritual adulteresses (4:4).
Submitting to God and resisting the devil (4:7), then, is rejecting the world’s evil way of treating one another and preferring the gentle approach that comes from God. To adopt this new way of treating others requires repentance (4:8-10).
1 Peter refers to a situation in which Christians are being persecuted (1 Pet 4:12-16); in 1 Peter 5:8-9, the devil apparently seeks to crush believers by seeking to turn them from the faith. Resisting him therefore means withstanding the persecution.
In the context of Ephesians 4:27, one resists the devil by refusing to deceive or stay angry with one’s fellow-believers (4:25-26); in the whole context of Ephesians, this is part of “spiritual warfare” (6:11-14, 18).