teleren/devto huggingface dataset:
[Desafio] - Autorização de Compra com Validação Anti-Duplicidade
Published: 2022-12-20 22:14:15

> Conteúdo original em https://twitter.com/zanfranceschi/status/1605325189075865600

---

Ei dev,

Desafio rápido: faça uma função na linguagem que preferir pra autorização de compras e que não permita duplicidade de autorizações.

Isso é uma forma de idempotência – dá uma procurada nesse termo se não souber o que é.

cc @sseraphini

![Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kv5w5qja3yd511cz2a91.png)
Type checking in Go – alternative approach
Tags: go, functional, programming
Published: 2022-12-20 22:28:15

Instead of `reflect.Valueof(<variable>).Kind()` we can think about implementing this _switch wrapper :

> NOTE: I cannot ensure which is better, but thumb of rule is baked-in features should be faster, more efficient ? – Remains a question . Still as alternative approach consider the following :

{% embed https://replit.com/@projektorius96/controlflow#typecheck.go %}
Git/GitHub Commands
Tags: github, git, beginners, codenewbie
Published: 2022-12-20 22:18:38


Git is a version control system that allows developers to track and manage changes to their codebase. GitHub is a platform that provides hosting for Git repositories, as well as tools for collaboration and version control. In this blog post, we'll explore some common Git/GitHub commands that you may find useful when working with Git and GitHub.

`git init`: This command initializes a new Git repository in the current directory.

`git clone`: This command creates a local copy of a remote repository. For example, git clone https://github.com/user/repo.git will create a local copy of the repository located at https://github.com/user/repo.git.

`git add`: This command adds a file to the staging area. For example, git add file.txt will add file.txt to the staging area.

`git commit`: This command saves changes to the local repository. For example, git commit -m "Added new feature" will commit all staged changes with the message "Added new feature".

`git push`: This command pushes local commits to a remote repository. For example, git push origin master will push all local commits to the master branch of the origin remote.

`git pull`: This command fetches and merges changes from a remote repository. For example, git pull origin master will fetch and merge changes from the master branch of the origin remote.

`git branch`: This command allows you to create, list, or delete branches. For example, git branch new-feature will create a new branch called new-feature, git branch will list all branches, and git branch -d new-feature will delete the new-feature branch.

`git merge`: This command merges one branch into another. For example, git merge new-feature will merge the new-feature branch into the current branch.

These are just a few of the many Git/GitHub commands that are available. With these commands, you should be able to get started working with Git and GitHub to track and manage changes to your codebase. :)
Typescript WTF Moments 9: Evolving Empty Array Type
Tags: programming, javascript, webdev, typescript
Published: 2022-12-20 21:59:02

---
series: Typescript WTF Moments 
---

```ts
const a = false || []
//    ^?
const b = []
//    ^?
function c() {
//       ^?
  return []
}
const d = c()
//    ^?
```

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

[playground](https://www.typescriptlang.org/play?ts=4.7.4#code/MYewdgzgLgBAhjAvDAZnANhApjAPrmAbQF0AoAenJmpgD0B+U0SWAIySLMprsZQFcwwKAEtwMYAAoAlDADeFKj2oNS1AE5Yo-dWE6kAvk3DQYAEw5TpingyA)

More interactions:

```ts
let b = false || []
//  ^?
const a:number[] =  b
const c:string[] =  b

b = a // error as expected
b = c // expect as expected


let b1 = []
//  ^?
const a1:number[] =  b1 // did not expect error but error
const c1:string[] =  b1 // did not expect error but error

b1 = a1 
b1 = c1 

// with type annotation
let b2:any[] = []
//  ^?
const a2:number[] =  b2 
const c2:string[] =  b2 

b2 = a2 
b2 = c2 
```
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7go7gt5udsq8zkgj9gje.png)
[playground](https://www.typescriptlang.org/play?ts=4.7.4#code/DYUwLgBARhC8EDMCGwDOIIB9MQNoF0AoAemIggD0B+QgYwHsA7VSJALkYFcBbKEAJwJxyUOkxYRabFvwCWjAOZD40QoRjwkEUhAH96-CElS6AHgAcQtMCAAm64bW1kQFq6xOvL1u2sKhIKABGYQISMkoaBmZWII4ePkF8YWgQnVtZWwhGekgvd11+fUMoTjyigzEYyTiZeSVklWDnCAysnLy3a0Li6DKeyvUQzRChx1HwiAB3WTAACwgwAE9LI0YOpDBZJn9waAAmNiRGJeU8Ih1IqokkQ65eATODiGvIWkO6xSeofZf1X80v3+jiBQA)
The behavior of inferred any[] is very interesting, the declaration and assignment both error when we attempt to assign it

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


Turn out the inferred `any[]` type if not really an `any[]` type, it is an **evolving type**


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



[playground](https://www.typescriptlang.org/play?#code/PTAEHcEsBcAsHsCu1QCICmA3eAbZl4A7VAKB3RQCNQBeUAbQF0SRRQA9AfhJIGMiAzigCGALkKIAtpXQAnJrVCUerKHDRZc+IqXJUAjIqYswHbiUr6AdAAdEA2AAp9ASlCtNOTOgAmAGiVDSAFQQnhwUKkZeWY+QRF9cSi5BTpLHktbeydUYUpeVDcPbC9fUGEAc2FIQgDLUGDQ8NBHCWk5AB8hWRqKl2M4wiFygCYk9pjFdP4hkQBmUVbk2S7oHsI+1MCgA)
Initializing a Git Repository
Tags: github, beginners, programming, webdev
Published: 2022-12-20 21:57:08

Git is a version control system that allows developers to track changes to files and collaborate with others on software projects. In this post, we'll go over some common Git commands and how to use them.

Initializing a Git Repository
Before you can use Git to track changes to your project, you'll need to initialize a new repository. To do this, use the git init command in the terminal while inside the root directory of your project:


### $ git init
This will create a new .git directory in your project, which will be used to store information about your repository.

Cloning a Git Repository
If you want to work on an existing Git repository, you can clone it to your local machine using the git clone command. This will create a local copy of the repository, including all of its history and branches.

To clone a repository, you'll need to have the URL of the repository. You can find this by navigating to the repository on a hosting service like GitHub and copying the URL from the address bar.

To clone the repository, use the git clone command followed by the repository URL:


### $ git clone https://github.com/user/repo.git
This will create a new directory with the same name as the repository, and clone the repository into it.

Adding and Committing Changes
Once you have a Git repository set up, you can start making changes to your project and tracking those changes with Git.

To add a file to the staging area, use the git add command followed by the file name:

### $ git add index.html
This will add the index.html file to the staging area, which is a holding place for changes that you want to commit. You can also use the git add . command to add all modified files in the current directory and its subdirectories to the staging area.

Once you've added the changes you want to commit to the staging area, use the git commit command to commit the changes. You'll need to include a commit message to describe the changes you're making:

### $ git commit -m "Updated the homepage layout"
This will create a new commit in your repository with the changes you added to the staging area.

Viewing Differences
To view the differences between two versions of a file, you can use the git diff command. This command shows you the changes that have been made to a file since the last commit.

For example, to see the differences between the current version of a file and the version in the last commit, use the git diff command followed by the file name:


### $ git diff index.html
You can also use the git diff HEAD command to see the differences between the current version of a file and the version in the last commit for all modified files in the repository.

Working with Branches
Git allows you to create branches, which are separate copies of your repository that you can work on independently. This is useful when you want to make changes to your project without affecting the main development branch.

To view the branches in your repository, use the git branch command:

### $ git branch
This will list all of the branches in your repository.
I’ve switched from NVM to Volta. This is Why
Tags: nvm, volta, javascript, node
Published: 2022-12-20 21:33:40

I've been using nvm for quite a long time to manage the different Node versions on my machine. nvm immediately remains me of the time when I was using RVM (Ruby Version Manager).

Apart from a great name and massive usage, **nvm** has some issues that can be easily fixed with a “more modern” alternative.

I’ve recently started using **Volta** and it does have many advantages in comparison with nvm.

![volta pin node v14](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7x4y9mm1ub9rarh5w2xd.jpeg)

First of all, it’s really fast (Volta claims to be ~40x faster than NVM). Switching to different versions or installing new Node/NPM versions has been a real pleasure. The startup time and project version switching are considerably fast.

Second, it always loads the correct Node version you need between your projects, whereas nvm doesn’t do it by default. With nvm, each time you switch to a different project that runs a different Node version than the default one, you need to either run `nvm use <NODE_VERSION_NUMBER>` or by locking a node version in a `.nvmrc` for each of your projects. Furthermore, you will still need to have a loaded script setup in your bash profile terminal that automatically searches for a `.nvmrc` and updates the node version when needed. In addition, there is always a delay when switching to another version with nvm (Volta switches the Node version instantly).

Volta (and a few others such as `pnpm`) does this under the hood. That way, when you are dealing with multiple repositories using different node versions, you won’t have any bad surprises of updating some dependencies with the wrong node version for instance.

For instance, `volta pin node@14` will store your pinned version in your `package.json` of your project.

```json
  "volta": {
    "node": "14.21.2"
 }
```

Each time you go to one of your projects, Volta will read your `package.json` file and automatically and instantly set the relevant NodeJS version that reflects with what was pinned. You can also (and very easily) install a specific Node version with the following through Volta `volta install node@16`.


Volta also allows you to install and pin globally your favorite package manager. e.g. `volta install yarn && volta pin yarn@3` for Yarn berry v3.

```json
package.json
...
  "volta": {
    "node": "18.17.1",
    "yarn": "3.6.1"
  }
...
```

It's also good to mention that Volta supports the same `.nvmrc` config file as nvm.


### Global libraries 

With Volta, the packages installed globally on your machine are associated with the correct Node version that installed them, so we are sure we use the stable packages that work on the current running Node version.


### Windows support

Finally, although you might not need this, it’s nice to mention that Volta is also available on Windows, whereas nvm is only available on Mac/Linux machines.
%70, Feels Like I am Getting There
Published: 2022-12-20 21:12:46

Yesterday I began with the German lessons, I still haven't heard from PortalGrup although it will be exactly 2 weeks tomorrow, after the delivery of my project.

German lessons are given by Teleperformance Company, and they will last 2 months, then I'll be working in a project of theirs.

Before the end of this course period, I will have finished this Udemy Course, and I will have already started John Smilga's React course. Hopefully after starting with the React course it will take at most 1 or 2 months for me to get hired, it would actually be wonderful, if this were the case...

Nevertheless, at the end of this road, I will have impressive language skills (German, Spanish, English, Turkish), although they don't mean much in case of a programmer; as a human being, I will be very proud of myself and I'll do my best to stick to them so they won't rust and fade away...
How to use effects & transition with Tailwindcss
Tags: webdev, javascript, beginners, css
Published: 2022-12-20 21:07:36

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

Tailwind CSS is a utility-first CSS framework that provides a set of pre-designed classes that you can use to style your HTML elements. These classes are designed to be composable, meaning you can use multiple classes on the same element to achieve the desired effect.

One of the features of Tailwind CSS is the ability to apply transitions and effects to elements. In this tutorial, we will go over how to use transitions and effects in Tailwind CSS.

To apply a transition to an element, you can use the transition utility class. This class takes one or more arguments that specify the transition properties. For example, to apply a transition effect to the opacity property of an element, you can use the following class:

```
.transition-opacity
```
You can also specify the duration and timing function of the transition using the duration and timing utilities, respectively. For example:
```
.transition-opacity-250 .duration-250 .timing-ease-in-out
```
This will apply a transition effect to the opacity property of the element, with a duration of 250 milliseconds and an easing function of ease-in-out.

You can also use the transform utility to apply a transformation to an element, such as scaling, rotating, or translating it. For example:
```
.transform .scale-50 .rotate-45
```
This will apply a scale transformation of 50% and a rotate transformation of 45 degrees to the element.

In addition to transitions and transformations, Tailwind CSS also provides a number of utility classes for applying different types of effects, such as shadows, gradients, and overlays. For example, you can use the shadow utility to apply a drop shadow to an element:
```
.shadow-md
```
You can also use the gradient utility to apply a gradient background to an element:
```
.bg-gradient-to-r-pink-purple
```
And you can use the overlay utility to apply an overlay to an element:
```
.overlay-blue-500
```
With these utility classes, you can easily apply transitions, transformations, and effects to your HTML elements using Tailwind CSS.

Guillaume Duhan
Difference between Entity and DTO
Tags: beginners, programming, productivity, java
Published: 2022-12-20 21:04:46

This post seeks to present entity and DTO in a low complexity aiming at the beginner developer.

Entities are classes that have a relation intrinsic to the business, for example, a class that maps a table of databases so has Id and other fields.

``` java
{
private Long id;
private String firstName;
private String lastName;
private String email
}

```

Value Object or Data Transfer Object are classes that aim to map fields from an entity, add functions or remove fields. This basically consists of transitioning fields within the project.

``` java
{
private String firstName;
private String lastName;
private String email
}

```


The Dto it have some characteristics, like the principle of immutable, and also serve like filter to fields received in a request body for example a field of email that can do a regex before of we pass this field to an entity.


**The relationship between entity and DTO may be as follows.**

![Diagram containing the entity flow, DTO and Response](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5qcyu32k3eyjafyj7jk3.jpg)

This mode aims to be able to abstract certain fields for those who will receive the information.

Example:

Above we have the FirstName and LastName fields inside the entity, we can return a field called FullName that concatena this fields and returns a single field, soon we would have something like.

``` java
{
private String fullName;
private String email;
}
```

Now we have the opposite that it will be external information for the entity.


![Diagram containing the request flow, DTO and Entity](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v686mldewlp5173v38aw.jpg)

With the information we are receiving as a Request Body we can make validations such as to check the email standard will be accepted or the amount of characteristics. This enables the maintenance of the integrity of the data that will be transacted within the application, protecting the core of the application.
LEARN: Authentication App with Next.js & Microsoft Graph
Tags: javascript, nextjs, webdev, microsoftgraph
Published: 2022-12-20 20:55:16

---
title: LEARN: Authentication App with Next.js & Microsoft Graph
published: true
description: an article to show a workshop how you can learn to create an authentication app using Next.js & Microsoft Graph
tags: #javascript #nextjs #webdev #microsoftgraph
canonical_url: https://microsoft.github.io/MicrosoftCloud/tutorials/docs/Authentication-App-With-NextJs-And-Microsoft-Graph/
series: LEARN - JavaScript Applications with Microsoft Graph
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2022-12-20 20:44 +0000
---

[![authentication-e0989c8f889eb42a20e5ff799ec906e9.gif](https://i.postimg.cc/fbZprWGF/authentication-e0989c8f889eb42a20e5ff799ec906e9.gif)](https://postimg.cc/zytxLNXS)

Hi, Coders! 

I would like to share an amazing workshop with you today! Learn how to create an authentication app with Next.js & Microsoft Graph. In this workshop, you will learn how to build a simple authentication app using:

✅ Next.js 
✅ TypeScript 
✅ Microsoft Graph. 

The app will allow users to sign in with their Microsoft account and view their profile information.

Do you want to learn right now? Access the workshop below!! 

👉 **[AUTHENTICATION APP WORKSHOP HERE](https://microsoft.github.io/MicrosoftCloud/tutorials/docs/Authentication-App-With-NextJs-And-Microsoft-Graph/)**

And happy coding!! 🚀🚀🚀
Template Notion: Plano de Desenvolvimento Individual
Tags: braziliandevs, career
Published: 2022-12-20 20:48:10

Como boa amante de organização, eu adoro desenvolver templates no [Notion](https://www.notion.so) (se eu uso eles já é outra história 😅). 

Um dos desafios recorrentes de trabalhar na área de tecnologia é **manter os estudos em dia**, então nada mais justo do que usar meus dons de Notion para nos ajudar nessa tarefa, né?

Bora lá ver um pouquinho sobre esse template:

---

### O que é PDI?

O PDI ou **Plano de Desenvolvimento Individual** é utilizado em muitas empresas, mas nada nos impede de trazer isso para nossa vida também.

Ele nada mais é que um plano de ação para se desenvolver pessoal e profissionalmente, dentro de um determinado período de prazo.

Seu PDI pode ser feito em vários formatos, mas eu curto muito o OKR.

---

### O que é OKR?

Em inglês, Objectives and Key Results (**Objetivos e Resultados-chave**) é uma metodologia que consiste em dividir um grande objetivo em pequenas metas, também chamadas de "resultados-chave" (KR).

É importante que a criação desses objetivos e metas seja possível e que seja capaz de ser controlado. E como podemos controlar ele? Através do tempo!

Para ajudar a criar melhores objetivos e KRs, eu uso da metodologia SMART.

---

### O que é SMART?
![Imagem contendo os 5 pontos do SMART, que são descritos abaixo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bawwj85prs1z63pbrymh.png)
> _Fonte da imagem: [MicroPower](https://micropowerglobal.com/objetivos-smart/)_

SMART é um acrônimo para: Specific (**Específico**), Measurable (**Mensurável**), Achievable (**Alcançável**), Relevant (**Relevante**) e Time based (**Temporal**).

Para um bom objetivo, ele precisa:
- ser claro, para que não aja dúvidas;
- ser capaz de ser medido, para que haja **controle** do seu progresso;
- ser possível, para que você não desanime;
- ser realmente importante para você;
- ter tempo para começo, meio e fim.

---

### Features do template

✅ Design bonito e agradável.
✅ Descrição sobre OKR caso você esqueça.
✅ **Método SMART** sempre na mão para você criar bons objetivos.
✅ Ideias de objetivos e KRs para te inspirar.
✅ Tabela de priorização usando a fórmula do [G.U.T](https://www.siteware.com.br/metodologias/matriz-gut/) para você saber o que é mais importante agora.
✅ **Motivação** e **recompensa** do objetivo em destaque, para você não desanimar.
✅ Um botão para criar mais objetivos de forma rápida.

--- 

Esse é o [link do template](https://bibibot.notion.site/PDI-plano-de-desenvolvimento-individual-4aa4d0c5f4404d7c82ee547331cd757f) no Notion.

Espero que gostem e se usarem, me avisem aqui nos comentários, no [Twitter](https://twitter.com/BiaSailorGeek), ou [me mande um ☕️](https://ko-fi.com/biasailorgeek) que eu quero saber o que acharam! 💕
Como fazer download de um APK.
Published: 2022-12-20 20:47:51

Um dos problemas constantes para bug hunters mobile, é o acesso ao apk para fazer a engenharia reversa e pesquisar termos importantes dentro do código, essas informações conduzem a atmosfera de ataque, mas como conseguir esse apk ?
Existem algumas formas de fazer isso, usando alguma tool específica ou extrair o apk diretamente do dispositivo, e assim por diante. Aqui neste post vou me ater a uma única forma simples de fazer isso, usando uma extenção do google chrome. Vá a loja de extensões do google chrome, https://chrome.google.com/webstore/category/extensions?hl=pt-br , pesquise por downloader apk, vou recomendar a extensão que estou usando atualmente, já usei outras mas atualmente estou usando a APK Downloader, ela tem este nome e está nesta url https://chrome.google.com/webstore/detail/apk-downloader/idkigghdjmipnppaeahkpcoaiphjdccm?hl=pt-br , ok. Mas como funciona ? Primeiro instale ela no seu chrome,que é basicamente clickar no botão usar no chrome e aceitar o add extensão, no canto direita da tela do seu navegador vai aparecer um icon do android ;). Agora vamos utilizar a extensão, essa é a parte mais interessante pela facilidade. Você navega até a url do aplicativo que desejar baixar o apk, clicka na extensão, ela vai abrir uma segunda aba com a url https://apkcombo.com, que você pode ir direto pesquisar o apk por nacionalidade ou usar a extensão. Prefiro a extensão, por ser prático, rápido e simples, voltando ao download, vai gerar um apk, mostrando alguns dados do apk: como versão, nome e tamanho, basta clickar em download e ser feliz. 

#hackingMobile #androidApk #DownloadDeApk