teleren/devto huggingface dataset:
A stage for our open-source contributors
Tags: opensource, javascript, webdev, news
Published: 2022-06-08 14:06:20

When we first showed the world [Novu](https://github.com/novuhq/novu) (an open-source notification infrastructure) we were amazed by the incredible adoption by our community members and how the project was shaped by the dozen of individual contributors from around the world. 

Over the past 6 months, more than 2,000 commits were made by more than 50 different contributors who sparked incredible ideas and helped with almost any aspect of [Novu.co](https://github.com/novuhq/novu)

In the last couple of weeks, we thought of a way for us to showcase these incredible individuals who are bringing Novu to life.

Excited to share with you the Novu Community Heroes program to highlight our contributors and showcase their work to the world. 


![Community Heroes](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dkztd09q6fkymya8awz2.png)

We created a unique page for every single contributor highlighting their:

- Latest pull request and contributions
- Their public GitHub profile bio
- Social Media Link
- Contribution Badges

**You can find the link here:**

[https://novu.co/contributors/](https://novu.co/contributors/)

We encourage every open-source library to promote its contributors in every possible way. This project was not easy to make as we needed a way to automate all our contributor's actions.

So we have created this public repository if you are curios on have it was implemented:

[https://github.com/novuhq/contributors](https://github.com/novuhq/contributors)

We have been using [Orbit.love](http://Orbit.love) and GitHub to sync our contributor's work, and grant them badged and medals once a PR was approved. 

**How to earn a Novu Contributor Badge?**

Head over to our Novu's issue page, find an issue that you might want to help with and get a PR ready (need any help? you can reach us on Discord).

**The future of Novu Contributors Project**

It's only the beginning of the project. We have an excellent roadmap of more things we want to feature, such as

1. **Discord Contributions**
2. **Github Discussions**
3. **Github Issues**
4. **Content creators**

Do you think about something specific we should add? Happy to hear it in the comments
A Number After a Double Reversal
Tags: leetcode, dsa, theabbie
Published: 2022-06-08 14:00:43

**Reversing** an integer means to reverse all its digits.

*   For example, reversing `2021` gives `1202`. Reversing `12300` gives `321` as the **leading zeros are not retained**.

Given an integer `num`, **reverse** `num` to get `reversed1`, **then reverse** `reversed1` to get `reversed2`. Return `true` _if_ `reversed2` _equals_ `num`. Otherwise return `false`.

**Example 1:**

**Input:** num = 526
**Output:** true
**Explanation:** Reverse num to get 625, then reverse 625 to get 526, which equals num.

**Example 2:**

**Input:** num = 1800
**Output:** false
**Explanation:** Reverse num to get 81, then reverse 81 to get 18, which does not equal num.

**Example 3:**

**Input:** num = 0
**Output:** true
**Explanation:** Reverse num to get 0, then reverse 0 to get 0, which equals num.

**Constraints:**

*   `0 <= num <= 106`

**SOLUTION:**

    class Solution:
        def isSameAfterReversals(self, num: int) -> bool:
            if num == 0:
                return True
            return num % 10 != 0
Create a Top Down Zombie Shooter Game with C# and WinForms in Visual Studio
Tags: csharp, tutorial, gamedev, visualstudio
Published: 2022-06-08 13:35:21

YouTube Video For the Tutorial: {% youtube TxmhaSTRav4 %}

Download the GitHub Project for [Top Down Zombie Game Tutorial](https://github.com/mooict/Top-Down-Zombie-Shooter-Game-in-Windows-Form)

I hope you find this tutorial helpful.
Score of Parentheses
Tags: leetcode, dsa, theabbie
Published: 2022-06-08 13:30:38

Given a balanced parentheses string `s`, return _the **score** of the string_.

The **score** of a balanced parentheses string is based on the following rule:

*   `"()"` has score `1`.
*   `AB` has score `A + B`, where `A` and `B` are balanced parentheses strings.
*   `(A)` has score `2 * A`, where `A` is a balanced parentheses string.

**Example 1:**

**Input:** s = "()"
**Output:** 1

**Example 2:**

**Input:** s = "(())"
**Output:** 2

**Example 3:**

**Input:** s = "()()"
**Output:** 2

**Constraints:**

*   `2 <= s.length <= 50`
*   `s` consists of only `'('` and `')'`.
*   `s` is a balanced parentheses string.

**SOLUTION:**

    class Solution:
        def scoreOfParentheses(self, s: str) -> int:
            if s == '':
                return 0.5
            score = 0
            pos = [0]
            ctr = 0
            for i, c in enumerate(s):
                if c == '(':
                    ctr += 1
                else:
                    ctr -= 1
                if ctr == 0:
                    pos.append(i + 1)
            n = len(pos)
            for i in range(n - 1):
                score += 2 * self.scoreOfParentheses(s[pos[i] + 1 : pos[i + 1] - 1])
            return int(score)
Day 11 - Array Operations
Tags: 100daysofcode, solidity, web3, blockchain
Published: 2022-06-08 13:24:00

{% embed https://github.com/Envoy-VC/30-Days-of-Solidity noreadme %}

This is Day `11` of `30` in Solidity Series
Today I Learned About Array Operations in Solidity.

## Array Operations

- Accessing Array Elements
- Length of Array
- Push
- Pop

---

## Accessing Array Elements

The elements of the array are accessed by using the index. If you want to access `n`th element then you have to access `(n - 1)`th index.

Example - 

```solidity
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.7;  
  
contract MyContract {  
  
    uint[6] arr = [10, 20, 30, 40, 50, 60];

    function getValue(uint _index) public view returns(uint _value) {
        _value = arr[_index];
    }
}
```

Output -

When we pass Index as 2 we get 
```solidity
"0": "uint256: _value 30"
```

---

## Length of Array

Length of the array is used to check the number of elements present in an array. The size of the memory array is fixed when they are declared, while in case the dynamic array is defined at runtime so for manipulation length is required.

Example -

```solidity
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.7;

contract MyContract {
    uint256[] arr_1 = [1, 5, 4, 7, 8, 9, 3, 2, 4, 7, 8, 5, 9, 7];

    function getLength() public view returns (uint256) {
        return arr_1.length;
    }
}
```

Output -
```solidity
"0": "uint256: 14"
```

---

## Push

Push is used when a new element is to be added in a dynamic array. The new element is always added at the last position of the array.

Example -

```solidity
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.7;

contract MyContract {
    uint256[] arr_1 = [1, 5, 4, 7, 8, 9, 3, 2, 4, 7, 8, 5, 9, 7];

    function pushElement(uint256 _value) public returns (uint256[] memory) {
        arr_1.push(_value);
        return arr_1;
    }
}
```

Output -

If we pass the value as 30 then output is 
```solidity
"0": "uint256[]: 1,5,4,7,8,9,3,2,4,7,8,5,9,7,30"
```

---

## Pop

Pop is used when the last element of the array is to be removed in any dynamic array.

Example -

```solidity
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.7;

contract MyContract {
    uint256[] arr_1 = [1, 5, 4, 7, 8, 9, 3, 2, 4, 7, 8, 5, 9, 7];

    function popElement() public returns (uint256[] memory) {
        arr_1.pop();
        return arr_1;
    }
}
```

Output -
```solidity
"0": "uint256[]: 1,5,4,7,8,9,3,2,4,7,8,5,9"
```

---
Convert NgModule Angular app to Standalone Component
Tags: angular, standalonecomponent, typescript
Published: 2022-06-08 13:19:06

We are going to convert the fresh Angular app that is generated with Angular cli which is using `NgModule` to Standalone Component.

The code available on my [Github](https://github.com/USSDlover/saloon/tree/sampling/devto) profile.


## Convert AppComponent to Standalone Component

To have standalone component we just need to pass `standalone` property to `@Component()` directive as with `true` value.

So the AppComponent will be looks like the following

```typescript
import {Component} from '@angular/core';
import {RouterModule} from '@angular/router';

@Component({
  selector: 'app-root',
  standalone: true,
  template: `<router-outlet></router-outlet>`,
  imports: [RouterModule],
})
export class AppComponent {}
```

#### Side note

```
As we are using `router-outlet` component to out put the routed views, we need to import `RouterModule`.

Other dependencies should be imported too.
```

## Remove AppModule

To be able to remove `AppModule` we need to move root initializations to `main.ts`.

To have cleaner way of managing routes, let's create separate file called `routes.ts` that exports first layer of route configs.

And it should be something like this

```typescript
import {Routes} from '@angular/router';

const routes: Routes = [
  {path: '', redirectTo: 'appointment', pathMatch: 'full'},
  {
    path: 'appointment',
    loadComponent: () =>
      import('./app/pages/appointment/appointment.page')
        .then(mod => mod.AppointmentPage)
  }
];

export default routes;
```

#### Side note

As you can see, here I've used `loadComponent` instead of `loadChildren` and, that's because the `AppointmentPage` is standalone component.

## Update main.ts

Earlier the `main.ts` was responsible to bootstrap the `AppModule` and that was it!

But now, that we have the standalone AppComponent, it should bootstrap the application and also initialize the root provider modules. For example when we are going to import the `RouterModule`, we actually need to call `forRoot` method with passing the route configs to it.

So, the final `main.ts` would be something like this

```typescript
import {enableProdMode, importProvidersFrom} from '@angular/core';

import { environment } from './environments/environment';
import {bootstrapApplication} from '@angular/platform-browser';
import {AppComponent} from './app/app.component';
import {RouterModule} from '@angular/router';
import routes from './routes';

if (environment.production) {
  enableProdMode();
}

bootstrapApplication(AppComponent, {
  providers: [
    importProvidersFrom(
      RouterModule.forRoot(routes)
    )
  ]
})
  .catch(err => console.error(err));
```

That's it! Now we have an Angular application which is base on Standalone Component.

Thank you for your time.

If you liked this post, I guess you would like my posts on [Linkedin](https://www.linkedin.com/in/alirazinejad).
How many projects do you handle at a time?
Published: 2022-06-08 13:15:50

_This is an anonymous post sent in by a member who does not want their name disclosed. Please be thoughtful with your responses, as these are usually tough posts to write. Email sloan@dev.to if you'd like to leave an anonymous comment or if you want to ask your own anonymous question._ 

***

How many projects do you manage/work on at a time at your workplace or as a freelancer?

I got frustrated while handling multiple projects, working full-time (as a dedicated 8 hours resource) in one project + managing 1-2 projects which took around 1-2 hours of my time as some junior developers were working on those projects so I have to guide them a lot.

I don't know if this is only me or it is really frustrating for anyone. **Is managing + working on different projects at the same time normal?**

Also, how will you handle these cases together, or will you also get frustrated?
Partition Labels
Tags: leetcode, dsa, theabbie
Published: 2022-06-08 13:00:45

You are given a string `s`. We want to partition the string into as many parts as possible so that each letter appears in at most one part.

Note that the partition is done so that after concatenating all the parts in order, the resultant string should be `s`.

Return _a list of integers representing the size of these parts_.

**Example 1:**

**Input:** s = "ababcbacadefegdehijhklij"
**Output:** \[9,7,8\]
**Explanation:**
The partition is "ababcbaca", "defegde", "hijhklij".
This is a partition so that each letter appears in at most one part.
A partition like "ababcbacadefegde", "hijhklij" is incorrect, because it splits s into less parts.

**Example 2:**

**Input:** s = "eccbbbbdec"
**Output:** \[10\]

**Constraints:**

*   `1 <= s.length <= 500`
*   `s` consists of lowercase English letters.

**SOLUTION:**

    class Solution:
        def partition(self, s, pos, k, n):
            if k >= n:
                return []
            j = float('-inf')
            for i in range(k, n):
                j = max(pos[s[i]], j)
                if j == i:
                    return [i + 1 - k] + self.partition(s, pos, i + 1, n)
        
        def partitionLabels(self, s: str, k = 0) -> List[int]:
            pos = {}
            n = len(s)
            for i, c in enumerate(s):
                pos[c] = i
            return self.partition(s, pos, 0, n)
How to Implement LinkedIn login in laravel
Tags: laravel, linkedin, social, tutorial
Published: 2022-06-08 12:55:29


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iyzf9poyk1lj1eqiyfew.png)
According to a research report, nowadays, users' session is shorter on every website. In this case, you can simplify the process of registration and login for your application. The socialite package is the best and mostly used package for social login. It is used to reduce the process. In this article, we implement a LinkedIn login to your application. Are you looking for a Google or Twitter login? you can visit our social login series for your knowledge.

##Step by step guide on LinkedIn login in the laravel application

- Install Socialite Package
Let's start with the Install Socialite package on the laravel application. In the terminal, you run the following command:
```
composer require laravel/socialite
```
You need to add the below line of code inside the config/app.php file.
```
$providers= [
	
	......
	Laravel\Socialite\SocialiteServiceProvider::class,
	......
]; 

$alias = [

	......
	'Socialite' => Laravel\Socialite\Facades\Socialite::class,
	......
];
```
[Read More](https://www.devrohit.com/linkedin-login-in-laravel/)
How to set up Rust and NEAR for Blockchain/Web3 Development
Tags: blockchain, web3, rust
Published: 2022-06-08 12:49:53

[Near](https://near.org/) protocol is a decentralized application platform that gives developer-friendly features to build and develop smart contracts. 

Near offers the platform to build smart contracts in Rust and deploy them. By default, Near supports Rust and AssemblyScript. Rust is recommended for its greater developer experience when it comes to memory allocation and a minimal runtime, among [other great reasons](https://ink.substrate.io/why-rust-for-smart-contracts/).

## Installing Rust (Ubuntu/Linux)

To install Rust, follow the steps below:

### Install Curl

If you don't have curl installed, use the scripts below:

```shell
sudo apt update
sudo apt install curl
```

### Install Rust

To install Rust, paste and run the script below on your terminal:

```shell
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

Configure your shell using:

```shell
source $HOME/.cargo/env
```

To confirm a successful installation, run the following in a terminal:

```shell
rustup
```





After that, run

```shell
sudo apt-get install build-essential
```

Add `wasm` target to your toolchain

```shell
rustup target add wasm32-unknown-unknown
```

To test out for the installation, create a simple `Hello, World!` program in rust:

On an empty folder create a file named: `main.rs` and add the following:

```rs
fn main() {
    println!("Hello, world!");
}
```

Save the file and compile the code using:

```shell
rustc main.rs
```

Run the simple program:

```shell
./main
```

If Hello, world! did print, congratulations! You have successfully installed Rust


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

## Installing `near-cli`

To install the`near-cli` simply use:

```shell
npm install -g near-cli
```

More on `near-cli` can be found [here](https://docs.near.org/docs/tools/near-cli).

## Conclusion
The post takes you through installing Rust and `near-cli` for blockchain development.

## Resources:

- [Near CLI](https://docs.near.org/docs/tools/near-cli)
- [Installing Rust](https://www.rust-lang.org/tools/install)
🏧 Mini Atm (updated)
Tags: python, webdev, beginners, programming
Published: 2022-06-08 12:47:28

**Mini atm project details**

Hey viewers, 
So i'am back with another project it's (mini atm 🏧) project with python. I made this project with simple python script. I added little feature in it.
🚩Project updated (11-jun-2022)
.
.
Enjoy my project if you like then share it also.🤩👍
.
.
I updated my project added some of the new features it it 
.
.
🖇️ Link to my project 👇
[(https://replit.com/@YuvrajSingh133/Mini-ATM?v=1)]
Deliberate software developmemt
Tags: management, leadership
Published: 2022-06-08 12:47:19

# Introduction

Discourse on _how_ to organize work has taken a lot of space: whether discussing methodologies (e.g., OKRs, Agile, Scrum), roles and responsibilities (e.g., Product Management), or organizational models (e.g., "Spotify").

While important, these topics tend to confuse startup founders and engineering leaders in more established companies alike, who struggle to figure out what is "right" for them. Countless time have I heard these questions: should we adopt OKRs? Should we move to a micro-services architecture? How should we set and communicate priorities?

# On being deliberate

Discussions on the how can sometimes overshadow the one thing they should be in support of: the purpose of work. Putting aside sprints, objectives, tickets, and roadmaps for a minute:

* We do things for a reason.
* That reason is to have observable impact on some behaviors.
* These behaviors should align with our definition of success.

Methodologies, organizational models, architecture choices are in service of the purpose. OKRs are a popular way to align teams behind a priority with well-defined success criteria at a fixed cadence. The North Star Framework is a popular way to capture the longer term strategy and provide a stable frame for goal settings. Micro-services architecture are a popular way to decouple the deployment of independent parts of the codebase. None of them can help if you are not sure which problem you're solving in the first place.

# Back to basics

The most important thing you can do to succeed as an engineering organization is to define what success means _for your particular context_ and frame activities with their purpose. Which goal setting framework, day-to-day execution methodology, and architecture you chose is ever going to be in support of that.

‍
Unknown vs Any in TypeScript
Tags: typescript, programming, beginners, tutorial
Published: 2022-06-08 12:46:59

Unknown vs Any in TypeScript with examples

{% embed https://www.youtube.com/embed/k_q-NnmwGTo %}
_See this and many other articles at [lucaspaganini.com](lucaspaganini.com)_

## Type Safety

`unknown` is the type-safe counterpart of `any`.

While `any` says: "this can be anything, do whatever you want with it"

```ts
// Using any
const value: any = 'abc';
value.trim();
```

`unknown` says: "this can be anything, check what it is before using it"

```ts
// Using unknown
const value: unknown = 'abc';
value.trim();
```

This forces the developer to use type guards to safely narrow the type before performing any operations, thus ensuring type safety.

```ts
// Using unknown
const value: unknown = 'abc';
if (typeof value === 'string') {
  value.trim();
}
```

## Conclusion

References are below.

This article is part of my TypeScript Narrowing Series, where we go from fundamentals to advanced use cases. You can read the full series for free here.

Have a great day, and I'll see you soon!

## References

1. [TypeScript Docs](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-0.html#new-unknown-top-type)
2. [`unknown` vs `any` on Stack Overflow](https://stackoverflow.com/questions/51439843/unknown-vs-any)
TypeScript infer Keyword
Tags: typescript, programming, tutorial, beginners
Published: 2022-06-08 12:46:38

TypeScript infer Keyword with examples

{% embed https://www.youtube.com/embed/TGGNWcXx9wQ %}
_See this and many other articles at [lucaspaganini.com](lucaspaganini.com)_

In this article, I'll show you how we can use the `infer` keyword to extract types from generics. Let's use `Promise` as an example.

```ts
type UnpackPromise<P> = ✨magic✨

UnpackPromise<Promise<string>> // <- string
UnpackPromise<Promise<number>> // <- number
UnpackPromise<Promise<boolean>> // <- boolean
```

If `P` is a subset of a `Promise` of `T`, we want to return `T`. Otherwise, we return `never`, which represents something that should never happen.

```ts
type UnpackPromise<P> = P extends Promise<T> ? T : never;
```

But that doesn't work, because `T` doesn't exist yet.

Let's compare that to a function, and you'll see what I mean.

```ts
const UnpackPromise = (P) =>
  P === Promise<T>
    ? T
    : never
```

`P` is an argument, but where is `T` coming from?

In a regular function, you would solve this by creating a variable called `T`. Something like this:

```ts
const UnpackPromise = (P) =>
  P === Promise<var T>
    ? T
    : never
```

And that's where the `infer` keyword comes into play. It works kinda like a type variable declaration.

```ts
type UnpackPromise<P> = P extends Promise<infer T> ? T : never;
```

If `P` is a subset of `Promise`, we tell TypeScript to infer the inner type of that `Promise` and save it in a type called `T`. Then, we return `T`.

```ts
type UnpackPromise<P> =
  P extends Promise<infer T>
    ? T
    : never

UnpackPromise<Promise<string>> // <- string
UnpackPromise<Promise<number>> // <- number
UnpackPromise<Promise<boolean>> // <- boolean
UnpackPromise<Promise<Array<Date>>> // <- Array<Date>
UnpackPromise<Promise<boolean | string>> // <- boolean | string
```

## Conclusion

References are below.

There's a lot more to the `infer` keyword, but that's what I could fit in a one-minute video. If you want to dive deeper into TypeScript, I have a series about TypeScript narrowing. You can read the full series, for free, on my blog.

Leave a like, have a great day and see you soon.

## References

1. [Inferring Within Conditional Types _TypeScript Documentation_](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#inferring-within-conditional-types)
2. [The `never` type _TypeScript Documentation_](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#the-never-type)