I think taking a walk is the best thing to do in those cases. Just stepping away from the computer.
In general, I've been trying to get over the dumb feeling by keeping a log of the stuff I'm good at and have done. That way, when I need to redo a resume or LinkedIn, I have one place with that info. It also would work for feeling dumb at work, since there would be proof I did know stuff, even if it didn't click this one time.
Like the three days I spent trying to fix a test that was failing because the data was being screwed up by a different way earlier in the test suite.
I may still be salty about that one.
I recommend Having a rubber duck friend/buddy, this helped me a lot.
Whenever you have a problem try to describe it to them out loud, sometime you'll realize what you did wrong while describing the problem.
Comment on YouTube videos.
But seriously I talk out my problem to a colleague. I don't want them to fix the problem for me, it helps me word it in a way that others can understand and that helps me understand the problem; and often the solution.
I totally agree on this.
I try to remind myself now and then that I'm human and not necessarily have to be a genius. When feeling low, as others said, stepping away is the best short-term solution, but in the end, trying to enjoy and not expecting the stars from yourself is better.
Take a break. Depending on how bad you feel -- take a longer break and work on some feel-good code. The code equivalent of popcorn. Light, easy, fun, whatever that means for you. Whatever it takes to get you to remember the fun parts of it.
I have a few races on Mario Kart, it helps me step away from the keyboard for a few minutes, its super fun, i can take out my frustration in a healthy way by lobbing shells at the other racers and I like the little confidence boost if I finish on the podium. It helps me do a total U turn on my state of mind and I can come back to my code with a new mindset and approach.
you think in terms of 'punishing' yourself for not knowing / not being able to. Instead be excited for the challenge / lack of knowledge, because you're learning.
We got a rule within the team: if it takes more than 1 hour to solve a problem, ask someone for help without feeling guilty.
If it's something private, I better look at it next day in the morning.
Oh this is awesome. Draw the thing on paper, or sleep on it.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.