If you have never heard about GitHub Copilot, I'm jealous as a friend because, after this article, you will experience the same positive shock I did when I tried it for the first time.
What is GitHub Copilot?
Once upon a time, there was a dog. His name was Copilot, but GitHub proposed him a raise. And instead of this cuttie ↑, we got this cutie ↓ (write in the comment which one you like more)
He not only looks nice but can do magic with your code. Right from your editor, GitHub Copilot uses the OpenAI Codex to suggest code and entire functions in real time. Simply put, he helps you write code faster by learning from your code (and millions of lines of code from other contributors across the web) to predict your next step or give you a snippet from a comment you would provide. You write, "Create a function that generates 1000 random users with images," and the result will be generated instantly.
// Create a function that generates 1000 random users with images
import faker from 'faker';
const generateUsers = () => {
const users = [];
for (let i = 0; i < 1000; i++) {
users.push({
id: i,
name: faker.name.findName(),
image: faker.image.avatar(),
});
}
return users;
});
Let me show you how it works with a real-world example. Recently, I've got the task to create two screens in React Native where the first one will conduct a random today joke, and the second will display a list of all previous jokes. All data should be persisted and stored in AsyncStorage. That means, every day, we have to save fetch a new joke, and the current one goes to history. Let's summarize it in terms of actions:
- For the Today screen, we need to get a joke from API
- Then save the joke and current date in the AsyncStorage
- Add a checker for 24-h expiration
- If expired - fetch a new joke
- And put the current one in the history list in the AsyncStorage
- For the History screen, we only need to get a history of jokes
Let's see how GitHub Copilot can help us with it.
I was thinking about GIF format, but with video it's even better and it takes only 1 min
I hope you saw the video and got that positive shock I had. Just imagine how outstanding you will be with this tool by snapping your fingers (or clicking the Tab key).
How much?
Previously, this tool was free. But it's not anymore. So let's talked about pricing.
Today, December 8th, 2023, costs $10 bucks per month or $100 per year, which is less than I expected.
But there's some good news; you don't have to pay in advance. Start a free trial, test it, taste it, and decide if it is something you want in your personal arsenal.
I hope the article was helpful. Please subscribe so you don't miss the following article, and feel free to contact me if you have any questions.
Top comments (0)