teleren/devto huggingface dataset:
Do we need Regex?
Tags: discuss
Published: 2020-06-01 04:59:24

---
title: Do we need Regex?
published: true
description: Just want to discuss that do we need Regex.
tags: #discuss
---

My question is "Do we need **regex**?".

Some people use **regex** and said

> "It's useful! Short and easy to understand. Only one pattern can show you want to get"

but some people don't use **regex** because they said

> "It's over engineer, Sometime just manipulate string. simple method like `.split` `.substring` is enough. And easier to read the logic and understand" 

---

I slightly agree with **second opinion** because developer know the basic of string method and basic loop/condition.

So what do you all think about it, people?  

please share 🙏🏻
Is CS Degree important?
Tags: discuss, career, computerscience
Published: 2020-06-01 04:44:23

Hi #DEV community, I was wondering if having a CS degree is important/necessary?

**A bit about myself:**

I am new to front-end development and have been learning JavaScript  for a few months now. Did some exercises from FreeCodeCamp's curriculum.  I have been working as a Cloud Operations Specialist (AWS) for a year  now.
 Also have a diploma in Computer Networking.

So to advance my career, should I carry on the 'self-taught' path or go back to College/University.

I also did a poll on Twitter:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/59y7mjhskjrxz97gqoge.png)
The valuable thing programming offers
Published: 2020-06-01 04:38:36

Programming provides us a great opportunity to build things at low cost, a computer and internet is enough. And this enable us to observe and truly learn principles about building - start small, hypothesis - trail - adjust hypothesis - truth.
We know these principls, but until we struggle in the unknown margin of circle, we truly learn how to apply these to expand the circle, to find the flaw in the known. Thus we get the opportunity to find disconfirming evidence,  and start to rebuild ourselves.
As Charlie Munger said, being able to recognize when you are wrong is godsend. Programming provide an excellent chance to practice it.
2. My Tech Journey - Wk 1
Published: 2020-06-01 04:31:09

Soo as promised I'm back with an update on how I spent my week.
As my exams approach it will be hard to keep this updated.
Also I got sick on Friday so great start lol

<Ol>
<li> <B> version control </b> </li>
- I picked this because I've wondered how GitHub works and why it is listen as a requirement in some tech job openings.
I watched YouTube videos for this and took down some notes.
<Br>
<li> <B> freecodecamp.org </b> </li>
- here I learnt basic HTML. Even the parts they don't teach me at school. I asked the hard questions to make sure I understood, like why is it called a radio button.</ol>
<Br>

Next week I plan to continue with code camp until I complete the certificate hopefully.
Also I want to build something. I'll work on a website or something idk.
One Place to look for sites offering Free Illustration Resources
Tags: illustration, gatsby, react
Published: 2020-06-01 04:10:30

I have created a site called [IllustrationHunt](https://illustrationhunt.com) using gatsby. [IllustrationHunt](https://illustrationhunt.com) contains the list of websites offering free illustrations. I hope you will like it, if you do then please share it with others in need XD.
Automatizar certificados de seguridad con Certbot
Tags: ssl, seguridad, certbot
Published: 2020-06-01 04:10:21

---
title: Automatizar certificados de seguridad con Certbot
published: true
description: Automatizar la administración de certificados de seguridad con nginx
tags: 'ssl, seguridad, certbot'
---

# Configuración de Certbot

### Instalar el repositorio de Certbot

El objetivo es gestionar certificados de seguridad con Let's Encrypt, con Certbot se puede automatizar la instalacion y la renovación de certificados de seguridad con nginx.

`$ sudo add-apt-repository ppa:certbot/certbot`

### Actualizar los repositorios de paquetes del sistema

`$ sudo apt-get update`

### Instalar Certbot

`$ sudo apt-get install python-certbot-nginx`

### Configurar los dominios

Editar la configuración de Nginx con los dominios que se requieren proteger

`$ vim /etc/nginx/sites-available/{filename}`

> `server_name {dominio.com} www.{dominio.com};`

### Verificar la configuración de Nginx antes de reiniciar el servicio

`$ sudo nginx -t`

### Reiniciar el servicio de Nginx

`$ sudo systemctl reload nginx`

### Verificar la configuración del firewall

```
$ sudo ufw status
$ sudo ufw allow 'Nginx Full'
$ sudo ufw delete allow 'Nginx HTTP'
$ sudo ufw status
```

### Instalar el certificado en los dominios

`$ sudo certbot --nginx -d {dominio.com} -d www.{dominio.com}`

### Verificar la renovación automática cada 3 meses del certificado

`$ sudo certbot renew --dry-run`
Mejora tu productividad con la Terminal
Tags: zsh, terminal, productividad
Published: 2020-06-01 04:02:03

---
title: Mejora tu productividad con la Terminal
published: true
description: Tips y ejemplos de comandos para mejorar el uso de la terminal
tags: 'zsh, terminal, productividad'
canonical_url: null
---

# Tips de la Terminal

## Manejo de alias en la terminal

Para configurar los alias, es necesario registrarlos en el archivo de configuración de `vim ./zshrc` y para que estén 
disponibles `source ~/.zshrc`

### Normal alias

`alias [custom-alias]="[command]"`

Ejemplo:

```
alias install="sdk install"
alias remove="sdk uninstall"
```

Esto se traduce como: 

- $ **install grails 2.2.0** ~= *sdk install grails 2.2.0*
- $ **remove grails 2.2.0** ~= *sdk uninstall grails 2.2.0*

### Suffix alias

`$ alias -s [file-extension]=[name-of-app]`

Ejemplo: 

`alias -s txt=code`

Esto se traduce en:

- $ **code readme.txt**

### Global alias

`$ alias -g [custom-alias]="[Command]"`

Ejemplos:

```
alias -g G="| grep"
alias -g L="| less"
alias -g GG="google.com"
```

Esto se traduce como:

- $ **apt-cache search vlc G** ~= *apt-cache search vlc | grep data*
- $ **cat readme.md L** ~= *cat readme.md | less*
- $ **ping GG** ~= *ping google.com*

### Alias con parámetros

```
[alias-name]() {
    command $param1 | $param2
}  
```

Ejemplo:

```
acs() {
    apt-cache search $1 | grep $2
}  
```

Se traduce en:

- $ **acs vlc data** ~= *apt-cache search vlc | grep data*
Setting up a PWA with  lighthouse ci on Github actions
Tags: continuesintegration, progressivewebapps
Published: 2020-06-01 03:58:27

---
title: Setting up a PWA with  lighthouse ci on Github actions
published: true
description: We will use the Github actions and create a progressive web app and test it using lighthouse ci. I will also go through improvements I've done from the report CI in lighthouse.
tags: continues integration, progressive webapps
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/fkat7y2dhwnxf47a6o67.jpg
---

{% youtube mkUOVbaoJbE %}

We will use the Github actions and create a progressive web app and test it using lighthouse ci. I will also go through improvements I've done from the report CI in lighthouse.
6-10PM challenge problem #005
Tags: challenge, algorithms, program, map
Published: 2020-06-01 03:53:15

<h2><b>Flatten a Dictionary</b></h2>

A dictionary is a collection of unique keys and their values. The values can typically be of any data type (i.e an integer, boolean, double, string etc) or other dictionaries (dictionaries can be nested). However, for this exercise assume that values are either an integer, a string or another dictionary.

Given a dictionary dict, write a method flattenDictionary that returns a flattened version of it .

If you’re using a compiled language such Java, C++, C#, Swift and Go, you may want to use a Map/Dictionary/Hash Table that maps strings (keys) to a generic type (e.g. Object in Java, AnyObject in Swift etc.) to allow nested dictionaries.

If a certain key is empty, it should be excluded from the output (see e in the example below).

<b>Example</b>

<div class="highlight"><pre class="highlight plaintext"><code>

input:  dict = {
            "Key1" : "1",
            "Key2" : {
                "a" : "2",
                "b" : "3",
                "c" : {
                    "d" : "3",
                    "e" : {
                        "" : "1"
                    }
                }
            }
        }

output: {
            "Key1" : "1",
            "Key2.a" : "2",
            "Key2.b" : "3",
            "Key2.c.d" : "3",
            "Key2.c.e" : "1"
        }
</code></pre></div>

<b>Important:</b> when you concatenate keys, make sure to add the dot character between them. For instance concatenating Key2, c and d the result key would be Key2.c.d.


<a href="https://dev.to/akbhairwal/6-10pm-challenge-problem-005-solution-3020">Solution</a>
Writing Code
Published: 2020-06-01 01:55:04

Tap, tap tap. I clack away on my keyboard.
Red. Green. Refactor.  Sometimes it's that simple.
But more often, it's not that easy.

Giving up is not an option. I'm so close. I must push through.
Try this, try that, nothing is working.
 
Add some logging. Looks like what I expected.
Breakpoints? Oh that would be nice, but I never set that up.
Now's not the time, let's put in some more debug messages.

More of the same, this isn't helping.
Get up, walk away, drink some water.
Wait! I think I know what it is, let's take another look.

Yup that's it. How did I miss it for the last hour?
All because I forgot to return from a map() function.
how to build express js code faster
Tags: express, node
Published: 2020-06-01 01:54:17

Alright. let me share how to build expressjs code faster 
oke for the first you should visit a expressjs.com

we can build a expressjs code use terminal with complieted
first you should visit a link express.js and click for Getting Started and choose a express generator install express generator on your terminal npx express-generator and after that you get it

   create : myapp
   create : myapp/package.json
   create : myapp/app.js
   create : myapp/public
   create : myapp/public/javascripts
   create : myapp/public/images
   create : myapp/routes
   create : myapp/routes/index.js
   create : myapp/routes/users.js
   create : myapp/public/stylesheets
   create : myapp/public/stylesheets/style.css
   create : myapp/views
   create : myapp/views/index.pug
   create : myapp/views/layout.pug
   create : myapp/views/error.pug
   create : myapp/bin
   create : myapp/bin/www

and open on your tools editor
React: making a store from createContext and useReducer
Published: 2020-06-01 01:54:08

# Introduction

For all but the simplest applications or static sites, React developers will use state to manage data. Determining the optimal location for state is part of the job of a React developer. Is this data relevant only to this component? This container? Or the entire application? Tools like Redux are popular solutions for managing 'global' state for JS frameworks like React.

There are advantages to using Redux (including its documentation, developer tools, and user base), but in this post I'll share an approach that uses existing React tools to make a state container. Specifically, this approach uses createContext and useReducer to make a StateProvider. 

# Approach

First, we'll write our reducer and store in a `store.js`. Note that the switch for your actions will look different from mine, but the pattern should look similar. 

```js
import React, { createContext, useReducer } from "react";

const initialState = { mobile: true, projects: null, checkout: null };
const store = createContext(initialState);
const { Provider } = store;

const StateProvider = ({ children }) => {
  const [state, dispatch] = useReducer((state, action) => {
    switch (action.type) {
      case "addToCart": {
        return { ...state, checkout: action.payload };
      }
      default: {
        throw new Error(`Unhandled action type: ${action.type}`);
      }
    }
  }, initialState);

  return <Provider value={{ state, dispatch }}>{children}</Provider>;
};

export { store, StateProvider };
```

Next we'll wrap our application with our StateProvider, to subscribe our Store to that App's view. In your `index.js`, your code could look like this:

```js
const app = (
  <StateProvider>
    <App />
  </StateProvider>
);
```

Lastly, we'll need a way to dispatch actions from the view to the reducer in the store. Your App container might look like this:

```js
import React, { useContext } from "react";

const App = () => {
  const { state, dispatch } = useContext(store);
  const itemAdded = item => {
    dispatch({ type: "addToCart", payload: { ...item } });
  };
}
```

# Conclusion

I like this pattern for managing global state in React applications, especially simple ones, principally because it reduces the amount of syntactic sugar from `mapStateToProps`, `mapDispatchToDrops`, and `export default connect(...)`. I hope this post was helpful to you!
84/100 100daysofcode Flutter
Tags: 100daysofcode
Published: 2020-06-01 01:52:44


day 84/100 of #100daysofcode #Flutter
Learning Flutter , courses Udemy from
@maxedapps

Today learn form, validate form, uniqkey, formstate,validator
https://github.com/triyono777/100-days-of-code/blob/master/log.md
Esse Não é Mais Um Hello World!
Tags: hello, webdev, beginners
Published: 2020-06-01 01:48:54

Olá, o meu nome é Daury e esse não é mais um Hello World e eu vou explicar o porquê disso.

Você já deve ter conhecido ou conhece alguém que fica pulando de galho em galho quando o assunto é linguagem de programação. Não sabe bem o que quer, estuda PHP enquanto pensa em Ruby, desiste de tudo e começa a estudar Python mas queria mesmo era saber como funciona o JavaScript e as milhares de bibliotecas e frameworks... 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/7ryqw3f857x32tm46prf.jpg)

Se você não conhece ninguém assim, talvez seja porque esse alguém seja você.

# A indecisa

Com 17 anos eu iniciei um curso técnico de programação e conheci a linguagem C. Eu não era muito boa mas sabia que gostava daquilo e continuei. Depois apareceu o Java. Estudei e apanhei muito dessa linguagem, aprendi JSP e até fiz um CRUD mas aí apareceu o PHP. Junto dele veio o combo HTML e CSS e foi muito legal até eu descobri o Ruby e o Ruby On Rails. Mas também tinha o Python e o Django. Desisti de tudo isso e comecei com app mobile. Fui programar Java pra Android e tava muito bom até aparecer uns iMac's na escola que eu estudava e eu resolvi aprender Objective-C...

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

Foram vários anos fazendo hello world e pequenos CRUD's e nada além disso até que eu desisti de tudo.

# A decisão

Depois de 4 anos longe de programação e de tudo que fosse relacionado a isso, eu decidi que em 2020 eu iria voltar a fazer o que eu gosto. Não foi fácil tomar essa decisão. Sou mulher, tenho 32 anos e tenho dificuldade para aprender. Porém, a vida é só uma e eu não podia mais deixar que os meus medos acabassem me limitando. O ano de 2020 seria o meu ano de recomeço mas aí veio o Covid 19 e a quarentena...

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

Foi um baque no começo mas aí enxerguei uma oportunidade.

# O recomeço em meio a uma pandemia

Em março eu comecei a trabalhar em casa e acabei por ganhar o tempo de locomoção até o trabalho e o utilizei da melhor maneira possível. Nesse tempo de isolamento as pessoas fazem muitas coisas legais na internet e umas delas foram a QuarentenaDev, Semana Omnistack 11.0, Reboot, ImersãoCSS e vários outros. Foram eventos tão bons que eu até ganhei uma bolsa do Bootcamp Launchbase da Rocketseat. Essas lives com certeza deeram um gás a mais na minha decisão de voltar a estudar e agora bem mais focada.

# HTML, CSS e JavaScript

Eu vou começar meus estudos com o trio do front-end.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/fs654jt8vuveo2jkc1ve.jpeg)

Vou estudar HTML, CSS e JavaScript a fundo e esquecer as outras linguagens por enquanto. Vou utilizar os recursos disponíveis na internet e praticar bastante. Esse blog vai servir como meu diário de estudos e servirá para mostrar a minha evolução.

Então, vamos lá!
Como evitar dores de cabeça com uma boa arquitetura de software
Tags: architecture
Published: 2020-06-01 01:45:53

<!-- start question! -->

**Você já trabalhou em sistemas que qualquer mudança, por mais trivial que fosse, se tornou uma dor de cabeça?**

<!-- end question! -->

<!-- start answer -->

Uma boa arquitetura de software pode te poupar futuras dores de cabeça com escolhas prematuras de tecnologias em um ambiente de constante mudança.

<!-- end answer -->

<!-- start problem -->

Engenheiros de software em geral gostam dos detalhes, de sair implementando e adotando tecnologias prematuramente em nome da "produtividade", sem se darem conta que essas decisões podem tornar as coisas mais difíceis de serem alteradas.

> Fazer bagunça é sempre mais lento que manter tudo limpo. 
[Robert C.Martin](https://blog.cleancoder.com)

<!-- end problem -->

<!-- start solution -->

Pensar em arquitetura de software nos faz escolher soluções mais maleáveis, adiando decisões técnicas pelo maior tempo possível.

O objetivo é separar regras de negócios estáveis de detalhes técnicos voláteis, tornando as coisas fáceis de serem testadas e refatoras sem quebrar tudo. 

> Um projeto mais fácil de ser alterado é melhor que um projeto menos fácil de ser alterado. 
[Otavio Lemos](https://otaviolemos.github.io)

<!-- end solution -->

A interface do usuário, o banco de dados e a comunicação com outros sistemas são implementações que podem ser isoladas. Respeitar as fronteiras de cada camada de uma arquitetura ajuda a minimizar dores de cabeça futuras.

> A única maneira de seguir rápido é seguir bem. 
[Robert C.Martin](https://blog.cleancoder.com)

<sub><sup>Foto de [Igor Starkov](https://www.pexels.com/pt-br/foto/aco-alto-andaime-ao-ar-livre-1117452/) no [Pexels](https://www.pexels.com/pt-br).</sub></sup>
Should I run JVM applications inside a container?
Tags: scala, java, docker, aws
Published: 2020-06-01 01:42:39

So I made this presentation for a "tech talk" at work, but it was really to help myself better understand JVM applications - how they run and if we should use containers.  

I'm pretty new to Java, so a part of this is on how the JVM works - and comparing Scala to other languages.

I posted the [full video here (25 mins)](https://youtu.be/N688mgd6ipY) but the slides are below with some notes.

Hopefully someone finds this useful.  If you see any errors, or glaring omissions, please let me know.

----

##### 1. JVM languages (like Java and Scala) are similar to other scripting languages (like Python and Javascript) in how it is run.
> ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/2i52zha0529xjkptm6ok.jpg)

----
##### 2. Hypervisors (like Virtual Box) allow another operation system to run on top of your computer.
> ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/pkjl76qy693xv0didrud.jpg)

----

##### 3. The type of hypervisors that cloud providers (like AWS) use are installed directly on their hardware, but are similar to Virtual Box.
>![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ah8dsyz0d8rx6z6hcquw.jpg)

----

##### 4. Containers are a native Linux feature that uses "namespaces" and "cgroups" to manage isolated processes.
>![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/opyftf34umv3r6buywoz.jpg)

----

##### 5. VMs tend to be a lot larger than containers because they include the operating system.
>![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/8an6ufxdiy0mh33xkizm.jpg)

----

##### 6. Containers can potentially better compute efficiency because they are able to share the same kernels.
>![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/80zex668ya7a6ysjpn79.jpg)

----

##### 7. The JVM did not "support" containers until 4 years after Docker was released.  Java is still seen as 
>![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/mde0h8vowgjqiyoy766v.jpg)

----

##### 8. The JVM requires a different standard C library than the one packaged by Alpine (the most popular Linux distribution with containers).
>![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/oiz7f6y81hevddhwk0i2.jpg)

----

##### 9. In conclusion ...
>![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/4z85vukw1kpemrqthtp9.jpg)
Headless Testing with Vite + Vue-Test-Utils
Tags: vue, vite, headless, javascript
Published: 2020-06-01 01:30:59

**[Vite](https://github.com/vitejs/vite)** is an opinionated web dev build tool that serves your code via native ES Module imports during dev and bundles it with Rollup for production.

**[Vue-Test-Utils](https://vue-test-utils.vuejs.org/)** is a utilities for testing Vue components 

**[Aria-Vue](https://github.com/aelbore/aria-vue)** is a testing tool for Vue components, it can run your test in headless or browser mode

## Table Of Contents
   * [Getting Started](#getting-started)
   * [Adding Test](#adding-test)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/h6msgnbbi6b3e3fxi0xw.gif)

### Getting Started <a name="getting-started"></a>
 * Lets create a folder `mkdir vue-testing`
 * `cd vue-testing` then `npm init -y`
 * Install dependencies
 ```
 npm install vue@3.0.0
 npm install vite @vue/compiler-sfc@3.0.0 --save-dev
 ```
 * Create `./src/App.vue`
 ```javascript
 <template>
   <p>
     Hello world!
   </p>
 </template>

 <script>
 export default { }
 </script>

 <style scoped>
 h1, p {
   font-family: Arial, Helvetica, sans-serif;
 }
 </style>
  ```
* Create `./src/main.js` root director
```javascript
import {createApp} from 'vue'
import App from './App.vue'

createApp(App).mount('#app')
```
* Add `index.html`
```html
 <!DOCTYPE html>
 <html lang="en">
 </head>
   <body>
     <h1>⚡️ Vite Component Test Starter</h1>
     <div id="app"></div>
     <script type="module" src="./src/main.js"></script>
   </body>
 </html>
```
* Update or Add scripts to your `package.json` file
```
  "scripts": {
    "serve": "vite",
    ....
  }
```
* Now we can run our application to make sure everything is working.
```
npm run serve
```

### Adding Test to your application <a name="adding-test"></a>
 * Install dependencies
  ```
  npm i --save-dev @vue/test-utils@2.0.0-beta.5 aria-vue aria-mocha puppeteer
  ```
 * Let's create test file `./test/App.spec.js`
 ```javascript
 import {mount} from '@vue/test-utils'
 import App from '../src/App.vue'

 describe('App.spec.js', () => {
  it('renders', async () => {
    const wrapper = mount(App, { attachTo: '#root' })
    expect(wrapper.html()).to.contain('Hello')
  })
 })
 ```
* Update or add scripts to your `package.json` file
 * `-w` option is to watch your `src` and `test` folder, then re-run the test
 * `-H` option is to run your test in headless mode
```
 "scripts": {
    "serve": "vite",
    "test": "aria-vue -w -H"
  },
```
* Now we can run our test in headless mode
```
npm test
```
A simple screensharer
Tags: javascript, express, node, chile
Published: 2020-06-01 01:14:08

---
title: A simple screensharer
published: true
description: This is a simple script to solve a simple problem for taking turns in public services
tags: javascript,express,node,chile
//cover_image: https://direct_url_to_image.jpg
---

This is a simple script to solve a simple problem for taking turns in public services.

https://github.com/NinjasCL/screensharer

In many places you have to take a turn and wait there until your number is reached. Many of these systems work by using a computer and specialized software.

The problem is, that information is not shared online. This simple solution just takes a screenshot and share that file in a website that could be viewed online and is refreshed every 15 seconds.

You still need to be present to take your number, but at least you can see the current status and not be required to be on site if your number is far to be reached.