Efficient coding with cheat.sh

Efficient coding with cheat.sh

Cheat sheet 2.0

When a coding problem occurs most of us switch from their IDE to the browser to search for a solution on Stackoverflow, Github or in blogs. Often, I even forget solutions to problems I solved some time ago. Switching into the browser leads to a cascade of distractions and interruptions in the workflow.

Distractions

Well, there’s a solution for that …

Igor Chubin seems to know these problems and together with open source contributors he developed cheat.sh. It is basically Python program which takes natural language as input and outputs a structured answer. The answer is delivered with useful notes, a source and even code snippets to start working with. So you don’t even need to leave your IDE! This is a new form of cheat sheets which makes problem solving much more enjoyable.

How it works

Let me show you how I personally use it with vscode:

  • Install the Snippet extension from the vscode marketplace

Cheat.sh snippet plugin in vscode

  • Create a comment in your file containing the question, mark it and click Ctrl+Shift+S

Marked python commentCode snippet python from cheat.sh

  • You get the code in a separate file which let’s you easily pick the snippets you need!
  • It also works with more complex questions and/or different languages (amazing, right?)
  • Java Cheat.shJava code snippet from cheat.sh

However, using cheat.sh inside an IDE is not mandatory. It can be used as an CLI or simply from the web interface.

Use Cheat.sh

Cheat.sh is an excellent productivity tool for any developer. It doesn’t really change how we work but rather increases some of the steps we take while solving coding problems. Cheat.sh also protects us from getting lost in any unrelated website while doing our research. It takes very short time to use cheat.sh and there is always a way to fallback to our beloved Stackoverflow. I highly recommend to give it a try and see how a modern cheat sheet should look like.