teleren/devto huggingface dataset:
You better commit often!
Tags: reactnative, upgrade, 5days5blogposts
Published: 2021-04-21 20:17:50

Yay! You just finished upgrading this app! Man, that was huge, a lot of code to clean, a lot of outdated dependencies, a lot of shit to go through. Now let's spread the good news and tell the client what was done. The easiest way would be to go through a git log and maybe describe each commit a bit more, right?

Let's suppose you just don't like to commit often.

`git log --since 2021/02/02`
```
commit 2c15a50fab5db11b9f4dd98ab68aea3c81137680 (HEAD -> my-huge-upgrade-i-worked-on-for-2-weeks)
Author: Piotr Wilk <wilkuintheair@fake.com>
Date:   Wed Apr 21 21:29:11 2021 +0200

    upgrade rn
```
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2czqmru2qv7d59gvbstu.png)

Ok, no worries, let's go through the changed files and we'll know. Let's just quickly see what's changed in these 87 files. Let's read each of these 87 files and for sure we'll come up with some solid, reliable summary.

This won't get any better, especially if you were working on it for 2 months in the evenings because it was your side hustle.

Now you see why it's better to commit often while upgrading?

Here's a better version of git log which can be more useful for this job.

`git log --oneline --since 2021/02/02`
```
837deb7e (HEAD -> rn-upgrade, origin/rn-upgrade) fix opening drawer menu
b495fdad fix back button on several screens
462cb878 fix propTypes warnings
60b9213e fix running the android app
61843322 migrate navigation's getParam to route.params?
17844756 update bugsnag
618a8f29 add missing bugsnag config
1835ca01 add missing android project include for codepush
bc7caa59 fix routes issues in the navigation
641d578b update bugsnag
04cdae03 update react navigation
c6ad1fe8 update i18next
d58d0c68 update react native billing
6c086db5 update codepush
b871cb46 fix NetInfo fetch
29c2f20d update lock files
50af2820 update more packages
9d5adfe1 update jetifier and lodash
1ec0b312 update fuse.js
f9e60fda change AsyncStorage imports
2dcf3f4c bring back App.js
3b05ac7e update react native community packages
78759ae9 remove TextInputMask from BlikPayment
0e254884 add flipper support
ed3f6529 bring back navigation
7e3dfa1a fix react import
364284dd bring back expo dependencies
d70a8818 fix building the app with unimodules
023033f5 add search paths
8148b765 ios recommended settings update
f4aeac54 update expo, add swift support
90171786 update ios to 11.0, update unimodules
031cc87c update AppCenter to v4.x, regenerate lock files
3aa3aec9 force using flipper v0.78.0 for iOS
93086945 fix react-native-text-input-mask issue when running pod install
d17612e3 yarn install
36d3a400 upgrade rn to 0.63.4 manually with upgrade helper
```

A bit better, right? It requires far less work in order to describe it to a client.

And if you don't like this amount of commits to be in your repo you can always squash it using `git merge your-branch --squash` or `git rebase -i`.

Also it's easier to track down potential issues using `git bisect`. What a great benefit!


What's your top benefit of commit often strategy?
How to Add a Link to Reusable Blocks in the Wordpress Admin Menu
Published: 2021-04-21 20:12:30

Sharing this little snippet because it took me way too much time to find this solution!

Wordpress offers the ability to save blocks as "reusable blocks" with Gutenberg. Often, users may want to manage or import these blocks. To access this page users have to open a post or page, click through to a block, open the options panel, click "Manage Reusable Blocks", etc. To make this easier, this function will add a `Reusable Blocks` submenu link in the Pages section of the Wordpress admin.

```
function add_reusable_blocks_link () {
  add_posts_page( 'Reusable Blocks', 'Blocks', 'edit_posts', 'edit.php?post_type=wp_block', '', 1);
}

add_action('admin_menu', 'add_reusable_blocks_link');
```
Vue 3 Supabase.js Client
Published: 2021-04-20 22:55:28

(Original repo [https://github.com/DidoMarchet/vue-3-supabase](https://github.com/DidoMarchet/vue-3-supabase))

:hamburger: Simple [Vue 3](https://github.com/vuejs/docs-next) wrap for [Supabase.js Client](https://supabase.io/docs/reference/javascript/supabase-client) build with [Vitejs](https://github.com/vitejs/vite)

### Table of content:
- [Install](#install-plugin)
- [Usages](#usages)
- [Methods](#methods)

Install the package via npm:

``` bash
npm i vue-3-supabase
```

# Install

It's Simple! In your `main.js` add the following:

``` javascript
import { createApp } from 'vue'
import App from './App.vue'

// Import supabase
import supabase from 'vue-3-supabase'

const app = createApp(App)

// Use supabase
app.use(supabase, {
  supabaseUrl: 'https://xxxxxxxxxxxxxxxxx.supabase.co', // actually you can use something like import.meta.env.VITE_SUPABASE_URL
  supabaseKey: 'xxxxx__xxxxx___xxxxx___xxxxx', // actually you can use something like import.meta.env.VITE_SUPABASE_KEY,
  options: {}
})

app.mount('#app')
```

It takes three params as argument :

`supabaseUrl`: the unique **required** Supabase URL which is supplied when you create a new project in your project dashboard.

`supabaseKey`: the unique **required** Supabase Key which is supplied when you create a new project in your project dashboard.

`options`: additional parameters **not required**

More references [here](https://supabase.io/docs/reference/javascript/initializing)

# Usages

### Options API

In the **Option API** you can use `this.$supabase` to access the Supabase.js Client:

``` vue
<template>
  // Your HTML Stuff
</template>

<script>
export default {
  async mounted () {
    const { user, session, error } = await this.$supabase.auth.signUp({
      email: 'user@provider.com',
      password: 'myawesomepassword',
    })
    console.log(user, session, error)
  }
}
</script>
```

### Composition API

In the **Composition API** you can use `inject('supabase')` to access the Supabase.js Client:

``` vue
<template>
  // Your HTML Stuff
</template>

<script setup>
import { onMounted } from 'vue'
import { useSupabase } from 'vue-3-supabase'

onMounted(async () => {
  const { user, session, error } = await useSupabase().auth.signUp({
    email: 'user@provider.com',
    password: 'myawesomepassword',
  })
  console.log(user, session, error)
})
</script>
```

# Methods

Here the methods references from official doc:

- [Auth](https://supabase.io/docs/reference/javascript/auth-signup)
- [Data](https://supabase.io/docs/reference/javascript/select)
- [Realtime](https://supabase.io/docs/reference/javascript/subscribe)
- [Storage](https://supabase.io/docs/reference/javascript/storage-createbucket)
- [Modifiers](https://supabase.io/docs/reference/javascript/using-modifiers)
- [Filters](https://supabase.io/docs/reference/javascript/using-filters)

Enjoy :punch:
Browsers are not designed for the next larger context.
Tags: largercontext, browsers
Published: 2021-04-21 20:05:08

We pick pages to open based on the short search term we type into search engines, link text, sometimes page description, and your attitude to the person sharing the link. That is it, that is the entire context. And even this context is lost almost immediately. Of course, you still have your internal context, in your memory, and consciousness, but it is too fluid and fragile. We switch tasks, we leave the things unfinished. This context will not do much for you the day or two after.

World-famous architect Eliel Saarinen once said:


**_“Always design a thing by considering it in its next larger context — a chair in a room, a room in a house, a house in an environment, an environment in a city plan.”_**


Browsers are not designed this way. Search engines are not designed this way either. Browsers display the pages well. Search engines serve results for your search query reasonably well.
None of this is our true goal when we use browsers and search engines. Use them to do the research, solve a technical problem, learn something view.  This is what 'larger context' is, and think we are lacking tools designed to support this context and goals.


Follow me on Twitter [@ykovzel](https://twitter.com/ykovzel) for more.

Juri out.


_photo by [@DTeychenne](https://twitter.com/DTeychenne)_
Data, data everywhere!
Tags: database, datascience, bigdata
Published: 2021-04-21 19:54:25

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gpaav4pxsm21fl2pi3zv.png)

A cada dois anos, em média, os dados gerados dobram de tamanho. Então pensar se a arquitetura de dados é escalável é algo a ser pensado no início da construção de projeto de dados. Não levando em consideração apenas o armazenamento, mas o processamento, análise e disponibilidade desses dados para a ponta final do pipeline.

Alguns números para ilustrar:

- Facebook recebe 600 terabytes de dados por dia
- Youtube recebe 300 horas de vídeo por minuto
- Google recebe 40 mil consultas de pesquisa por segundo

Segundo uma pesquisa de 2018 da Dresner, concluiu que as empresas que usam tecnologia big data saltou de 17% em 2015 para 59% em 2018. Em contra partida, o percentual das empresas que não planejam usar big data caiu de 36% em 2015 para 9% para 2018. Uma tendência que nos mostra que os desafios de big data das empresas está apenas no começo.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zyo7c4cujr0m9in224ao.jpg)

Claro que não são todas as empresas que precisarão de ferramentas de big data para tratar grandes volumes de dados, na real, a maioria delas ainda nem são orientadas por dados e não precisarão de uma arquitetura robusta em toda sua vida. Mas ao fazer essa mudança de mentalidade e começar a trabalhar com dados, criando uma cultura data driven, o que são poucos gigas hoje, rapidamente pode se transformar em terabytes em poucos anos. E ter em mente onde esse caminho pode levar, poupará esforço e recursos!

Se sua empresa ainda não é orientada por dados e quer começar a tomar melhores decisões, o segundo melhor dia para começar a construir sua "fonte da verdade" é hoje, o melhor dia foi ontem!

Afinal...

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2urzarbuyn811xykyqov.jpg)
SPA Authentication using Laravel Sanctum and Vue.js
Tags: laravel, vue, javascript, php
Published: 2021-04-21 19:47:10

Laravel Sanctum provides a lightweight authentication system relying on Laravel's built-in cookie-based session authentication services.

How Laravel Sanctum works
Before we start blindly mashing away without an understanding of what's happening behind the scenes, let's run over how Sanctum works.

Laravel Sanctum uses Laravel's cookie-based session authentication to authenticate users from your client. Here's the flow.

You request a CSRF cookie from Sanctum on the client, which allows you to make CSRF-protected requests to normal endpoints like / login.
You make a request to the normal Laravel / login endpoint.
Laravel issues a cookie holding the user's session.
Any requests to your API now include this cookie, so your user is authenticated for the lifetime of that session.
In this blog, together we will create a complete register and login feature for a single page application in Vue.js and Laravel Sanctum. We will create separate projects for the frontend (in Vue.js ), and for the backend ( Laravel ), that will interact with one another through a REST API.

https://techvblogs.com/blog/spa-authentication-laravel-sanctum-vuejs
When VCR seems to heavy try cURL & WebMock
Tags: ruby, webmock, testing, 5days5blogposts
Published: 2021-04-21 19:31:03

Do you want to mock exact response (body and headers) for some file download?

[VCR](https://github.com/vcr/vcr) is overkill for such small task. One can handcraft it and pass to [WebMock's](https://github.com/bblimke/webmock) `stub_request`. I'd rather go with saving full real response. 

There are [fine istructions](https://github.com/bblimke/webmock#replaying-raw-responses-recorded-with-curl--is) in WebMock README. I want to share it here for reference:

### Replaying raw responses recorded with curl -is

In console:

    curl -is www.example.com > /tmp/example_curl_-is_output.txt

In your test:

```ruby
raw_response_file = File.new("/tmp/example_curl_-is_output.txt")
stub_request(:get, "www.example.com").to_return(raw_response_file)
```
Simple implementation of pessimistic concurrency in Entity Framework
Tags: dotnet, csharp, domaindrivendesign, architecture
Published: 2021-04-21 19:21:23

An aggregate root can protect invariants by mediating access to internal components. However, it cannot prevent aggregate from reaching an inconsistent state, due to multiple users modifying it. We need to provide a mechanism, which will ensure that other's user's modification does not negatively affect the state of the transaction for other concurrent users.

The good thing is that in Entity Framework we can easily implement the pessimistic concurrency, based on the aggregate's version.

## Solution

```csharp
builder.Property(x => x.Version)
  .HasColumnName("Version")
  .IsConcurrencyToken()
  .HasDefaultValue(0);
```

The version has to be added to the aggregate. I added it into the base abstract class. Then, before every call of the `SaveChanges` method, increase the version. The Entity Framework will take care of the correct version being in the database.

If someone modifies the value of the aggregate and hence will increase the version, Entity Framework will throw an exception.
> Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException: Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded.

How do you take care of your aggregate's consistency?
Wednesday Links - Edition 2021-04-21
Tags: java, jvm, database, kotlin
Published: 2021-04-21 19:19:18

How to hype Java up again? (6 min read) ☕️
https://jackson.sh/posts/2021-04-java-underrated/

Where premature optimization can lead you? (30s read) 🦟
https://twitter.com/tagir_valeev/status/1384010540767268874?s=19

Pitfalls of integration tests (6 min read) 🧪
https://blog.thecodewhisperer.com/permalink/integrated-tests-are-a-scam

How much you can gain by Spring's DSL for Kotlin bean creation (6 min read) 🧐
https://towardsdatascience.com/a-benchmark-of-spring-annotations-vs-kotlin-dsl-209f54294325

jcstress has been released (1 min read) 🧨
https://twitter.com/shipilev/status/1382619468065542146

Delegation in Kotlin done correctly (4 min read) 🤖
https://blog.frankel.ch/kotlin-delegation/

JEP for deprecation Java's security manager (3 min read) 💩
https://www.infoq.com/news/2021/04/java-security-vote/

How clustered index works under the hood (8 min read) ⚗️
https://vladmihalcea.com/clustered-index/
Extending the default user devise
Tags: rails, devise
Published: 2021-04-21 19:16:00

Blogging day two, as a seasoned blogger I had a full head of ideas for this post (which is about two, both of them bad). Welcome to my 3 faithful followers, welcome to all who have not yet joined this elite group. Today I might even be able to show some code. I warn you that after seeing this your therapist will need therapy himself. 
And this is just the beginning. 

Now seriously, first a few words about what I write: an app for personal trainers and their trainees. Arranging workouts, diets, etc. To make things clear, this is a commercial project for which I will be paid and the client has agreed to make the repository public, which you can find here: [https://github.com/kubacky/FitHustle](https://github.com/kubacky/FitHustle)

For today's workshop, we will take an extension of the default rails devise with the user's name and roles. To use devises at all, we need to add a gem with them. This is not very complicated and is limited to adding one line in our gemfile

`gem 'devise'`

Then we need to run 

`bundle install` 
and 

`rails generate devise:install` 

in the console. It would also be useful to have devise views in our application, so:

`bundle exec rails g devise:views`

and finally:

`rails generate devise User`

We still need to migrate the changes generated by the above command

`rake db:migrate`

We got it!
To extend the default functionality we need to extend the available devise controllers, so in the console we quickly type:

`rails generate devise:controllers users`

and voilà. Almost the first coaches can arrange diets for their players. What's left is to extend the default user table with first name, last name and roles. The console is of course on standby at all times, so here we go:

`rails g migration add_name_and_role_to_users name:string surname:string role:string`

This will create a file in the folder: *db/migration* with a strange name like: *20210420195443_add_name_and role_to_users.rb*

We can now preview this file, which should look like this:
```ruby
class AddNameAndRoleToUsers < ActiveRecord::Migration[6.1]
  def change
    add_column :users, :name, :string
    add_column :users, :surname, :string
    add_column :users, :role, :string
  end
end
```
And again in the console:

`rake db:migrate`

In the next post we will add the tables for trainers and trainees in the database ;)

Cover photo: Luna think she’s an ostrich
Brand New Publication
Tags: story
Published: 2021-04-21 18:46:51

Not so far ago we have started a Brand New publication called LITSLINK.

There a lot of accomplishing work we did and a lot of interesting articles that we wrote to share information with you.

This time publication has articles and stories related to mobile, front-end, back-end, and general programming as well. 

Also, it contains stories about Artificial Intelligence, Machine Learning, and Data Science.

Welcome to our storybook!

https://medium.com/litslink
Welcome Thread - v121
Tags: welcome
Published: 2021-04-21 18:33:16

---
title: Welcome Thread - v121
published: true
description: Welcome to DEV! A thread of hellos and intros.
tags: welcome
canonical_url: 
---

![Pug salute](https://media.giphy.com/media/QaY6qf3jxcr87tJLwW/giphy.gif)

### Welcome to DEV!

1. Leave a comment below to introduce yourself! You can talk about what brought you here, what you're learning, or just a fun fact about yourself.

2. Reply to someone's comment, either with a question or just a hello. 👋 

**Great to have you in the community!**
NEW Crypto PROTOCOL SEEKS DEVS for smart contracts on BSC network. 
Published: 2021-04-21 18:20:17

Hi all 

I am lead investor and the brains behind the idea of a new Crypto protocol that will be involved in the tokenisation of land/property/development/rental/holidays/financial funds.

We are looking for developers capable of building the websites and coding our protocol to firstly the BSC network.

I am property developer and long term crypto investor we have a team of investors behind the idea already myself included. All team members will receive bonuses to development of the protocol as well as getting paid for the work they do. 

This idea is truly the next generation in crypto and decentralised finance. Anyone who joins the team will have to sign a confidentiality form you will not be able to talk about you work until launch. This is truly a unique chance for many and we will need a good balance of DEV's. From code to web design....
LaTeX Errors: List Environment
Tags: latex, codenewbie
Published: 2021-04-21 18:01:18

Hello, do you remember the `list` environments? You can check them [here](https://dev.to/latexteada/the-document-lists-and-multicolumn-14op). I am going to talk about the possible errors that you could have while creating a list :)

> There are 3 types of *list*, these are `enumerate`, `itemize` and `description`. I use the word *list* to refer to any of these options

# Errors in Lists

> I am going to write the error in `this format`, the description of the error in *this format* and the possible solution in normal format

- `LaTeX Error: Lonely item perhaps a missing list environment` *The `\item` command was inserted outside a listing environment* Change the location of that command 
- `LaTeX Error: Something's wrong perhaps a missing item`: *You forget to put the `\item` command* Put that command and then the text that you want to show
- `LaTeX Error: Too deeply nested` *You have exceeded the nested environments* Remember that you can nest at most 4 environments, check your environments

List environments are compatible with almost all LaTeX environments, but sometimes you can not put certain environments inside the list environment. If you have troubles with that, I would suggest you read the documentation of the environment you are trying to use

That is all for today, thanks :)
React Hooks - What i'm learning
Tags: react, hooks, beginners
Published: 2021-04-21 17:56:53

# Intro

Hiii! How you doing?

I decided to write what i'm learning, and this is the first post of this serie 😊

I live in Brazil and i speak portugues, but i trying write english to learning.

# Before hooks

Before understand hooks, is a good idea understand because hooks it's necessary and the code before and after use hooks.

... Will continue
#NikemaLearns About AWS – #4 Officially AWS Certified
Tags: aws, cloudpractitioner, learninpublic
Published: 2021-04-21 17:41:24


## I’m an AWS Certified Cloud Practitioner!

I took the exam and I passed. I fell behind on blog updates starting about a month ago but I studied up until the day before the test. I was somewhat disappointed in myself for not keeping my schedule but in the end, I passed and that was the main objective. 
## Persisting Through Difficulty

First, I want to remind myself and everyone that we are still living through a pandemic. Being a year into it, the abnormality of pandemic life is becoming the new normal. The new normal is still a collective state of crisis, widespread trauma, and loss. Many of us have been not okay for at least the past 12 months.

It’s okay to acknowledge that we aren’t okay. Out of necessity, I’ve developed the ability to be productive at times when I’m in need of rest and care. As I move into a new season of my life, I’m intentional about being kinder to myself. I’m learning to let “good enough” be good enough. I’m learning that I am responsible for asking for the help I need and taking breaks as necessary.

I believe that I hit the “pandemic wall” between my last blog post and this one. I hit the wall, took a moment to recover from the shock, and then went to work on scaling it. To scale the wall means to keep going even if it’s at a slower pace, setting reasonable expectations, focusing on what’s most important, and rationing the energy that is available to me.

All of this is to say, please give grace to yourself and others right now. There’s pressure, even if it’s coming from yourself, to act and perform as if things are normal.  Persist, but don’t forget to rest. Don’t be hard on yourself for the times when you are not operating at full capacity.
## What I Would Have Done Differently

Near the end of my study period, I started to have doubts that I was ready for the exam. I didn’t take [the course that AWS provides](https://www.aws.training/Details/eLearning?id=60697) until about a month before the exam and by my test date, I hadn’t even finished half of it.

If I had known what I know now when I started studying, I would have started with that course. It makes sense that AWS itself would have the most up-to-date curriculum for its certifications. The videos are well-produced (with transcripts available) and they also present content in text and illustrations. At the end of each lesson, there are links to documentation so you can go deeper on the topic if you choose to.

## What’s Next?

I’ve secured the certification so what’s next for #NikemaLearns? I have a web project to wrap up with a Hugo site, so I’m sure I’ll be learning and re-learning some things for that. For my next blog series, it’s looking like I’ll be learning and playing with Spinnaker and Armory Enterprise. My AWS CLI is installed and my own namespace is ready to go. Should be fun.