teleren/devto huggingface dataset:
Tipos de Dados em Elixir
Tags: elixir, tutorial, programming, beginners
Published: 2022-05-10 15:15:11

Nesse artigo, iremos entender sobre tipos básicos em elixir.
Não diferente de outras linguagens, temos alguns tipos de dados que já conhecemos, como: Inteiro (Integer), Ponto Flutuante (Float), Booleano (Boolean) e as Strings. Também existe um tipo chamado Átomo (Atom) que iremos entender sobre ele mais a frente.

Dado essas informações, vamos entendê-los:

## Inteiro - Integers
> Os inteiros são qualquer número, positivo ou negativo que não representam parte decimal. No elixir, temos também suporte aos números binários, octal e hexadecimal.

```elixir
iex(1)> 255 # Exemplo de número inteiro
255
iex(3)> 0b0110 # Exemplo de número octal
6
iex(4)> 0x1F # Exemplo de número hexadecimal
31
```

## Ponto Flutuante - Floats
> Em Elixir, os números de ponto flutuante requerem um decimal depois de pelo menos um dígito; estes possuem uma precisão de 64 bits e suportam `e` para números exponenciais:

```elixir
iex(1)> 1.4 
1.4
iex(2)> 5.5
5.5
iex(3)> 1.0e-10
1.0e-10

```

## Booleanos - Booleans
> Elixir suporta true e false como booleanos; todo valor comporta-se como verdadeiro com exceção de false e nil (`nil` é a representação de nulo). No exemplo a baixo, utilizo o `!` para negar a afirmação; se algo retorna o valor `true`, quando nego ele retorna `false`.


```elixir
iex(1)> true
true
iex(2)> false
false
iex(3)> !nil 
true
iex(4)> !!nil
false
```

## Átomo - Atoms
> Um átomo é uma constante cujo o nome é seu valor e é representado por `:` seguido de seu nome. Se está familiarizado com Ruby, estes são equivalentes aos símbolos.

```elixir
iex(1)> :development
:development
iex(2)> :elixir
:elixir
iex(3)> true
true
iex(4)> is_atom(true)
true
```

## Strings
> As strings em Elixir são codificadas em UTF-8 e são representadas com aspas duplas:

```elixir
iex(1)> "Hello"
"Hello"
iex(2)> "Olá Fulano"
"Olá Fulano"
iex(3)> "Olá\nMundo!"
"Olá\nMundo!"
iex(4)> "Olá 
...(4)> Mundo"
"Olá\nMundo"
```

Os tipos básicos são esses. Em breve veremos tipos de dados mais complexos quando aprendermos sobre coleções e funções.

Abraço, pessoal!
Siga-me para ver a continuação dessa série.
What is GitLab Registry? | GitLab Pipeline | GitLab Tutorial For Beginners | Part VII
Tags: devops, beginners, tutorial, git
Published: 2022-05-10 15:07:36

Learn what is GitLab registry, and the various registries in GitLab.
Start FREE testing. [Start FREE Testing](https://accounts.lambdatest.com/register?utm_source=devto&utm_medium=organic&utm_campaign=may10_sb&utm_term=sb&utm_content=tutorial_video)!

Integrate GitLab with LambdaTest: [https://bit.ly/2Y3ke3R](https://bit.ly/2Y3ke3R)


In this part of GitLab Tutorial for Beginners, Moss(@tech_with_moss), an expert in DevOps and CI/CD tools, introduces you to some additional features of GitLab pipelines. He majorly focuses on packaging and releasing features. First, you will learn what are GitLab releases, what are GitLab package containers and infrastructure registries, followed by the steps on how to write a GitLab pipeline. By the end of this video, you will be able to deploy artifacts from a GitLab pipeline to the GitLab package registry.

Also, learn -:⛳
🔸 What is the GitLab container registry?
🔸 What is the GitLab package registry?
🔸 What is the GitLab infrastructure registry?
Prototype and Prototypical Inheritance
Tags: javascript, inheritance, es6
Published: 2022-05-10 15:07:08


Whenever we create an object the Javascript engine automatically attaches your object with hidden properties and functions, the object is accessed via proto within every object that points out (references) the prototype that has been set for that object.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hb7owp87pdbaotcj8v2o.png)
 
We can access the properties of the object through the dot operator and can use this property or even update the existing properties

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

, and with function when we create a function in JavaScript, the JS engine adds an extra property called prototype to the created function. This prototype property is an object (called a prototype object) that has a constructor property referenced to it by default and inside the prototype property, you will get access to proto object.

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

In JavaScript, any function can be attached to an object in the form of a property. An inherited function acts just like any other property and when an inherited function is executed, the value of this points to the inheriting object, not to the prototype object where the function is an own property.

All objects in javascript are references to an object and that object has a prototype of its own and this chain goes on till it is referenced to a null

We can get and set propertytype by Object.getPrototypeOf() and Object.setPrototypeOf(), as well as with non standard proto property. While modifying a prototype you might even come across warnings like

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

This is because when navigating through a property object, we basically hop from an object to its [[prototype ]] then its object [[prototype]] until we reach the end of the chain to null. In ES6, there were ways introduced to mutate [[prototype] but they harm the performance in all modern javascript engines. When you set proto, we reduce the future optimizations from Ion on that object, but you also force the engine to go crawling around to all the other pieces of type inference, which involves further deoptimization.

Changing the prototype of an object in the middle of execution is really not a good practice and cause huge performance issue.
Animation with react-native-reanimated
Tags: javascript, typescript, react, reactnative
Published: 2022-05-10 15:05:42

<center>
Documentation - Animation (Beginner)
React Native - CLI
</center>
<strong>Introduction</strong>
  This is a document for beginners to be able to use simple animations in everyday life. This document will have a simple code that will also be available on github.

<strong>Installation</strong>
To install the animation package is simple:

```
yarn add react-native-reanimated
or
npm install react-native-reanimated
```

Use this command in your terminal.

Right after the installation it is necessary to install via cocoapods using the pods install command inside the /ios folder. After installation it is necessary to insert the plugin in the babel.config.js file:

```
module.exports = {
…
plugins: [
…
         'react-native-reanimated/plugin',
     ],  
};
```

<strong>possible error</strong>
   When it was used, an error was installed when I was revived stating that the previous step occurred that being done, even if it is done, a cache error can occur, it is resolved `yarn start --reset-cache`

The code that was used to open the menu using Reanimated

```
import React from 'react';
import {StyleSheet} from 'react-native';
import Animated, {
 interpolate,
 runOnJS,
 useAnimatedStyle,
 useSharedValue,
 withSpring,
 withTiming,
} from 'react-native-reanimated';
import {
 Container,
 Content,
 Blackout,
 TopClose,
 CloseItem,
 Image,
} from './styles';

export const ModalSettings: React.FC<any> = ({setOpenModalFunction}) => {
 const offset = useSharedValue(900);

 const animatedStyles = useAnimatedStyle(() => ({
   transform: [{translateY: offset.value}],
   opacity: interpolate(offset.value, [0, -280], [1, 0.5]),
 }));

 offset.value = withSpring(20);

 const animatedAndClose = () => {
   offset.value = withTiming(
     1200,
     {
       duration: 800,
     },
     () => {
       'worklet';

       runOnJS(setOpenModalFunction)();
     },
   );
 };

 return (
   <Blackout>
     <Container>
       <Animated.View style={[animatedStyles, styles.animated]}>
         <Content>
           <TopClose onPress={animatedAndClose}>
             <CloseItem />
           </TopClose>
           <Image
             source={{
               uri: 'https://cdn.dribbble.com/users/745861/screenshots/7889509/media/5891d9d48179ca0b3a8fcdf178db8737.png',
             }}
           />
         </Content>
       </Animated.View>
     </Container>
   </Blackout>
 );
};

const styles = StyleSheet.create({
 animated: {
   flex: 1,
 },
});
```

Here is the github link with the complete application:

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

<center>[Open here github](https://github.com/devMarcos24/react-native-reanimated_estudo)</center>
Top 7 Featured DEV Posts from the Past Week
Tags: top7
Published: 2022-05-10 15:00:56

---
title: Top 7 Featured DEV Posts from the Past Week
published: true
description: A round up of the most-read and most-loved contributions from the community this past week
tags: icymi 
cover_image: https://thepracticaldev.s3.amazonaws.com/i/sfwcvweirpf2qka2lg2b.png
---

_Every Tuesday we round up the previous week's top posts based on traffic, engagement, and a hint of editorial curation. The typical week starts on Monday and ends on Sunday, but don't worry, we take into account posts that are published later in the week._ 

## Rust, Use Hidden Power!

There are many programming languages out there, each with its own strengths and weaknesses, but @nathan20 is here to tell us what makes Rust so special.

{% embed https://dev.to/nathan20/the-hidden-power-of-rust-7ap %}


## Fetch API: AJAX’s Spiritual Successor

We have a much more modern way of handling data asynchronously than we used to thanks to Fetch API. Let’s see what it’s all about with @diogorodrigues!

{% embed https://dev.to/diogorodrigues/fetch-api-is-new-old-version-of-ajax-1m14 %}


## Git Back to Where We Once Didn't Have Git

Computers have evolved a lot in a short span of time and are still making paces. Let’s go back in time with @sneh27 to take a look at what the world was like before Git. 

{% embed https://dev.to/kcdchennai/revisiting-the-pain-the-world-without-git-3jod %}


## Running Ransomware in NodeJS

Covering this kind of tech can be scary, but knowing how something works is the best way of learning to combat it. Watch and learn as @devdevcharlie experiments with a small ransomware script in NodeJS.

{% embed https://dev.to/devdevcharlie/running-a-ransomware-attack-in-a-nodejs-module-4hgb %}


## Back off, Burnout 

Burnout can happen to anyone and everyone. Here are some tips for noticing and preventing burnout from @louiseann93 !

{% embed https://dev.to/louiseann93/preventing-burnout-32p8 %}


## Writing Good Code Reviews

Code reviews seem pretty straightforward. They are an opportunity for other developers to look at your code and review it. But, getting a good code review can make all the difference. Here are some of @gweaths tips for making the most of your code reviews. 

{% embed https://dev.to/gweaths/my-opinion-on-what-makes-a-good-code-review-2700 %}


## Staying Up-to-Date

Staying up-to-date with your favorite frameworks, libraries, and tools takes time.
In this post, @timdeschryver explores various ways to optimally follow the progression of new trends.

{% embed https://dev.to/this-is-learning/how-to-stay-up-to-date-o99 %}


_That's it for our weekly Top 7 for this Tuesday! Keep an eye on dev.to this week for daily content and discussions...and be sure to keep an eye on this series in the future. You might just be in it!_
RS256 vs. HS256 What's the difference?
Tags: security, webdev, programming
Published: 2022-05-10 14:53:04

### Learn the difference between RS256 and HS256 JWT signing algorithms.

### <br>

When learning about JWTs, some terms you hear a lot are signatures and signing. If the tutorials are creating JWTs, you may see them select an algorithm to create the signature. But what are signing algorithms, and how do they work? Read further and learn about JWT signing algorithms and the two most common algorithms used.

When you create JSON Web Tokens, they are signed. Signing the token allows its recipient to validate that the content of the token wasn't changed and verify the original issuer of the token created signature.

<div class="alert alert-success alert-icon"> **Heads up!** Signatures are not encryptions! </div>

Signing JWTs doesn't make their data unreadable. Signatures only allow verification that the content of the JWT was not changed. 

The signature is the part of a JWT that verifies the content of the JWT hasn't changed since the moment it has been issued (as it would happen, for example, in person in the middle attacks).

RS256 and HS256 are the most common algorithms used for signing JWTs. This article will go over some differences between RS256 and HS256. This post will not cover the other JWT signing algorithms, such as ES256 or PS256.

> To view more signing algorithms view the specs that [lists all the signing algorithms](https://datatracker.ietf.org/doc/html/rfc7518#section-3).

## What are JWT signatures?

Signatures are created by combining encoded versions of the **header** and **payload** of a JWT, passing them and the secret as parameters into the algorithm defined in the header.

The following is an example code that can be used to create a JWT signature.

```js
HMACSHA256(
  base64UrlEncode(header) + "." +
  base64UrlEncode(payload),
  secret)
```

The following is an example output of what the signed JWT looks like:


```bash
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
```
Each section (header, payload, and signature) is separated by a period (.).

The following picture highlights the signature part of a JWT decoded via [jwt.io](https://jwt.io/):

![jwt.io](https://images.ctfassets.net/23aumh6u8s0i/4iwiyrQaM62KhBTQfdVT78/230fb46d33eec8f88c2f664979054098/jwt-io-verify-signature.jpeg)

JWTs are commonly signed using one of two algorithms: HS256 (HMAC using SHA256) and RS256 (RSA using SHA256).

That leaves you with the question:

*What's the difference between RS256 and HS256 signing algorithms?*

[Read more...](https://auth0.com/blog/rs256-vs-hs256-whats-the-difference/?utm_source=content_synd&utm_medium=sc&utm_campaign=security)
Important - I made big changes after hearing this...
Tags: discuss, webdev, news, crypto
Published: 2022-05-10 14:50:13

If you’ve ever bought Bitcoin, then there is a 40% chance your investment is currently under water.

Key Summary:

- Bitcoin is off nearly 55% from its November peak, and 40% of holders are now underwater on their investments, in line with new data from Glassnode.
- Within the last month alone, 15.5% of all bitcoin wallets fell into an unrealized loss, because the world’s most popular cryptocurrency plunged to the $31,000 level, tracking tech stocks lower.
- Bitcoin’s close correlation to the Nasdaq challenges the argument that the cryptocurrency functions as an inflation hedge.

According to research from blockchain analytics firm Glassnode, only 60% of Bitcoin investments remained profitable when the cryptocurrency was priced at $33,600 per unit. The remaining 40% of investments sank below water. As Bitcoin's price has tanked even lower, now floating between $31,000 and $32,000, an even larger share of investments are in the red.

Glassnode says there has been “a high degree of urgency” associated with Bitcoin transactions this past week. The total value of transaction fees has shot above the high set during the last crypto crash in December.

But not everyone is selling. 

See Full Report [Here](https://fortune.com/2022/05/10/bitcoin-price-crash-investment-unprofitable-crypto/)
A playlist of podcast episodes I wish I knew about while studying for the AWS Certified Cloud Practitioner exam
Tags: beginners, aws, cloud, codenewbie
Published: 2022-05-10 14:49:11

One of my favorite **productivity hacks** is to leverage my time wasted on chores (_i.e. cleaning, commuting, etc._) to listen to podcasts and audiobooks

So when I recently discovered [The Official AWS Podcast](https://aws.amazon.com/podcasts/aws-podcast/?podcast-list.sort-by=item.additionalFields.EpisodeNum&podcast-list.sort-order=desc&awsf.episode-type=*all&awsf.tech-category-filter=*all&awsf.product-filter=*all&awsf.industry-filter=*all) hosted by [Simon Elisha](https://twitter.com/simon_elisha?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor) I was **super excited** to be able to expand on my [AWS certification](https://aws.amazon.com/certification/) studies on-the-go!

With that being said I'm **compiling** an **unofficial playlist** of episodes from The Official AWS Podcast that I wish I knew about while studying for the [AWS Certified Cloud Practitioner](https://aws.amazon.com/certification/certified-cloud-practitioner/) exam:

{% embed https://open.spotify.com/playlist/0ubgpBnyfJfJiBi68KCVAM?si=1ba6a549c19b4ed1 %}

This (work in progress) playlist is based on [my own personal experience](https://www.credly.com/badges/fcba784f-8894-42ca-88b0-591489a6cdc0/public_url) passing the exam with episodes I find **relevant** to understanding material the exam will quiz you on

So go ahead and pop this on in the background while you're on the train or cooking dinner - I guarantee you'll find it useful in your studies!

---

**Thanks so much for reading** and **best of luck** on your exam! If you like my content be sure to check out some of my other work, **connect** with me on [social media](https://www.linkedin.com/in/chris-greening-dev/), or contact me at my [**personal website**](https://www.christophergreening.com/) :smile: 

Cheers!

{% embed https://www.christophergreening.com %}

{% embed https://dev.to/chrisgreening/deploying-a-free-tier-relational-database-with-amazon-rds-3jd2 %}

{% embed https://dev.to/chrisgreening/connecting-to-a-relational-database-using-sqlalchemy-and-python-1619 %}

_I am not affiliated with or endorsed by Amazon, AWS, or The Official AWS Podcast in any way, shape, or form._
Update everything on a Mac
Tags: automation
Published: 2022-05-10 14:47:57

(requires homebrew) 

`brew update && brew outdated && brew upgrade && brew cu -ay && brew upgrade --cask --greedy && softwareupdate -i -a && brew cleanup`

First, it updates homebrew, upgrades packages, updates casks (ones managed by homebrew and those not as well), then gets apple updates, followed by a cleanup.
Animação com react-native-reanimated
Tags: javascript, reactnative, webdev, reanimated
Published: 2022-05-10 14:45:56

<center>
Documentação - Animação (Iniciante)
React Native - CLI
</center>

<strong>Introdução</strong>
	Este é um documento para iniciantes conseguirem fazer a utilização de animações simples no dia a dia. Este documento terá um código simples que também estará disponível no github.

<strong>Instalação</strong>
	Para fazer a instalação do pacote de animação é simples:
yarn add react-native-reanimated
ou
npm install react-native-reanimated
	Utilize esse comando no seu terminal.

Logo após a instalação é necessário instalar via cocoapods utilizando comando pods install dentro da pasta <projeto>/ios.  Após a instalação é necessário inserir o plugin no arquivo babel.config.js

```
module.exports = {
…
plugins: [
…
         'react-native-reanimated/plugin',
     ],  
};
```

<strong>Possível error</strong>
	Quando estava instalando ocorreu um erro quando fui utilizar o reanimated informando que o passo anterior tem que ser feito, mesmo sendo feito pode ocorre um erro de cache, é simples resolver yarn start --reset-cache






O código que foi utilizado para abertura do menu utilizando o Reanimated 

```
import React from 'react';
import {StyleSheet} from 'react-native';
import Animated, {
 interpolate,
 runOnJS,
 useAnimatedStyle,
 useSharedValue,
 withSpring,
 withTiming,
} from 'react-native-reanimated';
import {
 Container,
 Content,
 Blackout,
 TopClose,
 CloseItem,
 Image,
} from './styles';
 
export const ModalSettings: React.FC<any> = ({setOpenModalFunction}) => {
 const offset = useSharedValue(900);
 
 const animatedStyles = useAnimatedStyle(() => ({
   transform: [{translateY: offset.value}],
   opacity: interpolate(offset.value, [0, -280], [1, 0.5]),
 }));
 
 offset.value = withSpring(20);
 
 const animatedAndClose = () => {
   offset.value = withTiming(
     1200,
     {
       duration: 800,
     },
     () => {
       'worklet';
 
       runOnJS(setOpenModalFunction)();
     },
   );
 };
 
 return (
   <Blackout>
     <Container>
       <Animated.View style={[animatedStyles, styles.animated]}>
         <Content>
           <TopClose onPress={animatedAndClose}>
             <CloseItem />
           </TopClose>
           <Image
             source={{
               uri: 'https://cdn.dribbble.com/users/745861/screenshots/7889509/media/5891d9d48179ca0b3a8fcdf178db8737.png',
             }}
           />
         </Content>
       </Animated.View>
     </Container>
   </Blackout>
 );
};
 
const styles = StyleSheet.create({
 animated: {
   flex: 1,
 },
});
```
 


Segue o link do github com o aplicação completa:

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


[Abrir aplicação no github](https://github.com/devMarcos24/react-native-reanimated_estudo)
Copy to Clipboard - Clipboard.js
Tags: javascript, copy, webdev
Published: 2022-05-10 14:41:42

Clipboard.js is a javascript library that lets you copy content to clipboard with one line of code and paste it back with another. It also provides an API for building your own commands, as well as an external interface for triggering commands from your applications. To check the example, check the following post:

[Copy to clipboard Example using Clipboard.js](https://www.vinish.ai/copy-to-clipboard-button-using-clipboardjs)

Clipboard.js has no dependencies, and it's very small (~2kb gzipped).
When is the right time to go it alone...
Published: 2022-05-10 14:39:13



![Enceladus Digital Limited](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cq5xhhlkoq9fvmwjjcd2.png)

I've done it, I've handed my notice in and I'm going it alone. It's a scary thought, making sure the work is there and that I have enough work to keep a roof over my family's head. But when is the right time to make a go of it? Is it when you have had 20 roles? 40 even? or do you for it from code school, whatever code school was to you.

So the one thing I have learned in over 20 years of development is a change will do you good. Now don't get me wrong staying somewhere and learning codebases is great but in the long run, you get left behind, that may be different in some places but most places say a finance company or a blue-chip just want working code, they don't mind when it was built as long as it works.

Our job is hard enough without trying to move with the times. Coding changes monthly, and daily in some places where learning new skills, and keeping up with current tech is hard. The only way you can do that is to experience different projects, different code bases, and most importantly to work with different developers. It's taken me so much time to work that out and I made the choice now to work contracts, take on clients and do different jobs with different tech and hopefully create a nice little home for my work.

And I will blog the progress, I'll try and be open about the process and hopefully, it will be a happy and jolly experience. But I also want to do a podcast and have some cool developers on there, some new to the industry and like me some old heads to tell tales of the tape! So watch out for that!!!

So I'll bid you a great day and thanks for reading this article, and today I raise a coffee to the dawn of my 'Enceladus Digital Limited'