teleren/devto huggingface dataset:
Pushing Anti-patterns to Production for Fun and Profit
Tags: react, reactnative, testing, typescript
Published: 2023-11-23 20:56:05

Using timeouts in our automated tests? How dare you. :angry:

I admit I did that, but let me explain.

We had this test that was throwing an error, on a component that I did not write:
> ReferenceError: You are trying to `import` a file after the Jest environment has been torn down.

The tests were passing, but it was flaky - failing in CI, wasting developer time and CI cycles.

I tried tracking it down, and it said I was importing React's `Modal` component. Of course I was, the component itself was a Modal.

This couldn't have been it. I took a step back to really understand what this component was doing, and realized that it depended on multiple asynchronous behaviors. The Jest environment had been torn down, but the component was still trying to do something.

I did my best to play around with fake timers, done callback, and ticks to no avail.

Alas, the solution was simple: explicitly tell Jest to wait, because the test is not over yet.

```typescript
// Not recommended practice. Use sparingly.
  await act(async () => {
    return new Promise((resolve) => {
      setTimeout(resolve, 1000);
    });
  });
```

The tradeoff is, each time your test runs, you "spend one extra second" which costs money. However, the test used to fail after running for multiple minutes! So I think that spending one extra second to save minutes is overall a good tradeoff.

I have more stories to share, especially about the dreaded "You called `act(async() => ...)` without await" error so stay tuned.
NodeVM: The Good and Tricky
Published: 2023-11-23 20:42:26

When we talk about NodeVM, we're looking at a space within Node.js where we can run JavaScript safely. It's like having a playground sandbox with boundaries. You can try new things without affecting the rest of your system. But like any playground, it has its sunny and rainy days. Let's look at both sides.

### The Good Stuff About NodeVM:

1. **Safe Space**: It gives you a safe corner to run code that you might not fully trust yet.
2. **Node.js Powers**: You get to use some cool features from Node.js, which can be really handy.
3. **Make It Yours**: You have the freedom to set up this space just how you like it.
4. **Library Access**: You can easily grab tools and add-ons from NPM to use in your projects.
5. **Keeps Things Separate**: For big projects, it keeps different parts from stepping on each other's toes.

### The Not-So-Great Parts:

1. **Safety Concerns**: If not set up right, some sneaky code might still cause trouble.
2. **Slows Things Down**: This special space can make things run a bit slower.
3. **Complicated to Handle**: Getting everything set up and keeping it running smoothly can be a bit of a headache.
4. **Tied Down**: It's part of Node.js, so any big changes there can affect your projects.
5. **Resource Hungry**: If your server is already working hard, NodeVM might ask for more than it can give.

In a nutshell, NodeVM is great when you need that safe space to test things out. Just be sure to keep an eye on the tricky parts, especially security and speed.

Interested or got something to say about NodeVM? We'd love to see you join in and help make it even better.

Choosing the right tools is crucial, and NodeVM could be the one you need. Give it some thought for your next big idea.

{% cta https://github.com/webcrumbs-community/webcrumbs/tree/main/core/experiment-3 %} See NodeVM in action {% endcta %}

### Wrapping Up

NodeVM isn't perfect, but it offers some unique features that might be just what you're looking for. As you finish up here, ponder how NodeVM might fit into your work or spark a new project direction.

{% cta https://github.com/webcrumbs-community/webcrumbs/issues/103 %} Get started with NodeVM {% endcta %}

Well done on getting through this rundown of NodeVM. Here's to making your web development smoother and smarter!
Colors in Between
Tags: webdev, color, rgb, hex
Published: 2023-11-23 20:30:20

Looking for the ideal gradient or a flawless blend of two colors? Introducing our latest creation, Colors in Between, a game-changer in the realm of color gradients. Tailored for graphic designers, digital artists, or anyone passionate about color play, this tool is crafted to ignite your creative flair and streamline your color choices.

[**Colors in Between**](https://hexcolor.co/colors-between) is a cutting-edge tool designed to effortlessly generate a seamless gradient transition between any two chosen colors. It's the go-to solution for discovering intermediate shades that harmoniously merge, enabling you to craft eye-catching gradients for websites, digital artwork, or any project that benefits from a splash of coordinated colors.

Wondering how to find the perfect midpoint color between two shades? It's easy with 'Colors in Between':

1. Select your starting and ending colors.
2. Allow the tool to compute the in-between colors.
3. Delve into the created gradient and incorporate these colors into your designs.

## Features of "Colors in Between" include:

- **Flawless Gradients**: Forge exquisite, smooth transitions between any pair of colors.
- **Adjustable Gradient Steps**: Tailor the gradient's progression for precise control.
- **User-Friendly Interface**: Effortlessly choose colors with an intuitive design.
- **Diverse Uses**: Perfect for web design, digital art, interior decorating, and more.

## Why Opt for "Colors in Between"?
1. **Elevate Your Designs**: Infuse your work with depth and sophistication using the ideal gradients.
2. **Time Efficiency**: Swiftly pinpoint the perfect color pairings, bypassing trial and error.
3. **Creative Exploration**: Venture into new color territories and expand your artistic horizons.

## Embrace the Color Revolution
At HEX Color, our mission is to equip you with tools that both inspire and simplify your creative process. 'Colors in Between' is our newest contribution to this mission. Give it a try and discover how it revolutionizes your color approach in projects. Remember, every hue has a story at HEX Color, and 'Colors in Between' is ready to narrate your next vibrant narrative.

[https://hexcolor.co/colors-between](https://hexcolor.co/colors-between)
Tarjetas de presentación con relieve
Published: 2023-11-23 19:42:00

[Tarjetas de presentación con relieve.](https://buenaprensa.mx/tarjetas-de-presentacion-con-relieve/)


La impresión letterpress o Impresión en relieve es la mejor forma de hacer una tarjeta de presentación elegante. Sin importar si es una tarjeta de presentación, esto es gracias a los papeles de alta calidad que Buena Prensa utiliza, los cuales son importados desde Italia para asegurar la calidad de nuestro trabajo.
Create a simple http server with node.js
Tags: http, node, typescript, javascript
Published: 2023-11-23 19:25:48

Welcome to my new blog! Today we will start the adventure of exploring the world of web applications using Node.js. We'll start with something simple - create your own HTTP endpoint using [Cavia Framework](https://github.com/caviajs).

## Why Cavia?

Cavia is a lightweight library for handling HTTP requests in Node.js. Its simplicity makes it perfect for those who want to quickly start creating simple web applications.

## Step 1: Installation

The first step is to install the packages for your project using the command below.

```shell
npm install @caviajs/http-router @caviajs/http-exception rxjs --save
```

> You can also use a template available at [typescript-starter](https://github.com/caviajs/typescript-starter).

## Step 2: Endpoint

Now let's create our entry point. Let's enter the following code in the `app/web.ts` file:

```typescript
import http from 'http';
import { HttpRouter } from '@caviajs/http-router';

(async () => {
  const httpRouter: HttpRouter = new HttpRouter();

  httpRouter
    .route({
      handler: async (request, response): Promise<string> => {
        return 'Hello world!';
      },
      method: 'GET',
      path: '/hello',
    });

  const httpServer: http.Server = http.createServer((req, res) => {
    httpRouter.handle(req, res);
  });

  httpServer.listen(8080, () => {
    console.log(`Http server listening at port ${8080}`);
  });
})();
```

## Step 3: Starting the server
When our entry point is ready, we can now start the server.

```shell
npx ts-node app/web.ts
```

Running the `app/web.ts` file will start the server and we will be able to test our endpoint by entering the address in the browser http://localhost:8080/hello.

It's all for today! I hope this short post was helpful to you. In the next articles we will develop our web application. See you!
Building a RESTful API with Node.js and Express: A Step-by-Step Guide
Tags: programming, node, express
Published: 2023-11-23 19:11:24

**Introduction:**

In this tutorial, we'll walk through the process of creating a RESTful API using Node.js and the popular web framework Express. Building APIs with Node.js and Express is a common and powerful approach, providing flexibility, scalability, and a straightforward development experience. Let's dive into the steps to create a robust API that can handle CRUD operations.

**Prerequisites:**

- Basic understanding of JavaScript and Node.js.
- Node.js installed on your machine.

**1.** **Setting Up the Project:**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f4wbpbrydsyqkhy9xp6c.png)

**2.** **Creating the Express Server:**

Create a file named **server.js** and set up the basic structure for your Express server.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mmkaqyd8oqrp1n8zvc6k.png)


**3.** **Implementing CRUD Endpoints:**

Expand your server.js file to include CRUD endpoints for a hypothetical resource (e.g., users).


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zo7eqlptjlcdreatgg9u.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fcxydq2rw4pvuyuce85z.png)
 

**4.** **Testing Your API:**

- Run your server using node server.js.
- Use tools like Postman or curl to test your API endpoints.

**Conclusion:**

Congratulations! You've successfully created a RESTful API using Node.js and Express. This simple API serves as a foundation that can be expanded to suit the needs of your project. Feel free to enhance it with features like data validation, database integration, or middleware for additional functionality.
Episode 23/46: Implicit Imports & Signal-based inputs, Becoming Angular Contributor, DI deep-dive
Tags: webdev, programming, angular, javascript
Published: 2023-11-23 19:10:56

Minko Gechev shared plans for upcoming features like "Implicit Imports" and "Signal-based Inputs". Matthieu Riegler on what it means to be an Angular contributor and Thomas Laforge with a deep-dive into Angular's DI.

{% embed https://youtu.be/7SR7b2tW5Qs %}

## Implicit Imports

Minko Gechev, Angular product lead, was a guest at Francesco Ciulla's livestream. In general, it was a basic introduction to 17, but Minko dropped a comment about an "implicit import" feature which might land in the upcoming versions.

That means we only have to provide the TypeScript import at the beginning of the file but not in the component's decorator.

{% embed https://www.youtube.com/live/ge07eJgvtvc %}

That was quickly picked up on X for obvious reasons, which caused the typical pros & cons discussions.

{% embed https://twitter.com/ipwanciu/status/1725599609546784925 %}

## Signal-based Inputs

The same Minko Gechev was a guest at the ThisDotMedia livestream, where Brandon Roberts, Enea Jahollari and Deborah Kurata joined him. He mentioned that we might even get a  Signal-based input in the 17.2.

He also explained what's going on behind the curtains and how much effort the Angular team puts into bringing different partners, libraries, and the complete ecosystem together to ensure that changes don't break anything.

Enea Jahollari brought up another interesting point. The source code of the new Angular website, angular.dev serves as a template for a modern Angular application. Minko added that they want to make it zone-less as soon as the framework allows it.

{% embed https://www.youtube.com/live/w-W7OTbZ1kk %}

## Becoming an Angular Contributor

Matthieu Riegler spent some time on the AngularAir podcast, giving tips on becoming an Angular contributor. Along with some quite insightful information, he warned about introducing breaking changes.

The Angular team has to fix all major breaking changes. Given the number of Angular applications inside Google, that's impossible. They rely quite a lot on the power of schematics, which automate those changes. Such a schematic has to be part of every PR which introduces a breaking change.

{% embed https://www.youtube.com/watch?v=8-KxBmiPbCk %}

## Deep-Dive DI

Thomas Laforge published a detailed article on dependency injection. It might not be that obvious, but different types of injectors are available.

For example, we have a PlatformInjector, a NullInjector, and - of course - the RootInjector. So, reserving some time to study his article is definitely well spent.

{% embed https://medium.com/ngconf/how-angular-dependency-injection-works-under-the-hood-cc210f7040bd %}
My first data analysis project using Ms excel.
Published: 2023-11-23 18:00:25

After so many years of aspiring to become a data analyst, I then decided to put in for a Data analytics training with the FBO research center. 

I am so excited I successfully completed this training, and I can say badly that I have added a great knowledge to myself.

I would like to walk you through the knowledge gathered.

1. **Data cleaning**: I was given a data to work with, the data seemed very dirty. the process of cleaning my data took me a lot of time.
In the process of my data cleaning, I ensured the following:
-Removing duplicates.
-Removing irrelevant data.
-Clear formatting.
-Fix errors.
-Handle missing values.
-Removing outliers.
-Removing spaces.
Here is a picture of my data cleaning.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fe62o8xkx8mrx1kfpqnq.png)
This data has 2561 rows and 25 columns.

2. Pivot tables: After which I have successfully cleaned up my data, I then decided to explore my data. After a lot of brainstorming, I then decided to come up with some ideas to analyze my data based on the set of data provided, which led me to the creation of my pivot tables. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z9a55mfq7v0qaot13kkr.png)

3. Data visualization: As I was taught that this is the most crucial part of data analysis, and it is core.
I decided to analyze my data through the use of Pie chart, bar chart and column charts.
Below is the picture of my dashboard.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z7nv1n3e7xazkwwkprk7.png)

THANKS FOR YOUR PATIENCE I FOLLOWIG UP TO THE END OF THIS PROJECT, GOD BLESS.
Welcome
Tags: ai, bard, chatgpt
Published: 2023-11-23 17:56:56

Here im asking for the blog name for my new blog some interesting and quit smilar results were given by Bard and Chatgpt

prompt - 

Need my personal blog name my name mohan im a developer and i going to write technology , and ai and codeing and development related blog content 

Results

bard 

Tech Tales with Mohan

Mohan's Digital Musings

The Code Chronicles of Mohan

Dev Diaries by Mohan

Mohan's AI Adventures

Mohan's Tech Trek

Mohan's Programming Playground

Unlocking the Techverse with Mohan

Mohan's Tech Toolbox

Mohan's Tech Odyssey


Chat gpt

CodeMohan's Corner
DevInsights by Mohan
TechMohan Chronicles
AIAlly: Mohan's Tech Journey
DevCrafted with Mohan
CodingMohan's Vault
ByteMohan's Tech Hub
The AI Developer's Notebook
Mohan's Code Compass
TechSaga: By Mohan

chat gpt

 Prompt
 need more catchy

Mohan's Code Symphony
BitsOfMohan: Tech Tales
QuantumMohan: Code Unleashed
Mohan's Byte Beat
TechMindscape with Mohan
Mohan's Algorithmic Odyssey
InfiniteLoop by Mohan
Mohan's Binary Brilliance
CodaFusion: Mohan's Tech Hub
NeuralNectar: Mohan's Coding Corner


Chatgpt

PROMPT
short in two lines

ByteWise by Mohan: Unleashing Code, Crafting Tomorrow.
Mohan's TechVerse: Where Algorithms Dance, Ideas Ignite.
Creating a RESTful API with Flask
Tags: flask, restfulapi, python, webdev
Published: 2023-11-23 17:50:30

## Introduction:
- Brief overview of RESTful APIs.
- Why Flask is a popular choice for building APIs.

### Step 1: Setting Up Flask Project:
1. Install Flask using pip.
```bash
pip install flask
```
2. Create a new Flask project directory.

### Step 2: Building the API Structure:
1. Create the main Flask application file (app.py).
2. Define routes for different API endpoints (GET, POST, PUT, DELETE).

### Step 3: Implementing CRUD Operations:
#### Endpoint 1: Retrieving Data
1. Create a route to retrieve all data.
2. Implement a function to handle the GET request.

#### Endpoint 2: Adding Data
1. Set up a route to add new data.
2. Implement a function to handle the POST request.

#### Endpoint 3: Updating Data
1. Define a route for updating existing data.
2. Implement a function to handle the PUT request.

#### Endpoint 4: Deleting Data
1. Create a route for deleting data.
2. Implement a function to handle the DELETE request.

### Step 4: Testing the API:
1. Install Postman for API testing.
2. Create requests for each CRUD operation.
3. Test the API locally.

## Conclusion:
1. Recap the key steps.
2. Emphasize the importance of testing and documentation.

<a href="https://www.freepik.com/free-photo/smartphone-with-opened-ai-chat-it_41673082.htm#query=A%20screenshot%20of%20a%20simple%20Flask%20API%20code%20snippet&position=7&from_view=search&track=ais&uuid=cd515f1d-629a-44d1-a0a9-7d7eb37d8de1">Image by frimufilms</a> on Freepik
Top 7 most used JavaScript syntaxes
Tags: webdev, javascript, programming, frontend
Published: 2023-11-23 17:45:25

JavaScript is the most used language based on GitHub stats [(more info)](https://dev.to/szabgab/the-most-popular-programming-languages-on-github-2i6b), and after my first article on this website, I got excited and decided to create a fun list of Top 7 most used JavaScript syntaxes based on AI research. 

###Variables and Constants: Declaring variables and constants using var, let, and const.

![Example of JavaScript Variables and Constants](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4dj3fxntwxg88gl7lrz5.jpg)

###Functions: Defining functions for reusable blocks of code.

![Example of JavaScript Functions](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nb3xbyob80vkchnx62w6.jpg)

###Conditional Statements: Using if, else if, else for decision-making in code execution.

![Example of JavaScript Conditional Statements](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zm10tc5wn6vi3djq2nle.jpg)

###Loops: Employing loops such as for, while, and do...while for iteration.

![Example of JavaScript Loops](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g7plyps8jnscyz9e5dha.jpg)

###Objects and Arrays: Creating and working with objects and arrays.

![Example of JavaScript Objects and Arrays](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gw4td68bhrpsrgnradrg.jpg)

###Arrow Functions: A concise way to write functions.

![Example of JavaScript Arrow Functions](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kdhwoq5jde5tpv56764z.jpg)

###Template Literals: Utilizing backticks (`) for string interpolation.

![Example of JavaScript Template Literals](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jcbnp6a22k9kh6pky5eu.jpg)

I hope you like the list. 

Is there any syntax that needs to be added here? Let me know in the comments.
The Power of Mentorship in Coding: Building Connections Beyond the Screen
Tags: mentorship, codingcommunity, techskills, humansideofcode
Published: 2023-11-23 17:34:08

In the vast landscape of coding, where lines of code sprawl like uncharted territories, mentorship emerges as the compass guiding many on their coding odysseys. My own coding journey has been shaped by the unseen heroes—mentors—whose impact reaches far beyond the confines of syntax and algorithms.

**Embracing the Learning Curve**
Coding is a journey of constant learning, and navigating this ever-evolving landscape can be both exhilarating and daunting. It was in the early stages of my coding endeavors that a mentor stepped into the picture, offering more than just technical expertise. Their guidance extended beyond the screen, embracing the inherent imperfections of the learning curve.

**Anecdotes of Impact**
One mentor stands out vividly in my memory. Their willingness to share experiences, failures, and the unfiltered reality of coding painted a more relatable picture of the coding world. These anecdotes weren’t just about debugging; they were about navigating the unpredictable seas of a developer's life.

**Building a Supportive Community**
Mentorship isn’t just about code reviews or debugging sessions; it’s about fostering a supportive community. Beyond technical skills, mentors impart lessons on resilience, problem-solving, and the invaluable art of collaboration. The connections built in these mentorship relationships extend far beyond the screen—they form the bedrock of a thriving coding community.

**Beyond Technical Skills**
In the realm of coding, technical proficiency is undoubtedly crucial, but the power of mentorship lies in its ability to nurture the human side of coding. The encouragement to embrace imperfections, learn from failures, and persist through challenges forms the essence of mentorship.

**Conclusion**
As we navigate the intricate lines of code, let’s not underestimate the transformative power of mentorship. Beyond the syntax and algorithms, it’s the human connections, the shared anecdotes, and the supportive community that truly make the coding journey extraordinary.

In embracing mentorship, we not only enhance our technical skills but also contribute to a tapestry of interconnected coders—each one a hero in their own right.

Image by <a href="https://www.freepik.com/free-photo/person-using-ai-tool-job_60368915.htm#query=symbolic%20of%20mentorship%20and%20human%20connection%20in%20the%20coding%20world&position=15&from_view=search&track=ais&uuid=618d6c0f-a104-4e57-bf38-fe8377c47cf9">Freepik</a>
Interview Asked Javascript Question (Closure)
Tags: javascript, backenddevelopmentin, behavioralinterviewq, codinginterview
Published: 2023-11-24 06:38:02

---
title: Interview Asked Javascript Question (Closure)
published: true
date: 2023-11-23 17:33:56 UTC
tags: JavaScript,Backenddevelopmentin,Behavioralinterviewq,Codinginterview
canonical_url: https://www.nileshblog.tech/javascript-important-interview-ask-question-on-closure/
---

Question aksed in Inteview : you have to write an Javscript code to print number in increasing order in each 1 secound differ or print num like at 1 sec- 1 , 2 sec -2 , 3 sec -3 … n sec -n. sr Time out Output 1 1 1 2 2 2 3 3 ... [Read more](https://www.nileshblog.tech/javascript-important-interview-ask-question-on-closure/ "Most Aksed Interview Javascript Question (Closure)")

The post [Most Aksed Interview Javascript Question (Closure)](https://bit.ly/javascript-interview-question) appeared first on [NileshBlog.Tech](https://www.nileshblog.tech).