teleren/devto huggingface dataset:
Complete code Send mail on node JS for 60s
Published: 2022-12-03 04:53:02

## Install Nodemailer

If you want to learn more about Nodemailer you can read here:
[https://www.npmjs.com/package/nodemailer](https://www.npmjs.com/package/nodemailer)

Turn on the Terminal and type the following command to install

>     npm i nodemailer

## Handling Send Mail
The outermost of the project creates the file as follows the following folder

![handle sendMail](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vdlv7bainrhzl218w8rv.png)

**Code handle send mail (sendMail.js)**

>     const nodemailer = require("nodemailer");
>     const transport = nodemailer.createTransport({
>       service: "Gmail",
>       auth: {
>         user: Email name you use to send,
>         pass: Email password you use to send,
>       },
>     });
>     module.exports.sendConfirmationEmail = (name, email) => {
>       transport
>         .sendMail({
>           from: user,
>           to: email,
>           subject: "Confirm your registered account",
>           html: `<h1>Email Confirmation</h1>
>             <h2>Hello ${name}</h2>
>             <p>You have successfully registered an account. Please confirm your email by clicking on the following link</p>
>             </div>`,
>         })
>         .catch((err) => console.log(err));
>     };

## Handling Router

**Code handle router (router.js)**
Add the following code to the router .js

>     const sendMail = require("../utils/sendMail");
>     router.post("/sendmail", async (req, res, next) => {
>       try {
>         sendMail.sendConfirmationEmail(req.body.name, req.body.email);
>         return res.status(200).send("Oke");
>       } catch (err) {
>         console.log("🚀 ~ file: Routers.js:11 ~ router.post ~ err", err);
>         next(err);
>       }
>     });

## Run test results
**Here I use insomnia to test API**

![insomnia](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tef30g7kh5ca29ivnh7h.png)

**Check mail**

![Check mail](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zswz3lb3eqmxxlxn4hfi.png)

## Conclusion
If you do not understand something, you can message me or join this group Zalo: Link, to exchange knowledge about BackEnd Nodejs
How To Explain Test Automation Framework To The Interviewer
Tags: webdev, beginners, tutorial, programming
Published: 2022-12-03 04:39:52

Test Automation Framework Interview Questions: In this video, I am going to explain, How To Explain  Test Automation Framework To The Interviewer. No matter if you are explaining the Framework in your Telephonic interview or in person, You can use this mind map to explain in a simple manner. 

{% embed https://youtu.be/FdTfbGlrPIk %}

#automationtesting  #testautomation #testautomationframework #scrolltest

👨‍🎓 Become an Automation Rockstar  : https://thetestingacademy.com/


✅  Subscribe​ to The Testing Academy Channel.
→ https://sdet.live/89q8


🔔 TURN ON NOTIFICATIONS🔔 

I have discussed about two Test Automation Framework in Java, TestNG selenium and Web-driver, ReportNG, POM, POI lib, Maven Project.

Download Test Automation Framework #1 : https://github.com/barancev/webdriver...


Mind Map : https://mm.tt/1380022206?t=6OwQFbLDNy


Download  Test Automation Framework #2 :
https://github.com/PramodDutta/PageOb...

with Playwright 
https://github.com/PramodDutta/Playwr...


-----------------------------------------------------

👪 Join our Community - http://bit.ly/learntesting2019


✅ Automation Community - https://thetestingacademy.com


🐦Follow us on Twitter  - https://twitter.com/itstechmode


📖 Like us on Facebook - https://www.facebook.com/scrolltest


🎤  Listen to our Podcast - https://anchor.fm/thetestingacademy


-------------------------------------------------------
🚀 Tools and services I recommend:
Some of the courses that I recommend to become better Automation Tester 🙌🙌

✅Selenium Training and Certification -
https://scrolltest.com/go/edureka


✅Learn Jenkins for QA -
https://bit.ly/learnjenkins-p1


✅Programming Java -
https://bit.ly/learnjava2020-p1


✅Test Automation - 
https://bit.ly/learnautomation2020


✅API Testing - 
https://www.learnapitesting.com


✅Cypress Tutorial with LIVE Projects -
http://cypresstutorial.com


#TheTestingAcademy
— The Testing Academy
Telescope - filtering feed URLs - planning
Published: 2022-12-03 04:21:24

I am working on an issue in [telescope ](https://github.com/Seneca-CDOT/telescope) to [only return relevant feed URLs when given a blog URL](https://github.com/Seneca-CDOT/telescope/issues/3688). During the sign-up process, users provide a blog URL, which is used to find and show a list of blog feed URLs. The user can select one or more of these, which are then used to display the blog posts for the user: 

![Blog URL form](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/717q6n6d3uqivfcxpzfr.png)

However, some of these feed URLs are not relevant, such as the comments feed for WordPress: `https://<user>.io/comments/feed`. This needs to be changed so that only the relevant feed URLs are returned. 

I already know a bit about how the process of getting feed URLs from a blog URL works since I have worked on the feed discovery service in the past. The response for a blog URL includes has `<link>` tags for various feed URLs. 

So, to implement the filtering feature, I would first need to identify the types of feed URLs that are returned by various blog hosts, and then decide which ones are relevant and should be kept. I do not know much about the types of feed URLs there could be. So, my initial plan is to use regular expressions to match the common patterns among the ones that should not be kept. For example, we do not want any feed URLs that have the word `comments` in them.

Once the filtering rules are determined, I would simply need to add a new function (and some tests for the new filtering logic) to filter the URLs before displaying them to the user.
Could u help me ?
Tags: python
Published: 2022-12-03 01:18:05

I am learning python so i don't have a lot knowledge about the language my code is preseting an error in the end of the code. Could u help me with that problem ?
I will be so glad for that. 


# -*- coding: utf-8 -*-
"""Data Science from zero

Automatically generated by Colaboratory.

Original file is located at
    https://colab.research.google.com/drive/1GHzLZok20tuyOzVbbQc2nNQO6hdlUZgW
"""

users = [
{ "id": 0, "name": "Hero" },
{ "id": 1, "name": "Dunn" },
{ "id": 2, "name": "Sue" },
{ "id": 3, "name": "Chi" },
{ "id": 4, "name": "Thor" },
{ "id": 5, "name": "Clive" },
{ "id": 6, "name": "Hicks" },
{ "id": 7, "name": "Devin" },
{ "id": 8, "name": "Kate" },
{ "id": 9, "name": "Klein" }]

friendships = [(0, 1), (0, 2), (1, 2), (1, 3), (2, 3), (3, 4),
(4, 5), (5, 6), (5, 7), (6, 8), (7, 8), (8, 9)]

for user in users:
  user["friends"] = []

from posixpath import join
for i, j in friendships:
  users[i]["friends"].append(users[j]) # adiciona i como um amigo de j
  users[j]["friends"].append(users[i]) # adiciona j como um amigo de i

def number_of_friends(user):
#quantos amigos o usuário tem?
  return len(user["friends"]) # tamanho da lista friend_ids
total_connections = sum(number_of_friends(user)
for user in users)

from __future__ import division
num_users = len(users) # tamanho da lista de usuários
avg_connections = total_connections / num_users # 2.4

num_friends_by_id = [(user['id'], number_of_friends(user)) for user in users]

#### in this part is presenting a error could u help me ?
users_popular = sorted(num_friends_by_id,
                       key=lambda (user_id, num_friends): num_friends, reverse=True
Fix CORS policy error on Nodejs with 2 super simple steps
Published: 2022-12-03 03:57:50

## What is CORS?

**Cross-origin resource sharing (CORS)** is a mechanism that allows restricted resources on a web page to be requested from another domain outside the domain from which the first resource was served.

## How does CORS policy error show?

>     Access to XMLHttpRequest at 'http://localhost:3333/user/Login' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

## How to fix CORS policy error on nodejs?

- Step 1: Install CORS 

>     npm i cors

- Step 2: put CORS in request
Open the app.js file and add the following 3 lines.

>     var cors = require('cors')
>     var app = express()
>     app.use(cors())

Also, you can add some more customizations here: [https://www.npmjs.com/package/cors](https://www.npmjs.com/package/cors)

## Conclusion
If you do not understand something, you can message me or join this group Zalo: [Link](https://zalo.me/g/ogwolo655), to exchange knowledge about BackEnd Nodejs
Thank You DEV 😊
Tags: beginners, codenewbie, discuss, showdev
Published: 2022-12-03 03:52:50

#### Thank You DEV and the community for providing this opportunity to learn and grow as a coder. 

I am excited to be a part of this community and look forward to contributing to the community as much as I can.

It's almost the end of the year and I am looking forward to the new year and all the new opportunities it will bring.

I learned a lot of things from this community and I am grateful for that, thank you for sharing the articles and the knowledge. I want to mention my favorite authors @ben and @dailydevtips1.

I have also built a **Git CheatSheet repository** which is a much-upgraded version of my article. This repo includes most of the commands and some courses that I have found useful. Do check it out [here](https://github.com/mrkrishnaagarwal/git-cheatsheet)

**Special Thanks to DEV for the '2022 DEV GIFT'**

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

**Happy Coding and Happy New Year everyone!**

P.S. Do check out my other articles on DEV [here](https://dev.to/krishnaagarwal) and follow me on GitHub [here](https://github.com/MrKrishnaAgarwal)

**Do drop your lovely and thankyou comments for DEV community and the community members.**
28 EA artefacts for an organization to thrive into success.
Tags: enterprisearchitecture, organizationgrowth, digitaltransformation
Published: 2022-12-03 03:52:50

28 artefacts showing aggregated view of popular EA artefacts used in organizations with their most essential properties, including their informational content, representation format, high-level structure, overall meaning, typical usage, temporal lifecycle, general role, key purpose and associated benefits.
Count 1's in a Sorted Binary Array
Tags: javascript, leetcode
Published: 2022-12-03 03:40:12

Below code is generic can be used to find occurrences of any number provided array is sorted with only 2 unique element

```js
var getOneCount = function (nums, target) {
  let high = nums.length - 1;
  let low = 0;

  while (low <= high) {
    let mid = parseInt((low + high) / 2);

    if (nums[mid] > target) {
      high = mid - 1;
    } else if (nums[mid] < target) {
      low = mid + 1;
    } else {
      if (mid === 0 || nums[mid - 1] !== nums[mid]) {
        return nums.length - mid;
      } else {
        high = mid - 1;
      }
    }
  }

  return -1;
};

console.log(getOneCount([0, 0, 1, 1, 1, 1, 1], 1));

```
Find First and Last Position of Element in Sorted Array
Tags: javascript, leetcode
Published: 2022-12-03 03:38:44

[Find First and Last Position of Element in Sorted Array](https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/)
```js
/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number[]}
 */
var searchRange = function (nums, target) {
  const firstOcurance = searchFirstOccurance(nums, target);
  const lastOcurrance = searchLastOccurance(nums, target);
  if (firstOcurance === -1) {
    return [-1, -1];
  } else {
    return [firstOcurance, lastOcurrance];
  }
};

var searchFirstOccurance = function (nums, target) {
  let high = nums.length - 1;
  let low = 0;

  while (low <= high) {
    let mid = parseInt((low + high) / 2);

    if (nums[mid] > target) {
      high = mid - 1;
    } else if (nums[mid] < target) {
      low = mid + 1;
    } else {
      if (mid === 0 || nums[mid - 1] !== nums[mid]) {
        return mid;
      } else {
        high = mid - 1;
      }
    }
  }

  return -1;
};
var searchLastOccurance = function (nums, target) {
  let high = nums.length - 1;
  let low = 0;

  while (low <= high) {
    let mid = parseInt((low + high) / 2);

    if (nums[mid] > target) {
      high = mid - 1;
    } else if (nums[mid] < target) {
      low = mid + 1;
    } else {
      if (mid === nums.length - 1 || nums[mid] !== nums[mid + 1]) {
        return mid;
      } else {
        low = mid + 1;
      }
    }
  }

  return -1;
};

console.log(searchRange([5, 7, 7, 8, 8, 10], 8));

```
New React Native Template 2023 for start new app. I choice it
Tags: reactnative, ios, android, react
Published: 2022-12-03 03:20:26

Hi everybody, i just build a boilerplate React Native for my work, i can start new app a way easy. I'm inherited and inspired by:

- [bulletproof-react](https://github.com/alan2207/bulletproof-react)
- [ignite](https://github.com/infinitered/ignite)


![Demo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ligjv6396ykydiy5ixo5.gif)


I create many component to help build UI easier: Col, Row, Align, Stack, Positioned, Card, Image, If, Center, AppBar,... 

To can build it i use:
- React Native
- React Navigation 6
- Zustand
- Typescript
- Local storage with MMKV
- Axios
- Flipper
- Multiple environment development with react-native-config
- Modal, popup with react-native-modals
- Theme with @shopify/restyle
- Form validation with react-hook-form, yup
- Multi language with react-i18next, i18next
- Splash with react-native-bootsplash
- Error Boundary
- Font setting
- Format source with eslint, prettier
- Animation with moti, reanimated

Any developer seeing this post can give me advice to improve my repository. Really thank you very much.
Please checkout: 
[https://github.com/bonnguyenitc/react-native-starter](https://github.com/bonnguyenitc/react-native-starter)
AWS CLI: Make your life easier with This one change
Tags: aws, beginners, devops, webdev
Published: 2022-12-03 03:15:22

---
title: "AWS CLI: Make your life easier with This one change"
published: true
description: "Never use your 
tags: aws,beginner,devops,webdev
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lb2do26rk6ofmrjqcrtr.png
# Use a ratio of 100:42 for best results.
# published_at: 2022-11-29 05:34 +0000
---


## Summary

Did you know you can use AWS CLI in interactive mode with autocomplete !?

So, this mean no more looking up commands or parameters for different services when using the AWS CLI.

## Requirements

Before trying this out, make sure you have the AWS CLI version 2.

> **⚠️ Note:** This is required!

## Getting started

There are a few ways to enable this feature.


### 1. Using the environment variable

```sh
export AWS_CLI_AUTO_PROMPT=on-partial
```

or

```sh
export AWS_CLI_AUTO_PROMPT=on
```


### 2. Using CLI Parameter


```sh
aws --cli-auto-prompt
```


### 3. Using AWS CLI config (Save it to your preference)

```sh
aws configure set cli_auto_prompt on-partial
```


## Demo

Here is a little demo of this feature in action.



{% embed https://twitter.com/jerry__chang/status/1595289541862359040 %}


What a time saver! No more looking up parameters for AWS services when using the CLI.

Try it out for yourself!

And... That’s it.

If you found this helpful be sure to like and comment 🙏❤️ (Thanks!)
How to make a development environment
Published: 2023-01-21 20:06:19

---
title: How to make a development environment
published: true
date: 2022-12-03 02:53:30 UTC
tags: 
canonical_url: https://a6hi.hashnode.dev/how-to-make-a-development-environment
---

Every development environment has a

- Shell (ZSH, Fish, Bash, Powershell, etc)

- Code Editor (Vim/Neovim, Emacs, Visual Studio, VS Code, etc.)

- OS (Windows, Mac, Linux, etc.)

- Usual Field Of Programming (Web Development, Terminal Apps, Drivers, Game Development, etc.)

## Shells

A shell is a way to interact with a computer using commands, here are **MY** recommendations.

- Linux: [Fish](https://fishshell.com/) or [ZSH](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH#user-content-install-and-set-up-zsh-as-default)

- macOS: [Fish](https://fishshell.com/) or [ZSH](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH#user-content-install-and-set-up-zsh-as-default)

- Windows (WSL): [Fish](https://fishshell.com/) or [ZSH](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH#user-content-install-and-set-up-zsh-as-default)

- Windows (Regular): [Powershell](https://learn.microsoft.com/en-us/powershell/scripting/overview?view=powershell-7.3), [Git Bash](https://git-scm.com/downloads), or [msys2](https://www.msys2.org/)

## Code Editors (IDEs)

A code editor (or IDE) is an app used to edit code (duh), here are **MY** recommendations.

- Power Users: [Neovim](https://neovim.io/)/[Vim](https://www.vim.org/download.php)

- GNU Lovers: [Emacs](https://www.gnu.org/software/emacs/)

- Microsoft Worshippers: [Visual Studio](https://visualstudio.microsoft.com/)

- Rich Developers: Jetbrains Suite

- Normies: [Visual Studio Code](https://code.visualstudio.com/)

## OS (Operating System)

This section is pretty self-explanatory, but here are **MY** recommendations.

- Rich Devs: macOS

- Linux Normie: Ubuntu

- Linux Flexer: Arch Linux

- Normies: Windows

## Field Of Programming

This isn't a recommendation, but a small guide to fields.

### Web Development

#### Front End

This is the development of the graphical user interface (GUI) of a website

Types Of Languages needed:

- Markup (HTML, Pug/Jade, Haml, Slim, Mustache, Nunjucks, etc)

- Styling (CSS, PostCSS, SCSS, Sass, Less, Stylus, etc)

- Scripting Language (Javascript, Typescript, CoffeeScript, LiveScript, etc.)

#### Back End

This refers to the server side of an application and everything that communicates between the database and the browser.

Popular Languages:

- Python

- NodeJS

- Java

- C#

### Terminal Apps

Small, text-based apps are usually meant for developers.

Popular Languages:

- Python

- NodeJS

- Rust

- Go

- C++

- C

### Drivers

Apps that run in the background that help a service and are really important for Computers.

Languages:

- Rust

- C++

- C

## Conclusion

There are many tools, shells, and Fields To Programming, hopefully this article made it simpler!
An Introduction to JavaScript in Hindi
Tags: javascript, javascriptinhindi, webdev, beginners
Published: 2022-12-03 02:50:52

# An Introduction to JavaScript in Hindi

चलो देखते है की JavaScript में ख़ास क्या है , हम इस्से क्या कर सकते है और ऐसी कौनसी Technologies है जो JavaScript के साथ सबसे अच्छी रहेंगी

## What is JavaScript ? **<mark><sup>JavaScript क्या है</sup></mark>**

JavaScript को शुरू में web pages को alive करने के लिए develop किया गया था

Basic Example : - जैसे हम किसी site के button पर click करते है तो हम किसी दूसरे page पर चले जाते है. ये एक बिलकुल basic functionality थी उस time की जब JavaScript को develop किया गया था ( NOTE :- लेकिन अब ये काम HTML से हो जाता है जो पहले नहीं होता था )

जो programs JavaScript की मदद से develop किये जाते थे उनने scripts कहा जाता था और आज भी हम इन programs को scripts के नाम से ही जानते है. ये programs directly HTML में लिखे जा सकते है और ये programs/scripts automatically जब भी कोई पेज लोड होता है तो run होते है . इन programs/scripts को चलाने के लिए कोई special preparation या compilation की जरूरत नहीं होती.

**इन्ही कारणों की वजह से जो JavaScript है वो बिलकुल अलग है** [**Java**](https://en.wikipedia.org/wiki/Java_(programming_language)) **से**

आज के समय में JavaScript ना सिर्फ browser में बल्कि server पर या ऐसा कोई भी device जिसमे एक special program है वहा चलाई जा सकती है. जिसका नाम है [the JavaScript Engine](https://en.wikipedia.org/wiki/JavaScript_engine) (special program name).

Browser में एक embedded engine होता है जिसे हम "JavaScript Virtual Machine" के नाम से भी जानते है.

हर एक JavaScript engine के अलग अलग special नाम होते है. For example :-

*   V8 - in Chrome, Opera and Edge web browser
    
*   Spider Monkey - in Firefox
    

इसका मतलब है अगर कोई feature V8 engine में support करेगा तो वो Chrome, Opera and Edge web browser में भी चलेगा.

## What makes JavaScript unique ? **<mark><sup>JavaScript सबसे अलग क्यों है</sup></mark>**

यह पर तीन ऐसी बाते है जो बहुत ही अच्छी है JavaScript से related

*   HTML/CSS के साथ पूरी तरह से काम करना ( full Integration)
    
*   जो काम आसानी से होना चाहिए वो आसानी से ही होता है
    
*   JavaScript सभी browsers को support करती है और ये पहले से ही enabled (by default) होती है
    

सिर्फ JavaScript ही एक ऐसी technology है जो ये तीन काम कर सकती है और इन्ही कारणों की वजह से JavaScript सबसे अलग (unique) है

JavaScript सबसे famous tool है browser interface बनाने के लिए, इस्से अलग JavaScript का इस्तेमाल Server, mobile applications आदि बनाने क लिए भी किया जाता है.
Hello.. I don't know which policy is violating.
Tags: adsense, ads, google
Published: 2022-12-03 01:48:35

Please dear. Guide, Which policy is violating
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vf989kboehwtid99cfhl.png)[](https://www.pakshare.cloud/) on my website.

https://www.pakshare.cloud/
  So, I will fix this..  This 2nd time , I am getting error.
Plans for something bigger
Tags: opensource, planning
Published: 2022-12-03 01:46:54

Hey there! 

This week, I've been looking for some bigger fish to catch, that being doing something bigger than I did before. 

My open source journey so far has been doing more or less simple things, in order to get to know the community better, and get my tool knowledge up right. So, now that I am fairly confident in myself (in terms of Open Source contributing) and my skills, it is finally time to get working harder.

What sounds more perfect in my case than implementing a new feature instead of fixing a visual bug? Exactly! So, my initial plan was to find myself an issue that required to write new code, instead of fixing the existing stuff. It was time to find something to work on.

## Project and issue

After searching for a couple of hours, I found an issue that appealed a lot to me.

It was in a repo called [Wego Overseer](https://github.com/rickklaasboer/wego-overseer), which appears to be a Discord bot for a specific community. Chat bots have always been something I wanted to try, and this sounded like a perfect opportunity!

[The issue itself](https://github.com/rickklaasboer/wego-overseer/issues/55) was about implementing a chat poll feature that could be done via emoji-reactions under a message. This felt to me like something I have been searching for, challenging my skills and not as easy as my previous contributions.

## My plan for implementation

Before jumping right into coding, I will have to examine the project and do some research about the tools it uses, such as Discord.js, knex, and Objection.

First things first, I will have to set it up locally and get it running. Then, I'll test it a bit to sense the way it works.

After setting up, I will read through documentation on the tools I have mentioned before. Once I get a hang of how they are used, I will try to design my solution, i.e. how the poll creator UX will feel, how the poll will look like, what logic it will be using in order to show poll results, think of other details, etc.

After my solution is looking good on paper, and I have a feeling of how to implement it, I will start coding. I will try to create a new command first, and then gradually try turning it into how I designed it.

Hoping it goes well!