teleren/devto huggingface dataset:
Remix.run :: CRUD com Supabase - Parte 03 - Configurando o Supabase Client no Remix
Published: 2022-04-26 13:45:42

Nesta parte do tutorial iremos criar a configuração que nos permitirá conectar com a API do Supabase.

### 📑 Criando o arquivo `.env`
##### Passo 01
1) Vá ao Dashboard do Supabase ([https://app.supabase.io/](https://app.supabase.io/)) e entre no seu projeto `Remix Blog Supabase`
2) Na barra lateral, clique no menu `Settings` (⚙️), depois em `API` e deixe a janela aberta 
3) Vá até a raiz do seu projeto.

##### Passo 02
Na raiz do projeto crie o arquivo `.env` com as seguintes variáveis:
- SUPABASE_URL; e
- SUPABASE_KEY.

##### Passo 03 - definindo o valor da variável `SUPABASE_KEY`
1) Na janela do Dashboard do Supabase, aquela que deixamos aberta, observe que dentro do formulário `Project API Keys` existe o campo `anon` `public`, clique no botão `copy` para capturar o valor dele
2) Agora cole o valor copiado para a variável `SUPABASE_KEY` no seu arquivo `.env`.

##### Passo 04 - definindo o valor da variável `SUPABASE_URL`
Ainda no Dashboard do Supabase observe que existe o formulário `Configuration`. Agora precisamos copiar o valor do campo `URL`, para isto clique no botão `copy` e cole o valor copiado para a variável `SUPABASE_URL` no seu arquivo `.env`.

Se tudo foi feito corretamente seu arquivo `.env` deverá ficar parecido com algo assim:

```env
SUPABASE_URL='https://asxwozcalashinicovpv.supabase.co'
SUPABASE_KEY='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJpc3MiOiAic3VwYWJhc2UiLAogICJyZWYiOiAiYXN4d296Y2FsYXNoaW5pY292cHYiLAogICJyb2xlIjogImFub24iLAogICJpYXQiOiAxNjQ3NzAyMTkxLAogICJleHAiOiAxOTYzMjc4MTkxCn0=.MTPNt7yEGWOvkORubeHDlvEGfH8ZAZcuHq5T878Foec'
```
**Os dados acima são fictícios, portanto não irão funcionar no seu projeto, substitua os dados com os seus!* 😀

### ⚡️ Criando o cliente do Supabase
Dentro da pasta `app`, crie uma subpasta como o nome `utils` e dentro dela crie o arquivo `supabase-client.server.ts`, que ficará assim:

```ts
//supabase-client.server.ts
import { createClient } from '@supabase/supabase-js'

const supabaseUrl = process.env?.SUPABASE_URL as string
const supabaseKey = process.env?.SUPABASE_KEY as string

export const supabase = createClient(supabaseUrl, supabaseKey)
```

Pronto, nossa conexão com o banco de dados já está pronta, na parte 04 iremos iniciar nosso CRUD propriamente dito.

- [Parte 01 - Criando o projeto](https://dev.to/juniormartinxo/remix-crud-com-supabase-parte-01-criando-o-projeto-5bon)
- [Parte 02 - Instalando o Supabase](https://dev.to/juniormartinxo/remixrun-crud-com-supabase-parte-02-instalando-o-supabase-4ch7)
- [Parte 03 - Configurando o Supabase Client no Remix](https://dev.to/juniormartinxo/remix-crud-com-supabase-parte-03-configurando-o-supabase-client-no-remix-1lhm)

### em breve!
- Parte 04 - Carregando e inserindo novos registros
- Parte 05 - Trabalhando com formulário
- Parte 06 - Testando a inserção de novos registros
Drop your Mastodon social links here. 👇
Tags: functional, watercooler
Published: 2022-04-26 13:07:15

---
title: "Drop your Mastodon social links here. 👇"
published: true
description: "Mastodon an open source, federated microblogging platform similar to Twitter."
tags: ["functional", "watercooler"]
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nail25mytgzoeo76z72p.jpg
---

## If you're not familiar with Mastodon

I've always really liked Mastodon as a concept. It's everything people say they want Twitter to be: It's open source, so anyone can host a Mastodon instance. It's federated, so you can follow and interact with people across different Mastodon instance hosts. Every client I've seen so far as been chronological by default. It doesn't come with it's own Weirdo Amplification Algorithm. And, as you would expect, it's nonprofit and doesn't have ads. 

There's really only one major problem with it in my opinion, and unfortunately it's self-perpetuating--there aren't as many people to follow on Mastodon, so Mastodon isn't as fun as Twitter, so people leave Mastodon for Twitter, so there aren't as many people to follow on Mastodon.

## So why join Mastodon now? 

There's a lot of speculation right now about the future of The Bird Site, and I've been pleased to see some of my Twitter favorites create Mastodon accounts "just in case." This makes me happy because I'd rather follow people on Mastodon than Twitter already. 

So I'm hoping to keep the trend going. I've created my own separate [Mastodon account for tech content](https://mastodon.social/@webbureaucrat) for my usual fare: civic tech, functional programming, web platform, etc. 

## How about you? 

You can [find a mastodon instance on JoinMastodon.org](https://joinmastodon.org/communities/). 

Then, drop your link in the thread below and let us know what you like to post about. (For my part, I'm particularly hoping to find my fellow functional programming fam, which is why I'm abusing the tag above.)

***Anyone who takes this article as a cue to give me their hot takes on Elon Musk has to drop and give me twenty.*** I will block you before I finish reading your comment.
What is WebP?
Tags: webdev, design, performance
Published: 2022-04-26 12:59:14

I `right click > save` images off the web constantly, and I've started coming across `.webp` file types more and more. What is this Google-made [open source](https://www.webmproject.org/code/#:~:text=webmproject/bitstream%2Dguide/-,WebP%20Repositories,-libwebp%3A%20WebP%20Image) image file format?

## WebP

The stated goal for this file format is improving website speed, so WebP may become another tool in your [responsive images](https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images) toolbox. WP Rocket even has a glowing review of the format in their [page speed and caching tutorials](https://wp-rocket.me/blog/webp-use-image-format-wordpress/).

Based off of the VP8 video encoding format, the WebP format provides lossy and lossless compression for creating small images for the web. Both types of compression support transparency and provide [smaller images](https://developers.google.com/speed/webp/docs/webp_study) than PNG or JPEG compression. Essentially this means you can get images that look the same with a file size 25% or more smaller than you would with JPEG or PNG. 

You can [download tools](https://developers.google.com/speed/webp/download) for viewing WebP files, encoding JPEG, PNG, and TIFF images into WebP images, and decoding WebP images into PNG. There's a [gif2webp tool](https://developers.google.com/speed/webp/docs/gif2webp), which means this format supports animation, as well. I know from experience Preview on macOS will view these files and export into several formats. It looks like it's a bit trickier [on Windows](https://www.intowindows.com/4-ways-to-open-webp-images-in-windows-10/).

The format has been around for about a decade now, so browser support is [pretty good](https://caniuse.com/webp), but not yet universal like JPEG and PNG. Considering older email clients still have trouble with PNG, WebP may not yet be the file format for your emails.

WebP is also limited to 8-bit color precision and the lossy compression algorithm sacrifices color information and fine detail. This means it's not great for high quality photographs and compressing a low quality JPEG with WebP encoding will compound upon your problems.

The other downside is many places where you can upload images do not support you uploading WebP, even if they're using it themselves when hosting the uploaded images. Hopefully this begins to change, garnering WebP more support and popularity.

## Conclusion

Unless you're making a site like a photographer's portfolio, requiring high quality, vivid color, and fine detail in your images, WebP seems like a pretty useful image format to reach for when building a site. It provides all the benefits of a PNG and GIF with smaller file sizes. It makes sense that websites that host a lot of images are incorporating this file format more and more.
Top 5 Web Development Frameworks in 2022
Tags: webdev, vue, laravel, angular
Published: 2022-04-26 12:53:30

Every business, big or small, is paving its way to create a prominent online existence via expressive and well-built websites for their business. Hundreds and thousands of **[web developers](https://www.clariontech.com/hire-developers/hire-web-developers)** and web development companies are being approached to craft intuitive and sophisticated websites to attract new visitors. In all of this hustle, one player that has a pivotal role to turn visions into existence is web development frameworks!

The market is full of web development frameworks. Each of them offers unique features and functionalities. Besides it's not a size fits all scenario here. So, there is nothing best or worst, just something that suits you well.

It all boils down to one question! What are the top web development frameworks in 2022, and what should one go for! Well, we can surely answer the former part of the question while we keep the latter for you to find the answers.

## What will you get from this?

It is a thoroughly curated blog where we have listed the in-demand web development frameworks in 2022. You will easily be able to find the framework that suits you the best by the end of this blog.

We bet you are excited to discover the answer, because we surely are!

## What is a web development Framework?

A web development framework is a well-structured software platform used for developing web applications and websites. It offers a plethora of pre-written web components, code snippets, and application templates. Web Developers use these web development frameworks to build web services, web APIs, and other web resources.

## Why are web development frameworks requisite?

A reliable source that enhances the traffic
Eases the development and maintenance process
It has standardized code practices along with conventions for code structures
Streamlined developer's programming process that avoids errors and bugs Here is a list of the top 5 **[web development frameworks](https://www.clariontech.com/blog/top-5-web-development-frameworks-in-2022)**
3 ways to swap two variables in Python
Tags: python, beginners, programming
Published: 2022-04-26 12:49:17

### Using a temporary variable

The simplest way to swap the values of two variables is using a `temp` variable. The `temp` variables is used to store the value of the fist variable (`temp = a`). This allows you to swap the value of the two variables (`a = b`) and then assign the value of `temp` to the second variable.

```py
a = 11
b = 7

temp = a
a = b
b = temp

print(a) # 7
print(b) # 11
```

### Without a temporary variable (Tuple swap)

Another way to swap the values of two variables, without using a temporary variable, is to use tuple packing and sequence unpacking. Tuples can be constructed in a number of ways, one of which is by separating tuple items using commas. Moreover, Python evaluates the right-hand side of an assignment before its left-hand side. So, by separating the variables with commas on the right side of the statement the variables are packed into a tuple and unpacked by placing the same number of comma-separated target variables on the left side.

This method of variable swapping and permutation can be used for more than two variables as long as the same number of variables are on both sides of the statement.

```py
a = 11
b = 7

a, b = b, a

print(a) # 7
print(b) # 11
```

### Using arithmetic operators (for numbers only)

If the two variables are numbers, their values can be swapped using arithmetic operators such as addition and subtraction (`+`, `-`) or multiplication and division (`*`, `/`). This swapping method is based on calculating the sum of the two numbers and then swapping them using the sum and the difference from the sum.

```py
a = 11
b = 7

a = a + b # a = 18, b = 7
b = a - b # a = 18, b = 11
a = a - b # a = 7,  b = 11

print(a) # 7
print(b) # 11
```

---

_Do you like short, high-quality code snippets and articles? So do we! Visit [30 seconds of code](https://www.30secondsofcode.org/) for more articles like this one or follow us on [Twitter](https://twitter.com/30secondsofcode) for daily JavaScript, React and Python snippets!_ 👨‍💻
Install Wine Fedora 35
Tags: linux, fedora
Published: 2022-04-26 12:44:23

Add the repository
```
sudo dnf config-manager --add-repo https://dl.winehq.org/wine-builds/fedora/35/winehq.repo
```

Install stable version

```
sudo dnf install winehq-stable
```

After install, run config

```
winecfg
```

And install
![winecfg](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/25aafxkn71ezofgdx5wn.png)

Finish
![Wine](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fn7yqtlpww3owfn2txmv.png)

---

## Reference
- [wiki.winehq.org](https://wiki.winehq.org/Fedora)
Encoding, Encryption, Hash
Published: 2022-04-26 12:43:50

1. Encoding
Use to change the format of the code to different format for **usability**. The encoding technique is public, so any one who know how to read can get the information.

2. Encryption
Use for security purpose. We can **encrypt** the data using key to make it unreadable by people who don't have the key. If we want to read the data, we need to **decrypt** it using the key.

3. Hash
Use to check the integrity of the data. By hashing the same data, it will always yield the same result. However, we cannot transform the hash data back to the original one.
Next.js starter recipe 👨‍🍳
Tags: nextjs
Published: 2022-04-26 12:38:23

## Introduction

If you're like me, and you tend to start many new Next.js projects the same way, you might consider creating your own template. It's easier than you think, so let's keep it short and get straight to the action!

## How-to

At first, let's generate a Next.js project as you usually would.

```
yarn create next-app
# or
npx create-next-app
```

You will be asked for a name for your new project. Of course, you can choose any name you like, but in general, the naming pattern for starters looks like this - `next-[name]-starter`.

Once your project is generated, you can make any changes as you like. Also, it's a good practise to let your potential users know how to quickly create a project with your starter, for this you can use `README.md` file.

To start working with your new template, at first you have to upload it to the GitHub repository. Let's navigate to the https://github.com/new and create a new repo, then follow the steps or this [tutorial](https://docs.github.com/en/get-started/importing-your-projects-to-github/importing-source-code-to-github/adding-locally-hosted-code-to-github) on how to upload your local repo to GitHub.

At the moment your template has been uploaded to the GitHub repo you're ready to use it, simply run one of the following commands and enjoy! 🎉

```
yarn create next-app [project-name] -e [link-to-repo]
# or
npx create-next-app [project-name] -e [link-to-repo]
```

Share the templates that you've created in the comment section below, or just let me know what you think.

Thanks for reading! 👋
How to install Kyverno in a k8s cluster?
Tags: kubernetes, security, devsecops
Published: 2022-04-26 12:37:52

In the [k8s policy management](https://sureshdsk.dev/series/k8s-policy-management)  series, We're going to look at how to install Kyverno dynamic admission controller and its CRDs can installed in k8s cluster using helm or yaml manifests. 


## Install using helm
```
helm repo add kyverno https://kyverno.github.io/kyverno/
helm repo update

# Install kyverno controller
helm install kyverno kyverno/kyverno --namespace kyverno --create-namespace

# Install kyverno policies
helm install kyverno-policies kyverno/kyverno-policies --namespace kyverno

```


## Install using yaml
```
kubectl create -f https://raw.githubusercontent.com/kyverno/kyverno/main/config/install.yaml

```

To check the Kyverno controller status, run the command:

```
kubectl get pods -n <namespace>
```

If the Kyverno controller is not running, you can check its status and logs for errors:

```
kubectl describe pod <kyverno-pod-name> -n <namespace>
kubectl logs -l app.kubernetes.io/name=kyverno -n <namespace>

```
What am i missing please. it doesn't give me the total. it only evaluates the first if
Tags: javascript
Published: 2022-04-26 12:25:48

`function inventoryScore (inventory) {
    const splited = inventory.split(',')
    let totalInventory = 0
    for (let i = 0; i < splited.length; i++) {
        const item = splited[i]
        if (item === 'gold cup') {
            totalInventory += 5
        } else if (item === 'puppy') {
            totalInventory += 4
        } else if (item === 'magic cup') {
            totalInventory += 10
        } else if (item === 'tooth of a magestic whale') {
            totalInventory += 20
        } else if (item === 'tentacle of a giant squid') {
            totalInventory += 100
        } else if (item === 'anything else') {
            totalInventory += 1
        }
    }
return totalInventory;
}

console.log(inventoryScore('gold cup, puppy, magic cup, tooth of a magestic whale, tentacle of a giant squid, anything else'))


// let str = 'gold cup, puppy, magic cup, tooth of a magestic whale, tentacle of a giant squid, anything else'`
Membuat Program Operasi Himpunan (Selisih & Komplemen)
Tags: javascript, beginners, programming, set
Published: 2022-04-26 12:23:39

Hai teman-teman 👋

Kali ini saya akan membuat fungsi untuk mendapatkan selisih antara 2 himpunan dengan menggunakan bahasa pemrograman javascript. Fungsi ini menerima 2 inputan variabel yang merupakan objek dari kelas Set dan akan menghasilkan selisih dari 2 objek tersebut. Berikut kode pemrogramannya:

```javascript
function getDifference(a, b) {
    const arrayA = Array.from(a);
    const difference = arrayA.filter(member => !b.has(member));

    return new Set(difference);
}
```

Pada fungsi di atas saya melakukan konversi variabel a menjadi array. Lalu, saya menyeleksi anggota variabel a yang tidak menjadi anggota variabel b menggunakan method filter dan menyimpan hasilnya ke dalam variabel difference. Langkah terakhir, saya mengembalikan variabel difference yang telah dikonversi menjadi Set supaya tidak ada duplikasi data.

Contoh penggunaan:

```javascript
let a = new Set([1,2,5,6,7,9]);
let b = new Set([2,3,4,5,7,8]);

console.log(getDifference(a, b));
console.log(getDifference(b, a));
```

Output dari kode di atas adalah

```
Set(3) { 1, 6, 9 }
Set(3) { 3, 4, 8 }
```

Fungsi di atas juga bisa digunakan untuk mengetahui komplemen sebuah himpunan dari semesta tertentu. Misal S = {1,2,3,4,5,6,7,8,9} maka fungsi di atas bisa digunakan seperti contoh berikut:

```javascript
let s = new Set([0,1,2,3,4,5,6,7,8,9]); // Semesta
let a = new Set([1,2,5,6,7,9]);

console.log(getDifference(s, a));
```

Output dari kode di atas adalah

```
Set(4) { 0, 3, 4, 8 }
```

Demikian yang dapat saya bagikan, apabila ada yang perlu dikoreksi silahkan share di kolom komentar. 😁
Change Fedora display scale to 150%
Tags: linux, fedora
Published: 2022-04-26 12:20:22

Easy to change with this code, change `1.5` to your display

```
gsettings set org.gnome.desktop.interface text-scaling-factor 1.5
```

Or install **Gnome Tweak**
![Install Gnome Tweak](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3bpqpsh572bkyqmkm79y.png)

And change on **Fonts** tab

![Gnome Tweak](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q4v14j6fh4pyv7yta5wr.png)

---

## Reference
[ask.fedoraproject.org](https://ask.fedoraproject.org/t/how-to-get-150-scaling-in-fedora/15702/2)
VS Code Tip of the Week: The JavaScript Debug Terminal
Tags: vscode, vscodetips
Published: 2022-04-26 12:04:03

This week’s VS Code tip of the week is coming a day late. I’m still ramping up at my new job and completely forgot to post this yesterday. 🙃

It’s been around for a bit now, but you can create a terminal in the integrated terminal panel called the JavaScript debug terminal.

![Drop down to select a terminal type in the VS Code Intergrated terminal panel. The currently selected item is JavaScript Debug Terminal](https://community.vscodetips.com/uploads/articles/hhrwv6xq3m9xn9xfpj47.png)
 

What this gives you is the easiest way to start a debug session for Node.js. Run an npm script that runs something Node.js and it will attach the debugger automatically for you. Same goes for running a file via e.g. `node index.js`

![Debuggin a Node.js file in VS Code](https://community.vscodetips.com/uploads/articles/0af4l654m8bhhktbxlhy.png)
 

You can read more about the [JavaScript debug terminal in the official documentation](https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_javascript-debug-terminal).

Happy VS Coding!

P.S.: If you're looking for a community that’s all about VS Code, come on over and say hi at [vscodetips.com](https://vscodetips.com)!
How do i choose a project to work on.
Tags: beginners, tutorial, discuss, codenewbie
Published: 2022-04-26 11:44:04

I Learnt C++ (some basics and object-oriented-programming concepts) in my class at college. we are almost done with the semester. we didnt had any samll-projects as a part of course. but our teacher did asked us to make one. so i am looking to make one. should i just make one similar to everyone else out there making(some management system). 
Or try to go hardcore and try for some complex project or just learn about them. looking for advice and suggestions.
Arrow functions in JavaScript
Tags: javascript, webdev, programming, beginners
Published: 2022-04-26 11:28:54

Arrow functions in JavaScript Instead of the function keyword, it uses an arrow (=>) made up of an equal sign and a greater-than character (not to be confused with the greater than-or-equal operator, which is written >=).

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gn2ffg33je2t5oynga4b.png)
The arrow comes **after** the list of parameters and is followed by the function’s body. 
It expresses something like “this input (the parameters) produces this result (the body)”.
When there is **only one parameter name**, you can omit the parentheses around the parameter list. If the body is a single expression, rather than a block in braces, that expression will be returned from the function. So, these two definitions of square do the same thing:

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

When an arrow function has **no parameters** at all, its parameter list is just an empty set of parentheses.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jpmohcgrghrkgdvfjzcy.png)
There’s no deep reason to have both arrow functions and function expressions in the language.
Arrow functions were added in **2015**, mostly to make it possible to write small function expressions in a less verbose way
Fastest Web Hosting
Published: 2022-04-26 11:25:41

I am Adrik Skylac, head of Skylac Engineering, a high-end design and engineering firm. I am best known for my work with revolutionary implant technology: neural implants that allow direct wireless access to the internet. With the implants it is possible to directly interface with the worldwide net. But the implants are not just a technology that lets one access the net, they are also capable of revolutionizing the way we interact with our environment. For example, with a tiny chip implanted in your eye, you could access images stored across the globe. Similarly, you could stream video into your eye through the net.

The possibilities are endless if you have such technology. But back to the story. Our company had previously built the Liberty Star, a car capable of being remotely controlled by its owner. I had been working on the neural implants for many years before the Liberty Star. We had sold these implants to some wealthy and influential individuals. But I felt that the technology could be used in other areas, in areas that would benefit the world. Eventually, we started working on an implant of our own. We used the Liberty Star to test the concept. The eye implant worked beautifully; it added so much as an interface that we decided to make a larger version.

The neural implant we created could be surgically implanted in anyone to allow direct wired access to the net.