DEV Community

Lam
Lam

Posted on

ChatGPT Coding CheatSheets

Explain why a piece of code isn't working

Why this code is not working?
var x = 5;
var y = 0;
console.log(x/y);
Enter fullscreen mode Exit fullscreen mode

Explain what a piece of code means

What does this code do?
function addNumbers(a, b) {
    return a + b;
}
Enter fullscreen mode Exit fullscreen mode

*Rewrite the code using the specified language

Translate this code into Python:
function addNumbers(a, b) {
    return a + b;
}
Enter fullscreen mode Exit fullscreen mode

Code an entire software program

Write a program that calculates the factorial of a given number in python.
How do I make an HTTP request in Javascript?
Enter fullscreen mode Exit fullscreen mode

Generate regular expressions (regex)

Create a regex that matches all email addresses?
Generate 8-digit password regex
Enter fullscreen mode Exit fullscreen mode

Add comments to your codebase

Add comments to this code: 
function addNumbers(a, b) {
    return a + b;\n}
Enter fullscreen mode Exit fullscreen mode

Change the CSS of a line of code

Update the CSS for this line to change the font color to blue?
<p class=\"example\">Hello, QuickRef.ME!</p>
Enter fullscreen mode Exit fullscreen mode

Change the HTML of a line of code

Add a class of \"header\" to this header tag?
<h1>Hello, QuickRef.ME!</h1>
Enter fullscreen mode Exit fullscreen mode

References:

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more