Stop Wasting Time Copying and Pasting Code Snippets from CHATGPT- Use This!

preview_player
Показать описание
In this tutorial, using ChatGPT, we will learn how to create a "Create File" button with specific attributes for containers that contain code. The button will allow us to save the code to a file with the appropriate extension depending on the selected programming language.

We will use JavaScript to create this button and ensure that it only gets added to each container once. We will also use a MutationObserver to watch for new code containers added to the page and add the "Create File" button to them as well.

The button will have a specific class name and contain a button and span element that displays the selected programming language. When the button is clicked, we will simulate a click on the "Copy Code" button and save the code to a file with the appropriate extension.

Supported programming languages include JavaScript (.js), HTML (.html), CSS (.css), and Python (.py). If the selected language is not one of the above, the file extension will default to ".txt".

Prompt:
The code should look for containers on the page that contain code and have the following attributes:

Class name: "flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"
Contains a button with class name "flex ml-auto gap-2"
Contains a span that displays the selected programming language
The "Create File" button that the code creates should have the following attributes:

Text content: "Create File"
ID: "update-vscode-btn"
Padding: "2px 10px"
Border: "none"
Border radius: "20px"
Text color: "#fff"
Background color: "#28a745"
Font weight: "300"
Margin right: "200px"
When the "Create File" button is clicked, the code should simulate a click on the "Copy Code" button and look for the programming language displayed in the span mentioned above to determine the appropriate file extension to use. The code should support the following programming languages:

JavaScript (.js)
HTML (.html)
CSS (.css)
Python (.py)

If the selected language is not one of the above, the file extension should default to ".txt".

The code should check for the existence of the "Create File" button in each container and only add it if it does not already exist. The addition of the button should be checked every 3 seconds using the setInterval function. The code should also listen for new code containers added to the page using a MutationObserver. Please provide the code.

This tutorial will help you create a helpful tool for saving code snippets to files with ease.

Make money building plugins with ChatGPT #chatgpt #openai #plugin #chromeextensions

ChatGPT Made a game in under 7 minutes!:

Create Your Own Meme Generator Web App Using ChatGPT and Flask in 4 minutes | Step-by-Step Guide:

Build a website with ChatGPT in 3 minutes #chatgpt #openai

On this channel, you will find tutorials on how to access and utilize OpenAI's ChatGPT. you will discover the amazing world of OpenAI's ChatGPT. Imagine being able to have a conversation with a computer about anything under the sun! Thanks to ChatGPT, it's now possible, and I'm here to show you how. With my engaging tutorials, you'll be able to access and use this revolutionary technology like a pro. So buckle up and get ready to take your conversational skills to the next level!

Рекомендации по теме
Комментарии
Автор

Fun fact: You can put your javascript in a bookmark so that when you click it, the javascript runs. This way you can save the code in a bookmark and click it everytime you open chatgpt. A poor man's chrome extension XD

jonathanduran
Автор

"Use ChatGPT to write all your code never write code again!"
Spends the rest of their career debugging ChatGPT code.

Seriously, I enjoyed this video. I don't know javascript, so it was interesting seeing how to inject and debug code for the ChatGPT window in the ChatGPT window, dawg.

scottmiller
Автор

I appreciate this content. Really top notch tech advice 🤙

juelz
Автор

You even provided the code. Awesome! Thank you. Thank you. Thank you.

ThatNiceDutchGuy
Автор

getting chagpt to create a button on its own page…genius

tradingwithwill
Автор

Thanks, I needed a project, and this is perfect!

PATRICIOcomplex
Автор

You are king! Thank you for sharing this.

bryyfryy
Автор

Which vs code icon them are you using for file icons?

sameerjoshi
Автор

thank you for sharing, you could also add .dart extension if you find time to do that.

AiEnthusiast
Автор

This is cool and I subbed but don’t you still have to go back and forth between ChatGPT and VS Code? How is this faster than copying and pasting?

NickWindham
Автор

Hey, could one use a modified version of this to scrape the while conversation in a given instance and save it to to folder?

littlegravitas
Автор

please add audio button for search also so that not need to write.

uklife
Автор

Hi, have you made this into a public chrome extension I can install?

sprinteroz
Автор

What if ChatGPT cuts a code and when i ask it to continue, it just writes it all over again?

MarekJergner
Автор

I'm sorry but this makes little sense as a tip. Wouldn't you just use an IDE extension to work on your code files with a chatGPT plugin that directly operates on your code repository etc? Yes, if you're a developer you would.

PatrickMetzdorf
Автор

I mean we need automation but not for literally everything. It takes 1s to copy code back and forth from ChatGPT to VsCode.
Don’t be that lazy man. 😅

Appreciate the effort you put in though

HaseebHeaven
Автор

If only chatgpt would finish the code in one response.

youdontneedmyrealname
Автор

This is F'n Right-ous! Loop!
Got yourself a Sub! and a 👍like.
Please do another?
Using the same technique for a quick dmall Scraping project?
...But only if you feel like 👍it.

spicer
Автор

Ok so, don’t copy the code from chatgpt but download an extension to save it to a file for you 😂 what’s the difference

decencies