You always keep searching for what you want. It would be ridiculous to just memorize the code. All you have to do is understand the concept, practice for few times, and move on. When you need it again, use google or any other search engine to remind you of it.
You keep the language semantics and syntax pretty much in your head like it's muscle memory. Same goes for design patterns and frameworks you are working with at the moment.
The rest you can write from scratch or do a quick search to recall something that isn't fresh in your head. Eventually, you will begin to anticipate how something works in a new language or framework which speeds things up as well.
Still yet, it all looks seamless to people observing. Just keep practicing until it starts to feel natural.
Cheat sheets are good to have. As technologies are constantly upgrading you can't remember all the things. Learning how to research or googling is most important skill you can have. Learn how to use documentation because it is the most updated material you will find on the web.
An experienced programmer will know that anything not practiced on current project is eventually forgotten.
This is why code is documented, and how-to blogs are written, so that it is possible to go back to prior knowledge when needed.
A noob searches "how to print hello world"
A pro searches "how to print hello world"
Hope you understand 😉You just have to understand the concept and other things will come automatically to you from internet.
There is nothing like cheat sheet which you can hold all the time as you will see technology updates every now and then. You will find similar syntax in some language and in some it's going to be completely different.
So, it's better understand what path you want to take and move forward in the direction. And google search, will always come handy. You will find your answers, learn and know more than what you were looking for.
For me I always go back to my saved old projects, for instance the other day wanted to import text file into the browser. But, I just forgot to write the right code, so headed to my old projects and the code was there!
So, never bin your codes even if they are wrong. And I believe most programmers do it this way.
Most keep the semantics, structure and frequently used code in there head much like someone that plays. Musical instrument remembers sheet music and location of the keys string such and programmers usually look at git repositories and stack overflow for most eedheirecords their coding needs along with asking colleagues and referwnce books
I'm not sure you can still remember all matters you've memorized some days, weeks, months and years ago let alone these codes but once you understand the technicalities involved and put them in constant practice over time, they become part of you. However you still need to continue researching when the case arises. The internet is a great resource.
"A noob searches "how to print hello world
A pro searches "how to print hello world" - by Shroud
I've always know that I am a pro...
But what about those who's searching for how to turn on a computer. From now on I know that they are operating system developers.
Some do remember all those stuff but its because they used to practice every now and then. So the goal to master this stuff is to practice every day if possible plus going through archives with relevant solutions as you'll be able to expand your knowledge.