teleren/devto huggingface dataset:
Adding JWT Auth on Node.js the easy way
Tags: backend, node, typescript, express
Published: 2024-02-16 06:54:17

JWT are a quick way to lock a small API for access and authentication. By doing it right, even on large project, JWT can be of use. Right here, I detail a utility I created and use. 

This utility is injected in the header method when a bearer token is sent. Bearer token are authentication token passed over the HTTP Client authentication scheme.

**Here is the code for the utility:
**

**Header Token**

You can implement this code in your library code for easier global access.

Install from npm:

`npm install ensure-token`

Or visit [Ensure-Token](https://github.com/Ethern-Myth/ensure-token)


![Ensure Token](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wus2v93totvr2rjoxbjp.jpg)

The code simply says 😂, of course code speaks too. Get the bearer token from the upcoming request from the header tag, specifically look for authorization. Check if the bearer token is not of type undefined since the request will be a string encoded. Undefined means on the if statement, there is no bearer token passed with the request, incase the bearer token is empty, else, split where there's bearer token whitespace and save. This will save an array. Then get the second item, from the array. Remember arrays begin at 0 index, so we want the other long string. Example of bearer token passed including bearer token keyword:

`Authorization: Bearer <token>`

With that continues, The variable that holds the token is then inserted to the whole of the current request. Then next(); is invoked. The next method executes the next middleware in the middleware stack, which is of express not our custom middleware.

Else if we have an undefined, we handle this by serving a status 403. 403 is forbidden status for invalid access.

That's about for the header token utility.

Implementing this on your route is easy as this for express.


![Implemented header token](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/65ec1tdihe5tdn2877f4.jpg)

Just by adding ensureToken after the route name, the route is secured for authentication. 

On the next blog, I will discuss jwt login and getting the token with the login.

I hope to hear from you about this approach and if there's a better way to improve the implementation.

Thanks 🥷
Bash is a terrible as a programming language, but what's the alternative ?
Tags: discuss, shell, bash, healthydebate
Published: 2024-02-16 06:43:26

I believe in **self-compassion** so I have a personal rule

> Never write a shell script that is more than 5 lines long.

## Let's bash Bash

I am on the record to saying that there is no programming language that is never worth learning

{% embed https://dev.to/jmfayard/what-s-the-worst-programming-language-to-learn-1f51 %}

Bash is the exception. It's programming stuck in the stone age. No real functions. No argument names. No types. No data structure. No unit tests. No dependencies management. I need to google every time I want to do something basic like a for loop. 

I like it when Homebrew or Gradle or whatever allow me to bootstrap their thing with a complex shell script. Because **they** went through the pain of writing and maintaining their shell script. 

But otherwise, my advice is to give up. 

## But what's the alternative ?

If things are terrible, and they are, what are we stuck with Bash ?

First, because like with every addiction, Bash's appeal is that it's **easy to get started**. 
1. Just take whatever you have typed in the terminal and put that in a `run.sh` file. 
2. Upload that to a `gist` and you have spread the virus. 

Second because it's not clear what's a good alternative that has the same initial appeal as Bash without its many pitfalls.

That's where you come in.

## What has been your experience with scripting in `$favoriteLanguage` ?
Part :3 - My Selenium (Technical )Automation Interview Questions in one of leading MNC
Tags: automation, selenium, interview, technical
Published: 2024-02-16 06:18:54

## Explain the use of the getWindowsHandles() method.
Explanation:

The **_getWindowsHandles()_** method in Selenium is used to retrieve a set of unique identifiers (window handles) for all currently open browser windows. 

These window handles are crucial for switching between multiple browser windows during test automation.

## Use Case:

In our project, we faced a scenario where clicking a link opens a new window with additional details. To automate this, I’ve incorporated the **_getWindowsHandles_** method. 

After clicking the link, I use this method to capture the window handles, switch to the new window, perform the necessary actions, and then switch back to the main window.

## Code Snippet:

> // Store the handle of the main window
> String mainWindowHandle = driver.getWindowHandle();
> // Click a link or perform an action that opens a new window
> // Get all window handles
> Set<String> windowHandles = driver.getWindowHandles();
> // Iterate through handles and switch to the new window
> for (String windowHandle : windowHandles) {
>     if (!windowHandle.equals(mainWindowHandle)) {
>         driver.switchTo().window(windowHandle);
>         // Perform actions in the new window
>         // Close the new window (or perform other actions)
>         driver.close();
>         // Switch back to the main window
>         driver.switchTo().window(mainWindowHandle);
>     }
> }

This code snippet demonstrates the usage of **_getWindowsHandles()_** to switch between windows, perform actions in the new window, and then switch back to the main window.

## Exception:

An exception that might occur is  **_NoSuchWindowException_** if the specified window handle is not found. Proper exception handling is essential to maintain the script’s stability.

## Challenges:

One challenge was handling scenarios where pop-ups or unrelated windows were present. To address this, I implemented additional checks based on window titles or URLs to filter and switch only to the relevant windows.

Another challenge was ensuring the correct order of switching between windows, especially when dealing with dynamic content loading.

To overcome this, I incorporated explicit waits to ensure that the windows were fully loaded before interacting with them.

In your point of view any add on required means let discuss

To know more [selenium Interview questions](https://blog.testleaf.com/selenium-interview-questions/)

these [top technical automation interview questions](https://blog.testleaf.com/top-automation-interview-questions/) arepublished in testleaf blog with on behalf of them am sharing with my inputs.

Thank you
Rye: a Hassle-Free Python Experience (Rye 0.21 Demonstration)
Tags: python, beginners, programming, opensource
Published: 2024-02-16 06:15:49

Many feel frustrated by Python default project and package management solutions due to several great solutions being built. Rye is also trying to solve the same problem instead of building each and everything using great existing solutions like Ruff, etc. The best part is Rye's creator is Armin Ronacher who built other great libraries like Flask, etc.

{% embed https://www.youtube.com/watch?v=q99TYA7LnuA %}
Exclusive HVAC Sales & Service Tailored for Kerala:Albard Technologies
Tags: albardtech, hvacsales, acservices, coolcomfort
Published: 2024-02-16 06:15:40

At Albard Tech, we pride ourselves on delivering top-notch**[ HVAC products and services](https://albardtech.com/services/)** tailored to the unique needs of Kerala residents. With years of expertise in the industry, we understand the importance of maintaining optimal indoor air quality and comfort, especially in Kerala's tropical climate.

Our comprehensive range of HVAC solutions encompasses everything from state-of-the-art air conditioning units to energy-efficient heating systems and ventilation solutions. Whether you're looking to upgrade your existing HVAC setup or seeking professional maintenance and repair services, our team of experts is dedicated to providing personalized assistance every step of the way.

Experience the difference with **[Albard Tech](https://albardtech.com/)**'s HVAC products and services. Let us help you transform your living or working space into a haven of comfort and tranquility.

For price and more details please call +918296914703
For Installation & Maintenance related queries please call +918148804497
map location:https://maps.app.goo.gl/rPHXkjhx3BRQVBqx8
visit us here at:https://albardtech.com/ to learn more
Modular Website Scraper: Crawling Websites with Python
Tags: python, machinelearning, webscraping, programming
Published: 2024-02-16 06:00:37


Below you will find a link to a detailed description of my **website scraper** in Python. It has a **modular** structure, can be **quickly extended** (with **extraction, transformation and visualization functions**) and searches a website recursively. As an example, I **visualize** all internal URLs of a **website** as a **directed graph**.

**Areas of application**: Data science, machine learning, competitive analysis, data extraction and RAG applications)

[https://developers-blog.org/modular-website-scraper-crawling-websites-with-python/](https://developers-blog.org/modular-website-scraper-crawling-websites-with-python/)
Sell old phone instantly
Tags: thesmartdeal, selloldphone, instantcash, onlineselling
Published: 2024-02-16 05:59:40

In a world that's constantly upgrading its technology, your old phone doesn't have to collect dust. **[Sell Old Phone Instantly](http://thesmartdeal.in/)** with The Smart Deal - our online platform offers a seamless and hassle-free process to help you unlock cash from the comfort of your home.

**Why Choose The Smart Deal to Sell Your Old Phone Instantly?
Instant Cash Payment:**
Say goodbye to lengthy waiting times. The Smart Deal understands the value of your time. Once you submit the details of your old phone, our advanced system provides an instant cash offer. No more waiting for weeks to get paid.

Convenience at Your Fingertips:
The Smart Deal is an exclusively online platform, meaning you can sell your old phone without leaving your home. Our user-friendly website ensures a smooth navigation experience, allowing you to complete the entire process with just a few clicks.

Transparent Valuation Process:
Wondering how we determine the value of your old phone? Our transparent valuation process takes into account factors like the phone's model, condition, and market demand. Rest assured, you'll receive a fair and competitive offer for your device.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/631h87ez5vy8w4tg6fh1.jpg)

How It Works to Sell Your Old Phone Instantly:
Submit Your Phone Details:
Visit our website and provide accurate details about your old phone. Input information such as the model, condition, and any accessories you may have.

Instant Cash Offer:
Our sophisticated system quickly evaluates the information you've provided and generates an instant cash offer. This offer reflects the current market value of your device.

Free Shipping:
Once you accept the offer, we'll provide a pre-paid shipping label. Pack your old phone securely and send it to us at no cost. Our team will cover all shipping expenses.

Quick Inspection:
Upon receiving your old phone, our experts will conduct a quick inspection to ensure it aligns with the details you provided. As long as everything checks out, you get paid instantly.

Get Paid Instantly:
The Smart Deal lives up to its name. Upon successful inspection, we'll transfer the agreed-upon amount directly to your preferred payment method. It's quick, secure, and hassle-free.

The Smart Deal - Your Trusted Partner to Sell Your Old Phone Instantly:
At The Smart Deal, we prioritize customer satisfaction and trust. Our online platform is designed to simplify the process of **[selling your old phone instantly](http://thesmartdeal.in/)**, offering you a convenient and reliable solution. Join countless others who have unlocked cash instantly with The Smart Deal.

Ready to turn your old phone into instant cash? Visit our website now and experience the future of selling old phones online!

Visit us at : http://thesmartdeal.in/

To contact us via call : 9000200282

Check our Youtube channel :https://www.youtube.com/channel/UCxTYBbbZ7fYe2hMa3rFjp0w
Sorting Git branches
Tags: git
Published: 2024-02-16 05:59:16

---
title: Sorting Git branches
published: true
description: If you're tired of your git branches being alphabetically sorted, you can change that!
tags: git
canonical_url: https://blog.cassidoo.co/post/sort-git-branch/
---


Normally when you run `git branch` on a repository, you get your list of branches in alphabetical order, which can be very annoying if you have a lot of them (unless you have a very rigid naming system by ticket number or something).

You can change that now!

In your repo, if you do:

```shell
git branch --sort=-committerdate
```

This will sort all of your branches by the date of their last commit!

You can sort by:

- `authordate`
- `committerdate`
- `creatordate`
- `objectsize`
- `taggerdate`

Plus, you can also do this globally if you want to always do it by one of these, like so:

```shell
git config --global branch.sort -committerdate
```

Or, you could set an alias:

```shell
git config --global alias.brcd "branch --sort=-committerdate"
```

Now go on and git committing!
Elevating Your Home Design: The Role of a Tile Contractor
Published: 2024-02-16 05:56:52

Introduction:
In the heart of San Jose, CA, homeowners seek to elevate the aesthetics and functionality of their living spaces. One crucial aspect often overlooked yet integral to interior design is tiling. A proficient tile contractor can transform dull spaces into stunning showcases. In this blog, we delve into the importance of hiring a skilled tile contractor in San Jose, CA, and how they contribute to enhancing your home's appeal.
Expertise in Tile Selection:
A reputable tile contractor brings extensive knowledge of various tile materials, colors, patterns, and textures. They guide homeowners through the selection process, considering factors like durability, maintenance, and design preferences. Whether it's ceramic, porcelain, natural stone, or mosaic tiles, a skilled contractor ensures the perfect fit for each space, whether it's the kitchen, bathroom, or living area.
Precision Installation:
Professional tile contractors in San Jose, CA, excel in precision installation techniques. They meticulously measure, cut, and lay tiles to achieve flawless results. Proper installation not only enhances the visual appeal but also ensures longevity and durability, with tiles securely adhered to surfaces to withstand daily wear and tear.
Customized Design Solutions:
Every home is unique, and a skilled tile contractor understands the importance of personalized design solutions. They work closely with homeowners to conceptualize and execute custom tile designs that reflect individual tastes and preferences. From intricate patterns and geometric layouts to accent borders and artistic focal points, a talented contractor transforms visions into reality.
Attention to Detail:
Attention to detail sets exceptional tile contractors apart. They meticulously align tiles, grout lines, and transitions to create seamless and visually appealing surfaces. Whether it's achieving uniform grout spacing or ensuring consistent tile leveling, attention to detail is paramount in delivering impeccable results that exceed expectations.
Enhancing Property Value:
Investing in professional tile installation enhances the overall value of your property. High-quality tile work adds sophistication and elegance to interior spaces, increasing the appeal to potential buyers. Additionally, durable and well-maintained tiles contribute to the longevity and resale value of your home, making it a worthwhile investment in the long run.
Conclusion:
In San Jose, CA, the expertise of a skilled tile contractor is invaluable in transforming mundane spaces into stunning showcases of craftsmanship and design. From expert guidance in tile selection to precision installation and personalized design solutions, a proficient contractor elevates your home's aesthetic appeal and value. Whether you're renovating your kitchen, bathroom, or living areas, entrust your tiling project to a reputable contractor and witness the transformative power of quality tile work.
Certificate Create - SSL/TLS
Tags: ibbus, tls, ssl, wildcard
Published: 2024-02-16 05:55:03

**SSL** is a protocol that encrypts and secures communication happening over the internet.

TLS Stands for **Transport Layer Security**. It is just an update of SSL. It is more secure.

**Multi-domain certificates**, also called SAN (**Subject Alternative Name**) certificates, secure multiple domains (or) subdomains under a single SSL installation. 

Usually, a multi-domain certificate will include 3 domains by default, but you can add up to 250 SANs for an additional fee.

**Wildcard certificates** secure unlimited subdomains and the main domain under a single installation. If you use multiple subdomains and just one main domain, they are the best encryption option.

## Create the Certificate

Create **/certificate** directory

```
mkdir /certificate 
cd certificate
```

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

Create the certificate

```
openssl req -new -newkey rsa:2048 -x509 -sha256 -days 365 -nodes -out MyCertificate.crt -keyout MyKey.key
```

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

**newkey rsa:2048**: RSA 2048 is the default on more recent versions of OpenSSL but to be sure of the key size, you should specify it during creation.

**x509**: Create a self-signed certificate.

**sha256**: Generate the certificate request using 265-bit SHA (Secure Hash Algorithm)

**days**: Determines the length of time in days that the certificate is being issued. For a self-signed certificate, this value can be increased as necessary.

**nodes**: Create a certificate that does not require a passphrase. If this option is excluded, you will be required to enter the passphrase in the console each time the application using it is restarted.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t12kwrgfhovctxgb7zsq.png)
Do you believe you possess a good understanding of Git based on your statement?
Tags: git, github
Published: 2024-02-16 05:46:56

{% embed https://youtu.be/aolI_Rz0ZqY?si=4_BLs61_oqh73olw %}

The video emphasizes the importance of grasping the fundamental concepts of Git. From commits and branches to merges and rebases, a solid foundation is crucial. Have you internalized these basics, ensuring a robust understanding of version control?
FB88
Published: 2024-02-16 05:46:42

FB88 – Nhà cái cá cược thể thao, casino trực tuyến uy tín hàng đầu thế giới đến từ Châu Âu. FB88 chính thức hoạt động tại Việt Nam năm 2024 với thương hiệu fb88.trade, nhà cái nhanh chóng nhận được sự tín nhiệm của người chơi nhờ đa dạng thể loại cá cược game bài, xổ số, nổ hũ, ... lối chơi đơn giản, giao diện được thiết kế dễ sử dụng. Nhận ngay 500.000đ miễn phí chơi thử không cần nạp tiền ngay tại fb88 trade hôm nay!
Thông tin nhà cái: 
Hotline: 0982 999 100
Email: fb88trade@gmail.com
Website: https://fb88.trade/
Địa chỉ: 104 Đ. Phú Thọ Hòa, Phú Thọ Hoà, Tân Phú, Hồ Chí Minh
#fb88 #fb88trade #fb88casino #nhacaifb88
Next.js Vs React — Basic Differences
Tags: react, webdev, javascript, nextjs
Published: 2024-02-16 05:46:17

Next.js was introduced in 2016 as an open-source project. It’s actually a React framework that’s used to create full-stack web apps. Further, it was built on top of React. That’s why developers who already know React can learn it really quickly. One selling point of Next.js is that it gives an out-of-the-box solution for SSR. Another great thing about Next.js is that its documentation is not only comprehensive but also excellent.

On the contrary, React is an open source library. It was created by Facebook in 2013. Further, it supports functional programming and has a reactive approach. But what is React used for? Well, in social media and online video streaming platforms, React is used more often.

Now, let’s see the difference between these two: React and Next.js.

**1. Performance**
Thanks to static destinations, and SSR, not only can you speed up for work, but app performance can also be improved when you use Next.js. But React only supports client-side rendering — which isn’t enough to improve app performance.

**2. Server-side Rendering (SSR)**

SSR has many benefits including fast load times, improved performance and SEO. Next.js supports SSR. But React doesn’t allow SSR. Sure, developers can integrate SSR. But it will take a lot of their time.

**3. Community**

Being alone at home is better than being in the community ( you may or may not echo this). But in programming, the opposite is always preferred. Because you see at times you may face difficulties while programming or debugging. So, at such times, developer communities can help a lot. Good news is both React and Next.js has big and helpful community,

**4. Configuration**

In Next.js, you will find everything configurable. But, unfortunately, that’s not the case with React. The support for configuration isn’t good in React.

For your ease, I’m mentioning all these differences along with others in the image below.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pgsikcg6vx08emgb8tzs.png)
10x Your Field Sales Operation Efficiency
Tags: crm, crmsoftware, insurancecrm
Published: 2024-02-16 05:42:28


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

the best CRM for insurance companies to generate revenue through all sales channels.A useful and easy-to-use app for relationship managers, brokers, and agents for planning, tracking, executing, reporting, and analyzing leads and customers

With the ever-growing competition in the insurance industry, leveraging the right CRM solution can be a game-changer. Toolyt Insurance CRM offers a host of benefits that can help insurance companies thrive in this competitive landscape. From improving customer retention to increasing sales efficiency, Toolyt is designed to simplify the lives of insurance agents. With a proven track record of reducing customer onboarding time, [Toolyt](https://toolyt.com/) is a trusted field sales mobile CRM for sales reps.

Original Source: https://toolyt.com/blog/insurance/insurance-crm-10-key-benefits-for-sales-agents/