Here I will be covering some ideas on how to be productive at work when you have no assigned tasks, or when you are waiting to be able to work on something.
I currently work for a marketing intelligence company, where we take tons of data, analyze it, and use it to find the best audience to market to. The nature of our company means that we get very busy for the holiday marketing push and then slow down after the holidays are over. Due to this our main development pushes are early in the year with a slowdown towards the end of the year. This leaves plenty of time to work on something like learning or refactoring some old code.
I will split this into three categories of work to be done: new code, refactoring, learning.
The second option is refactoring existing code. Maybe you wrote the code years ago or someone else did, but either way every time you have to interact with it you groan (to yourself or out loud). This is a perfect contender of something that can be refactored. Use some prudence when choosing what to refactor based of your time and the impact it will have.
Lastly you can use your free time to learn something new. Maybe it's a new language, some new techniques, or the latest features in your language(s) of choice. As a developer we always need to be expanding our knowledge and capabilities and taking some time to learn will be a benefit to you and your company.
So the next time you feel like you do not have anything to work on and are tempted to go to facebook, reddit, or similar (dev.to is ok ;P) consider one of the options above.