2coffee.dev

  • How to Delete a Pushed Commit
    • git

    How to Delete a Pushed Commit

    One common issue many people search for is "how to delete a pushed commit." I happened to come across a blog post titled "I accidentally committed the wrong changes, how do I fix it immediately?" that ranks high on Google search results for this query. However, it only provides instructions on how to delete an "unpushed" commit. To avoid confusion and provide an accurate solution to this problem, let's explore how to delete a pushed commit in this article...

    1 year ago

  • Discussing the npm run build command – why is it necessary to build?
    • javascript
    • node.js
    • npm

    Discussing the npm run build command – why is it necessary to build?

    The npm run build command is not unfamiliar to JavaScript developers when preparing to release a new version of their application. In simple terms, npm run build converts the project's code into executable code that can run in the browser or Node.js. But why is there a need for the build step? What is the essence of building? Do all JavaScript/Node.js projects need to be built? Hopefully, readers will find the answers in the following article...

    1 year ago

  • Using gpt-4 for free with Github Copilot
    • chatgpt
    • gpt
    • other

    Using gpt-4 for free with Github Copilot

    Hello readers of 2coffee.dev! It's just a few days left until the Year of the Quý Mão officially comes to an end, making way for the new Year of the Giáp Thìn with hopes of more success. This may also be the last article in the old year that I want to dedicate to all of you. A few days ago, I wrote an article Transforming ChatGPT into an "Expert", in which I mentioned the issue of using the ChatGPT API to be able to use the "expert" because only in the API can we set up the role `system`, which helps ChatGPT narrow down the context and provide more accurate answers to questions...

    9 months ago

  • How to Fix a Mistaken Commit Immediately?
    • git

    How to Fix a Mistaken Commit Immediately?

    Committing code is a daily task for developers, but sometimes due to some reason, you make a commit with missing content or realize that there are still some places that need to be fixed. What should you do in those situations?

    3 years ago

  • What is Child Process in Node.js? When to Use fork and spawn?
    • node.js

    What is Child Process in Node.js? When to Use fork and spawn?

    There is a piece of advice that every Node.js developer should remember, which is "never block the event loop." Blocking here means not allowing the Event Loop to execute its own functions. Node.js only has one thread to handle JavaScript code, so if a task takes a considerable amount of time to process, it will cause a serious bottleneck in the main thread. In other words, all API calls may never respond until that task is complete. Knowing this issue, Node.js provides us with some ways to solve it...

    1 year ago

  • The Difference Between I/O Tasks and CPU-Intensive Tasks
    • node.js
    • javascript

    The Difference Between I/O Tasks and CPU-Intensive Tasks

    As a proficient Node.js developer, have you ever heard about the strength of Node.js in handling I/O tasks and asynchronous operations, and that it may not be the best choice for CPU-intensive applications? So, what are I/O tasks and why is Node.js strong in I/O? Is it true that Node.js is not good for heavy computational tasks? In today's article, I will address these issues.

    2 years ago

  • What are Worker threads? Do you know when to use them in node.js?
    • node.js

    What are Worker threads? Do you know when to use them in node.js?

    Worker threads were first introduced in node.js version 10.5 and their API was still in the experimental stage until it received stable release in version 12LTS. Worker threads provide a solution to run JavaScript code on a separate thread parallel to the main thread. So, how does this work and what benefits does it bring? Keep reading to find out...

    1 year ago

  • Telegram and Real-time Notification Channels
    • other

    Telegram and Real-time Notification Channels

    You may already be familiar with the messaging app Telegram, which allows us to make calls and send messages over the internet quickly and without any limitations that affect basic communication functions. Personally, I find that Telegram focuses well on messaging. The message sending speed is fast, and I have never experienced missing any messages or notifications...

    1 year ago

  • Measuring the Execution Time of Functions in JavaScript in a Graceful Way
    • javascript
    • node.js

    Measuring the Execution Time of Functions in JavaScript in a Graceful Way

    During the development or operation of an application, unforeseen issues may arise. Once your application is released to the market, the number of users is likely to increase every day, resulting in a wide range of user behaviors and collected user data. These combinations can create various error scenarios that were not caught during the previous testing processes. One of them may be that the API response suddenly becomes slow, even with a small number of users...

    1 year ago

  • Mutex and Techniques for Resolving Resource Contentions Caused by Race Condition.
    • other

    Mutex and Techniques for Resolving Resource Contentions Caused by Race Condition.

    In programming, we sometimes face situations where we need to prevent a request from accessing a variable, file, or data structure that is currently being held by another request. Allowing concurrent requests to access and modify resources freely can cause various issues and even errors that we do not desire. In a load-balanced environment...

    2 years ago