teleren/devto huggingface dataset:
Quick Read of All npm Commands.
Tags: javascript, webdev, programming, website
Published: 2023-10-05 21:00:36

---
title: Quick Read of All npm Commands.
published: true
description: List of npm Commands
tags: #javascript #webdev #programming
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-10-05 20:49 +0000
---

<html lang="en">
    <div class="container">
        <ul>
            <li><code>npm init</code> - Interactively creates a <code>package.json</code> file for your project.</li>
            <li><code>npm install</code> - Installs all the dependencies listed in the <code>package.json</code> file.</li>
            <li><code>npm uninstall package-name</code> - Removes a package from your project.</li>
            <li><code>npm update</code> - Updates the packages listed in your <code>package.json</code> file to their latest compatible versions.</li>
            <li><code>npm search package-name</code> - Allows you to search for packages in the npm registry.</li>
            <li><code>npm list</code> - Shows a list of installed packages and their versions.</li>
            <li><code>npm outdated</code> - Lists packages that are outdated compared to the latest available versions.</li>
            <li><code>npm run script-name</code> - Executes a script defined in the <code>scripts</code> section of your <code>package.json</code> file.</li>
            <li><code>npm publish</code> - Publishes your package to the npm registry if you're the author or maintainer of a package.</li>
            <li><code>npm login</code> - Logs you in to your npm account. Required before publishing a package.</li>
            <li><code>npm logout</code> - Logs you out of your npm account.</li>
            <li><code>npm version</code> - Increments the version number in your <code>package.json</code> file based on a specified versioning strategy.</li>
            <li><code>npm config</code> - Allows you to view and set npm configuration options.</li>
            <li><code>npm cache clean</code> - Clears the npm cache.</li>
            <li><code>npm link</code> - Creates a symbolic link between a globally installed package and a local package.</li>
            <li><code>npm root</code> - Shows the path to the global or local package installation directory.</li>
            <li><code>npm ls</code> - An alias for <code>npm list</code>.</li>
            <li><code>npm dedupe</code> - Attempts to reduce the duplication in the installed packages to save disk space.</li>
            <li><code>npm audit</code> - Checks your project for vulnerabilities in its dependencies.</li>
            <li><code>npm doctor</code> - Helps diagnose common issues with your npm configuration.</li>
        </ul>
    </div>
</html>
Create A PAT (Personal Access Token) For GitHub Repo Access
Published: 2023-10-05 20:54:54

1. Go to your GitHub account and click your icon in the upper left corner

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


2.Choose the `Settings` menu option.
3.Page will load, now select the very last item on the bottom left (< > Developer Settings)

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

4.New page will load (very odd looking really) -- we want to choose "Personal access tokens"
It is likely you'll have to expand that item to see the two items beneath it.

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

5.Now, we want to select Tokens(classic)
You'll see something like the following:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g0vg8j7ne8o1mqajby8y.png)
6.We want to generate a new token:


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

7.Let's select Generate New token (classic)

You'll probably have to type in your GitHub password at this point to prove you are really you.  

Now you'll see a huge list of items (scrolls of the page) for what you want to allow the PAT (personal access token) to be able to do.

You can add a note (to remind you what it is for), an expiration date and for the ability to update your repo code you want it to be like the following:

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

8.Scroll all the way tot he bottom of the page and click the [Generate Token] button


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

When you do that it will display the "password" one time and never again.

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

Copy that password and put it somewhere where only you can get to it.

Now, when you attempt to push changes to GitHub you will use it like the following:
```
$ git push
Username for ''https://github.com': <type your username> 
Password for 'https://yourUserName@github.com': <type the password from above here>
```
That's how its really done.  

**NOTE** : Yes, I deleted the PAT from my account so that password will no longer work. 🤓
Custom Achievements on GitHub: Introducing My-Badges
Tags: github, funny, showdev
Published: 2023-10-05 20:40:39

---
title: Custom Achievements on GitHub: Introducing My-Badges
published: true
description: Custom Achievements on GitHub: Introducing My-Badges
tags: GitHub, funny
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/807o4ksorz9vu0bgp1ny.png
---

Hello, fellow devs!

Have you ever scrolled through your GitHub profile, feeling a rush of pride with every green square and repository star, yet still thinking, "I wish there were more badges!" or "Why isn't there a badge for this particular milestone I've achieved?" Well, you're not alone.

While GitHub does offer a selection of achievements, the options are somewhat limited, and customization is virtually non-existent. And let's be honest, we all love a little bit of personalization in our digital lives.

**Enter My-Badges!** 🌟

### What's My-Badges?
[My-Badges](https://github.com/my-badges/my-badges) is our brainchild, designed to give you the power to create and flaunt your own achievements on GitHub. Think of it as a customizable sticker book, where everyone gets to define their milestones and showcase them.

### How Does It Work?
With the magic of GitHub Actions, My-Badges automates the updating of your achievements. Every new badge or accomplishment you achieve or add gets automatically reflected. It's a seamless integration, making your profile richer and more expressive.

### Let Your Imagination Run Wild
Dreaming of an "Early Bird Coder" badge for those who commit before 6 AM? Or how about a "Midnight Maven" for those of us burning the midnight oil? With My-Badges, your creativity is the limit.

### Join the My-Badges Movement
We're on a mission to make GitHub profiles as vibrant and diverse as the developers behind them. To make this dream a reality, we're extending an open invitation to all of you.

**Help us expand the My-Badges universe.** We are eager to accept almost every idea that comes our way. Contribute by suggesting new badges, designing them, or even spreading the word.

Together, we can make our GitHub profiles a true reflection of our unique coding journeys.

---

Ready to make your mark? Head over to [My-Badges](https://github.com/my-badges/my-badges) and let's start crafting those achievements! 🚀

Happy coding and badge collecting! 💼🎖️
Low code is undoubtedly the future of innovating faster and better software.
Tags: future, softwaredevelopment, lowcode, development
Published: 2023-10-05 20:36:02

If you're into tech or software development, you might have heard of the term Low-Code, for some, you might have a not-so-good opinion of it, and I understand where you’re coming from, just bear with me on this one.



So what is this thing called Low-Code: Well its a software development technique that enables IT developers to build applications with minimal coding. 

it's able to understand both developers and product owners by allowing non-technical users {business/designers} and developers to apply their skill sets, collaborate, and co-develop solutions.



Though some developers see it as a short-term solution to building long-lasting software, there are Low-Code Platforms that have proven to offer long-lasting solutions with some having full code generation.



Gartner predicts that most enterprises will adopt Low-Code solutions in software development. As of 2023, the market revenue is at $26.9 billion from $7.8 billion in 2018. 



To conclude: Whether developers like it or not, we don't really have a better solution at the moment, in a world where ideas and innovation are at their highest, the demand for building fast reliable software is needed now more than ever, we need to adapt and adapt really fast from the traditional ways of scaffolding every project from scratch.
Follow me on medium ❤️
Tags: beginners, discuss, writing
Published: 2023-10-05 20:02:06

Hello 👋🏼

I started writing articles on dev.to, and I'm currently trying to do some on Medium as well whenever I'm passionate about a topic or want to share something with you.

When I write an article, I'll publish it here and on Medium! So if you have a Medium account and want to follow me, you can do so here: https://medium.com/@tykok.

See you soon 👋🏼

![See you soon](https://media3.giphy.com/media/l1J3CbFgn5o7DGRuE/giphy.gif?cid=ecf05e47pfphpyl53x6smwa0rcxla0klmc2np2w8zuohloj6&ep=v1_gifs_search&rid=giphy.gif&ct=g)
Como desfazer o último commit de um repositório git remoto?
Tags: git, github
Published: 2023-10-05 19:47:26

Para desfazer o último commit de um repositório git remoto(Github, gitbucket, gitlab,...), você pode usar o comando `git reset`, veremos o processo a seguir.

_**ESTE PROESSO ABAIXO REMOVE DO REPOSITÓRIO REMOTO A ÚLTIMA  MODIFICAÇÃO. SIGA AS ETAPAS ABAIXO CASO SEJA ESTA A SUA NECESSIDADE.**_

---

1. Verifique primeiro se você está na branch correta e que não tenha nenhuma modificação pendente para commitar.

2. Rode no terminal o seguinte comando para desfazer o último commit localmente:

```
git reset HEAD^
```

3. Forçe o push do commit local que foi revertido para o repositório git remoto a partir do comando:

```
git push origin +HEAD
```

🤯 🤩 😍

Pronto! Acessando seu repositório remoto você já perceberá que o mesmo perdeu o último commit enviado.

Voltando ao seu projeto pelo VS Code você perceberá que o mesmo indicará alguns arquivos para commitar, mas estes na verdade são os arquivos desfeitos pelos comandos acima. 

Caso não deseje ficar com nada desses arquivos, utilize o comando `git restore .` para limpar todos os arquivos ou `git restore index.tsx` para limpar um arquivo específico (nesse último caso será desfeito as alterações em index.tsx).

Espero que este mini tutorial tenha alguma utilidade para você, assim como teve para mim 😁.
Algorithms
Tags: arrays, ruby, algorithms, leetcode
Published: 2023-10-05 19:33:05

As I am working through LeetCode to make sure I am improving my algorithm skills I figured, why not bring y'all along?! 

Each problem I present I worked on for 30 minutes and then researched the rest of the way to find better or more efficient or just plain old correct solutions. The purpose is to replicate the interview process and refine my problem solving skills.

The Problem:

```
Given an integer array nums sorted in non-decreasing order,
remove the duplicates in-place such that each unique element
appears only once. The relative order of the elements should
be kept the same. Then return the number of unique elements in
nums.

Consider the number of unique elements of nums to be k, to get
accepted, you need to do the following things:

Change the array nums such that the first k elements of nums
contain the unique elements in the order they were present in
nums initially. The remaining elements of nums are not
important as well as the size of nums.
Return k.
```

Constraints:
- 1 <= nums.length <= 3 * 104
- -100 <= nums[i] <= 100
- nums is sorted in non-decreasing order.

----

Now when I first looked at this problem I thought 'No problem! I have the perfect solution'

```
def remove_duplicates(nums)
  return 0 if nums.empty?
    
  nums.uniq!.length
end
```

This would have been perfect except for the fact that it wasn't. Because it didn't pass all the tests behind the method. As a new dev you might be familiar with the death spiral of trying to figure out why my 'flawless' logic wasn't working. Instead of just trying to find an alternative solution. Unfortunately, I ran out of time BUT I did learn a lot about how I should have approached this problem.

### PSUEDO CODE THE PROBLEM!
The reason being that I was trying to problem solve and code at the same time. While I think I know how to code decently well. I should have broken down the problem in english because there were so many clues in the problem that I just missed because I 'thought I knew what it was asking'.

In the end that was a huge time waster and just proved to be a inefficient way of solving the problem.

### What was the Solution?

```
def remove_duplicates(nums)
  return 0 if nums.empty?
    
  k = 1
  i = 1

  while i < nums.length
    if nums[i] != nums[k - 1]
      nums[k] = nums[i]
      k += 1
    end
    i += 1
  end
  k
end
```

** INPUT NOTES **

Above was the solution I used and below is the reasons why this works.

Outside of the while loop I have two variables instantiated. the k variable is the count of unique values and i is what value we are in the length of the array.

I chose a while loop because comparing the i (array length count) to the length of the nums array (method argument). I will go into more detail about why I chose the while loop versus the .each enumerator a little be later
How To Center An Elements With CSS Grid
Tags: html, css, grid, beginners
Published: 2023-10-05 19:32:52

Hello Everyone I am Valeri and I am beginner web Developer, Please Help Me )))) 

Which Grid Property must I write, that the Element which is on the underline to place in the middle not on the left side?

See the HTML/CSS code and the Screenshot.

` <div class="description-content">
                    <div class="content">
                        <h3>10</h3>
                        <p>Training courses in various areas of robotics</p>
                    </div>
                    <div class="content">
                        <h3>20</h3>
                        <p>Schools that have launched robotics</p>
                    </div>
                    <div class="content">
                        <h3>100</h3>
                        <p>Teachers who have completed advanced training courses</p>
                    </div>
                    <div class="content">
                        <h3>10 000</h3>
                        <p>Trained children at our own centers</p>
                    </div>
                </div>`

`.description-content {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    display: grid;
    margin-top: 40px;
    margin-bottom: 40px;
    text-align: center;
}`
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2h0s0xiljtpni53y15f2.png)
How to add next-auth to already implemented iron-session based authentication?
Tags: nextjs, typescript, nextauth
Published: 2023-10-05 19:16:19

---
title: How to add next-auth to already implemented iron-session based authentication?
published: true
description: 
tags: nextjs, next, typescript, nextauth 
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2utvhntko1ekqvph9mcw.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-09-17 09:08 +0000
---

Let's assume that our current solution uses `iron-session` JWT tokens like follows:

```typescript
MyApp.getInitialProps = async function (appContext: AppContext) {
  const { req, res } = appContext.ctx;
  const DEFAULT_PROPS = {
    pageProps: {},
  };

  try {
    const session = await getIronSession(req!, res!, sessionOptions);
    if (session.user) {
      return {
        ...DEFAULT_PROPS,
        pageProps: {
          user: session.user,
        },
      };
    }

    return DEFAULT_PROPS;
  }
  catch {
    return DEFAULT_PROPS;
  }
}
```

The main objective is to be **backward compatible**. We want to preserve current sessions and easily allow OAuth even for users didn't used any provider during registration.  

Important part of following solutions:
* expose Request / Response object to NextAuth
* using decorator `withIronSessionApiRoute` we can decypher current JWT data or create the new token
* we need to use the same JWT config object too (obviously) - `sessionOptions`

Final solution, `[...nextauth].ts`:

```typescript
import { withIronSessionApiRoute } from "iron-session/next";
import { NextApiRequest, NextApiResponse } from "next";
import NextAuth, { AuthOptions } from "next-auth";

export default withIronSessionApiRoute((req: NextApiRequest, res: NextApiResponse) => {

  return NextAuth(req, res, {
    providers: [
      GoogleProvider({
        clientId: ENV_MAP.OAUTH_GOOGLE_CLIENT_ID,
        clientSecret: ENV_MAP.OAUTH_GOOGLE_SECRET,
      })
    ],
    ...
    callbacks: {
      async signIn({ account, profile }) {
        if (account?.provider === "google") {
          const user = await UserDAO.getByEmail(profile?.email || "");

          ...

          const userSerialized = serializeUser(user);
          req.session.user = userSerialized;
          req.session.save()
          return true;
        };

        return false;
      },

    }
  } as AuthOptions)}, sessionOptions);
```
Does Qatar Airways allow 2 bags?
Tags: qatarairways
Published: 2023-10-05 19:07:10

Qatar Airways guarantees a sufficient baggage allowance based on ticket type when you book **[Qatar Airways cheap flights](https://www.qatarairwaysflight.co.uk/)**. Though your flight path affects your baggage allowance, you can bring enough.

Qatar Airways' baggage allowance policy is explained here.

**Baggage allowance with Qatar Airways**

Qatar Airways allows two categories of baggage. 

**1. Carry-on baggage**

Airline carry-on baggage is stored on top or below your seat. Also known as ‘hand luggage’. Varying travel classes have varying hand luggage allowances;

• First-class.
• First-class travellers can carry two 15-kg (33lb) baggage. 
• Business.
• Business class travellers receive the same hand luggage allowance as first-class travellers: 2 15-kg bags.
• Class economy.
• Only one 7 kilogramme (15lb) bag is allowed in economy class as hand baggage.

**2. Checked-in baggage**
Airlines accept checked-in baggage. Passengers can only access it before or after departure from the aircraft's storage compartment.

Qatar Airways' checked luggage policy depends on your flight itinerary and travel class.

**First class**
• Flights to Africa or America; two 32kg (70lb) baggage.
• One 50kg (110lb) bag for flights to other routes worldwide.

**Business class**
Three types of business class seats have different baggage allowances.

• Flights to Africa or America;
o Business classic seat; two 32kg (70lb) baggage.
o Two 32kg (70lb) bags and a business comfort seat.
o Business Elite seat; two 32kg (70lb) baggage.

• Flights to other global routes;
o Business classic seat; one 40kg (88lb) bag allowed.
o Business Comfort seat; one 40kg (88lb) bag allowed.
o Business Elite seat; one 40kg (88lb) bag allowed.

**Economy class**
Economy class includes three seat categories.

• Flights to Africa or America;
o Economy classic seat: two 23kg (50lb) baggage max.
o Economy Convenience seat; two 23kg (50lb) bags max.
o Comfortable economy seat; two 23kg (50lb) bags max.

• Flights to other global routes;
o Single 25-kg bag in economy classic seat.
o Economy convenience seat; one 30-kg bag.
o One 35-kg bag allowed in economy comfort seat.

Qatar Airways allows 2 checked bags at most ticket prices. First/business class travellers can carry two handbags, unlike economy class passengers.
Corporate Diwali gifts for Clients
Published: 2023-10-05 19:00:44

Impress your valued clients this Diwali with our exquisite gift hamper. This beautifully curated selection includes a set of premium scented candles, a box of artisanal chocolates, and a personalized Diwali greeting card. The candles will add warmth and ambiance to their homes, while the chocolates will delight their taste buds. This thoughtful **[Corporate Diwali gifts for Clients](https://chitrkala.in/diwali-gifts/)** is a perfect way to express gratitude and strengthen your business relationships during the festive season.
generate-sitemap 1.9.2 Released
Tags: github, webdev, showdev, python
Published: 2023-10-05 18:49:09

## TL;DR

I just released [generate-sitemap](https://github.com/cicirello/generate-sitemap) 1.9.2, a [GitHub Action for generating XML sitemaps for static websites](https://dev.to/cicirello/generate-an-xml-sitemap-for-a-static-website-in-github-actions-20do). The generate-sitemap GitHub Action is implemented in Python, and generates an XML sitemap by crawling the GitHub repository containing the html of the site, using commit dates to generate `<lastmod>` tags in the sitemap.

This release, generate-sitemap 1.9.2, is primarily a fix for a minor bug in the regular expression used to detect whether a page has a meta robots noindex directive in the page head, and should thus be excluded from the sitemap. Presence of bug revealed by warning message generated by Python 3.12 about the regular expression in question that Python 3.11 and earlier does not warn about.


## Changelog 1.9.2 - 2023-10-05

### Fixed
* Fix minor bug in regex used to detect if a page has a meta robots noindex directive in head.

### CI/CD
* Bump Python to 3.12 in CI/CD workflows when running unit tests.

### Dependencies
* Bump [cicirello/pyaction](https://github.com/cicirello/pyaction) from 4.14.1 to 4.25.0, including upgrading Python within the Docker container to 3.12.


## More Information

Please consider starring generate-sitemap's GitHub repository:

{% github cicirello/generate-sitemap %}

For more information, see my earlier post about generate-sitemap here on DEV, as well as its webpage.

{% link https://dev.to/cicirello/generate-an-xml-sitemap-for-a-static-website-in-github-actions-20do %}

{% embed https://actions.cicirello.org/generate-sitemap/ %}


## Where You Can Find Me

Follow me [here on DEV](https://dev.to/cicirello) and on [GitHub](https://github.com/cicirello):

{% user cicirello %}

Or visit my website:

{% embed https://www.cicirello.org/ %}
array_agg, string_agg
Tags: uyumsoft
Published: 2023-10-05 18:34:46

```
select 
us.usr_id,
array_agg(gr.grp_name order by gr.grp_name)
from appd_groupuser us 
join appd_group     gr on us.grp_id = gr.grp_id
group by us.usr_id
```

```
select 
us.usr_id,
string_agg(gr.grp_name, ', ' order by gr.grp_name)
from appd_groupuser us 
join appd_group     gr on us.grp_id = gr.grp_id
group by us.usr_id

```