Active approach:Tell him to mind his/her own business and stay out of your way with a glaring look
Consequences:The senior developer might get hurt,might not give nice feedback about you in the long run to others lowering your reputation in your company and refuse to help you even when you genuinely need help
Passive approach: Listen to his advice from one ear and forget about it the moment he goes away.You might plug your headphone jack in the other ear to concentrate on your music while completely ignoring the advice and concentrate on your work Consequences:The developer might think that you are not taking advices seriously and eventually stop giving advices to you feeling that his/her time is wasted on you.Again you might not receive help in the near future and your reputation might go down.
Smart Approach:Ask about the projects that he/she previously worked on and whether the advice that is being given has any practical use case/implementation that can be used currently in your project.But always ask him/her whether it is the most performance efficient way to implement it for every piece of advice that is given.Next create list of doubts that you know are going to take a while to figure out and ask him/her so that it keeps them busy rather than boring you out with useless knowledge Consequences: If the developer is technically sound he/she might figure out your doubts in more efficient manner or might give you a different approach that you might have never thought of. If the developer is not technically sound he/she will think 10 times before bluffing/boring you with useless knowledge because he might get stumped himself over his piece of advice similar to how new teachers always fear smart kids who might ask questions to them for which they might not know the correct answer. In both cases your reputation will improve since the senior developer knows that you are a smart programmer and creates a good impression about you in the office. Office is not that different to schools in many ways.People and roles might change but old school tactics always work in all types of institutions...