How do I set up face(or vert) normal aligned texture?

Similar to using World Aligned Texture, I would like to project texture aligned to face normal.
I need help from somebody good with vector math…I suppose I have do something like rotating world space to face normal or vert normal. Can anybody help? Thanks.