teleren/devto huggingface dataset:
Day 69 : Ain't Nothing
Tags: hiphop, code, coding, lifelongdev
Published: 2020-01-14 22:45:09

**So I forgot to post yesterday. Got pretty busy.**
_liner notes_:
- Professional : Went through the itinerary for next week in Miami. We'll be doing a lot of cool things. Looking forward to it. Today, I just continued working on some research.

- Personal : Yesterday, I gave a full talk at the January Orlando Devs meetup. It's been a minute since I gave a talk that wasn't a lightning talk. Everyone seemed to like it. The topic was Web Components which I've been researching for a while for work. What people really liked was the website I made for people to follow along with my slides. haha I can advance the slides from my computer and I have speech recognition that posts what I say and it shows up on the website. It was a good night. Got to talk with some awesome folks.

{% twitter 1216880508250001408 %}

![View of a mountain from the ocean in Kālepa Ridge, Hawaii, USA](https://thepracticaldev.s3.amazonaws.com/i/snyt6yqqticpxakbkxtm.png)

So yeah, I'm sick and been trying to rest up and get better. Ain't nothing worse than going to Miami sick. For the rest of the night, I'm going to see if I can catch up on some work before next week.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube Lfv8bgJN4Xo %}
How can i config tests in nodejs api with jest
Published: 2020-01-14 22:42:07

Before we start the config we need to now some things:

# Why test my app? 🤔

To make your service scalable, and more consistent!

# What is jest? 💭

Because is the most complete and easy to use!


First of all you need to installing the packages below on your project:

- Jest the test framework:
  
 ```bash
  yarn add jest -D
 ```
- jest types is a inteliscense to use jest:

 ```bash
  yarn add @types/jest -D
 ```
- Supertest is a framework to simulate http requisitions:

 ```bash
  yarn add supertest -D
 ```

Now we need to make initial jest config.

To do that we execute the command below:
 
 ```bash
  yarn jest --init
```

After that the console make some questions to you, you need to answer like the image below:

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/nxkfsnq0v8g2a970jqdc.JPG)

Now you will find a file called "jest.config.js" on your root project.

The next step is ajust this config file like below:

 - Bail is the option we set to define the number of errors that make the tests break, in this case i always like to set one:

```javascript
 bail: 1,
```

 - Clearmocks is the option that clear mocks after tests, this option we set true:

```javascript
clearMocks: true,
```

- collectCoverage this option enable or disable the coe coverage, i like to set as true:

```javascript
collectCoverage: true,
```

 - collectCoverageFrom this option define the path or file s to collect the coverage, usually i set the path where stay my business logic:

```javascript
collectCoverageFrom: [
    'src/app/Controllers/*.js',
  ],
```

 - coverageDirectory is the place where jest can put the coverage result, i usualy put coverage inside the test folder:

```javascript
 coverageDirectory: '__tests__/coverage',
```

- coverageReporters this option set the type of reporters for coverage result, i like to user reports below:

```javascript
 coverageReporters: ['text', 'lcov', 'json'],
```

- testMatch this option set the test files extensions:

```javascript
  testMatch: ['**/__tests__/**/*.test.js'],

```

Now we can create the folder structure as the image below:

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/h820vkbzc7w0hxrvdi4z.JPG)

And that is it, now you reandy to starting test your api with jest!

![Alt Text](https://media.giphy.com/media/cI45LEPRoFQhLVq7AB/giphy.gif)
Learning Vanilla Javascript in 2020 & others part 1
Tags: javascript, webdev, hiring
Published: 2020-01-14 22:35:51

"BECAUSE MODERN WEB DEVELOPMENT IS DOMINATED BY FRAMEWORKS -Market trend"


Obviously the trend here and there is that every developer most jump from writing vanilla javascript or any other programming languages majorly, to writing a framework because thats the market trend now.

What’s do you think about this trend ?

Comment your view below, you are all welcome 😊😊
Django 3 Tutorial & CRUD Example with MySQL and Bootstrap
Tags: python, django, bootstrap, mysql
Published: 2020-01-14 22:20:59

Django 3 is released with full async support! In this tutorial, we'll see by example how to create a CRUD application from scratch and step by step. We'll see how to configure a MySQL database, enable the admin interface, and create the django views.

We'll be using Bootstrap 4 for styling.

You'll learn how to:

Implement CRUD operations,
Configure and access a MySQL database,
Create django views, templates and urls,
Style the UI with Bootstrap 4

## Django 3 Features

Django 3 comes with many new features such as:

- MariaDB support: Django now officially supports MariaDB 10.1+. You can use MariaDB via the MySQL backend,
- ASGI support for async programming,
- Django 3.0 provides support for running as an ASGI application, making Django fully async-capable
- Exclusion constraints on PostgreSQL: Django 3.0 adds a new ExclusionConstraint class which adds exclusion constraints on PostgreSQL, etc.

Read [full tutorial](https://www.techiediaries.com/django-3-tutorial-and-crud-example-with-mysql-and-bootstrap/)
5 Easy Ways to Recognize Who Your Developer Super Fans Are
Tags: advocacy, developerrelations, developermarketing
Published: 2020-01-14 22:08:47

---
title: 5 Easy Ways to Recognize Who Your Developer Super Fans Are
published: true
description: Your company has super fans, it’s a guaranteed, known fact. You would already be out of business by now if it wasn’t true. So how do you find them so that you engage with them and leverage them for good?
tags: advocacy, developer relations, developer marketing
---
Your company has super fans, it’s a guaranteed, known fact. You would already be out of business by now if it wasn’t true. So how do you find them so that you engage with them and leverage them for good?

##NET PROMOTER SCORES
The customers that answer with a 9 or 10 on a scale of 1-10 are your super fans. These are the customers that are the repeat buyers and excited about your product. They are the customers that you need in your back pocket for future campaigns that your company may be focused on. These are the users that you should get to know, leverage and spend time engaging with them on a routine basis.

You can learn more about Net Promoter Scores in our other blog post, What is a Net Promoter Score?

##SOCIAL LISTENING
Developers spend a bunch of their time on the internet. If they are not ones to use social media platforms, at the very least they are spending time on Stack Overflow or Reddit to get an answer to their latest development hurdle. By utilizing a social listening platform, you can start to monitor and track people who are talking about your product. There are a number of low-cost options out there, like Mention & Awario. Start listening, because your customers are talking, somewhere, online.

##YOUR COMMUNITY
Your company’s online community platforms are going to be a fabulous place to start looking for your super fans. Community platforms may include places like Slack, a Facebook Group, Community or Support Forum and more. It’s pretty likely that your super fans are a part of these groups and they are usually the ones that are helping other customers find the answers they need. Dig deep into the metrics of your platforms to find the users that post the most, spend the most time there or answer the most questions — these are your super fans.

##GOOGLE
Search for your product or service—after your own results, what comes up next? Are there tutorials, blog posts, videos and other content focused around your product? I can guarantee there is. Spend time searching for this content and figure out who is producing it and what motivated them to do so. 

##ONLINE DEVELOPER COMMUNITIES
While you are searching Google, you will likely find results from various developer communities, like Stack Overflow. If your product or services cater to developers, then you are bound to find your super fans answering questions in places like Stack Overflow. Do a site search on StackOverflow, Reddit, Quora & Dev.to—your super fans are likely lingering in there somewhere.

You have super fans and you can do some powerful things with them.
[video] Your gateway to start using vim today
Tags: vim, linux, ubuntu, devops
Published: 2020-01-14 21:53:10

Your gateway to start using vim today. A start of a series with an 8 minutes video guiding you into getting comfortable with vim,
and to use the basic commands to edit and save files. Upcoming lessons will have more usecases and customizing vim to fit your needs.
Share and subscribe if you would like to support or me, or want to get more of this short tutorials!

feedback is much appreciated!

{% youtube y6knzc5aB28 %}
How often do you save per minute?
Tags: watercooler
Published: 2020-01-14 21:53:02

I got reminded of my time as a trainee today. My dad and I were writing something and because I "can write faster on the computer" I was doing the texting and he just told me what to write.
After a while he asked me if I'm afraid of a power outage or something because he noticed that I pressed `CTRL+S`after almost every word I typed.

Started to think of it and came to the conclusion that I do this since I was tasked to write a recursive algorithm to create a maze during my trainee time and lost 6 hours of work because I forgot to safe the file 🤦‍♂️

So when you think of your daily routine, **how many times per minute do you save whatever file you have currently open?**


Fun fact: sometimes it's like a reflex and I press it in chrome accidentally and get angry because the "save website as..." dialog pops up!
Should i use an ORM? When to use it? Which one?
Tags: help
Published: 2020-01-14 21:10:10

Hey everyone,

i am currently working on a private project to get my nodejs skills a bit developed. I am trying to create an api with express and use a postgres db to store data. Nothing fancy here, just creating some users and stuff. 
My question is: Should i use an ORM? Sure for that small case queries will do the work for me but what about more complex projects with bigger sets of data? I don't want to start a discussion or something just get a hint.

Thanks a lot
Adding Google Sign In to your Web App with AWS Amplify
Tags: aws, webdev, oauth, authentication
Published: 2020-01-14 21:01:08

---
title: Adding Google Sign In to your Web App with AWS Amplify
published: true
description:  How to create and configure Google sign in / OAuth with AWS Amplify for your next web application.
tags: aws, webdev, oauth, authentication
---

In this 8 minute video, you'll learn how to create a new Google app ID, create an authentication service with AWS Amplify, and enable sign in with Google in a web application.

Whether you're using React, Vue, or Angular, this guide will get you up and running in just a few minutes.
Difference between v-if and v-show in Vue.js
Tags: vue, devcommunity, javascript
Published: 2020-01-14 20:47:17

---
title: Difference between v-if and v-show in Vue.js
published: true
description: Learning Vue.js and confused about the usage of v-if and v-show?
tags: #Vuejs, #devCommunity, #JavaScript 
---


🔍 **v-if** and **v-show** are Vue.js directives and they are used to show the information depending upon certain conditions that are defined by the user

👉 In case you're not familiar with Vue.js directives, they are just like HTML attributes but they're always prefixed with v- which is the indication that they're special attributes provided by Vue.js. They apply reactive behavior to DOM. 

👨‍💻 Let's learn the difference between two with some code:

## v-if
Let's suppose we have this piece of code
```html
<div id="app">
  <span v-if="show">Learning about v-if</span>
</div>

```
```js
var app = new Vue({
  el: '#app',
  data() {
    return {show: false}
  }
})
```

In the **v-if** case, the element will only be rendered and inserted into DOM if the condition is true. If the condition is false and we check the DOM elements in the browser we'll notice that there is no element. But as we turn the condition to true, it's added to DOM. So, each time, depending upon the condition, there are DOM manipulations.

## v-show
```html
<div id="app">
  <span v-show="show">Learning about v-show</span>
</div>

```
```js
var app = new Vue({
  el: '#app',
  data() {
    return {show: false}
  }
})
```
The element With **v-show** will always be rendered and it is present in the DOM but the CSS property **Display: none** will be toggled by v-show depending upon the condition.

##🤔Which to use?

There are different use cases for both. As we've learned that with **v-if** the element unmount and remount depending upon the condition and there is so much work to do for DOM manipulations. But with **v-show** it just stays in the DOM there is not much work to do, so it's more performant.
Run Windows update now!
Tags: windows, security, patch, windowsupdate
Published: 2020-01-14 20:41:49

Microsoft have released a patch through Windows Update for
* [CVE-2020-0601](https://kb.cert.org/vuls/id/849224/) - Windows doesn't properly validate X.509 certificate chains. 
* CVE-2020-0609, CVE-2020-0610 - Windows Remote Desktop Gateway (not to be confused with RDP proper) unauthenticated RCE.

Some pretty serious certificate handeling issues. If you are using Windows OS, do everyone around you a favor and run Windows Update, install the [KB4528760](https://support.microsoft.com/en-us/help/4528760/windows-10-update-kb4528760) update and stay secure.

[Microsoft fixes Windows crypto bug reported by the NSA](https://www.zdnet.com/article/microsoft-fixes-windows-crypto-bug-reported-by-the-nsa/)
Connect your node backend to postgresql database
Tags: node, javascript, postgres, sql
Published: 2020-01-14 20:22:39

1. npm init -> entry point: server.js

2. create file "server.js" in project root

3. npm install express pg nodemon

4. in package.json add script "start":"nodemon"

{
  "name": "server",
  "version": "1.0.0",
  "description": "",
  "main": "server.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start":"nodemon"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.17.1",
    "nodemon": "^2.0.2",
    "pg": "^7.17.1"
  }
}

5. in project root -> make folder "config"

6. make folder db.js and add the following

const { Pool, Client } = require("pg");

const pool = new Pool({
  user: 'postgres',
  host: 'localhost',
  database: '',
  password: '',
  port: 5432
});

pool.connect(err => {
    if (err) {
      console.error('connection error', err.stack)
    } else {
      console.log('connected')
    }
  });

7. in file server.js add following

const express = require('express');
const app = express();
const pool = require ('./config/db');

const PORT = process.env.PORT || 5000;
app.listen(PORT, () => {
console.log(`Listening to port: ${PORT}`);
});


8. npm start
Can a “native” WordPress site be JAMstack?
Tags: jamstack, jamuary
Published: 2020-01-14 20:01:14

WordPress sites are dynamic by design. For every page request, the server needs to run some PHP, alongside the necessary database queries to build out all assets associated with that page. Architecturally, this approach is in direct contrast to the JAMstack which champions serving sites statically via a CDN. A common approach to migrating to the JAMstack without fully abandoning WordPress ([as was highlighted in a previous post](https://dev.to/shortdiv/is-jamstack-antithetical-to-wordpress-2a55)) is to use it as a headless CMS via the WordPress REST API and a static site generator on the frontend. This technique means using WordPress solely for its content editing experience and shirking its rich ecosystem of themes and plugins in favor of those built into specific static site generators. 

The conviction to use WordPress lies in its giant, all encompassing ecosystem of plugins and themes. Convincing users to stop using many of these features that they’ve grown to love in the spirit of speed, security and maintainability is undeniably a hard sell. Thankfully, continuing to use WordPress while benefiting from the JAMstack approach doesn’t mean only using it as a headless CMS. WordPress can be used as a static site generator in and of itself so you can still benefit from the speed and security that comes with pre-rendering your assets without giving up the power the WordPress platform provides. The principle of this approach is quite straightforward; a static site is generated at build time and utilizes serverless functions to run the entire WordPress install and build configuration; users only see the static output of your site while the full WordPress install lives on a separate hidden domain that gets run on build time. With this setup, you get the speed of a static site without having to drastically change the architecture of your WordPress setup. A caveat to continuing to use WordPress plugins with this setup is that you'll now have to check that plugins you're using are compatible with static site generation. This is because many native WordPress plugins like search and comments may require dynamic access to the database, which is not possible with this setup. 


If all this sounds like magic, check out the [That’s my Jamstack podcast episode featuring David Olson](https://thatsmyjamstack.com/posts/daniel-olson/) to learn more about this setup and how native WordPress can be made JAMstack.
Lab HashStack - Part 1
Tags: devops, security
Published: 2020-01-14 19:52:50

In this post the idea would be to set up a Lab for studies using Hashicorp solutions, such as [Terraform](https://www.terraform.io/), [Vault](https://www.vaultproject.io/) and [Consul](https://www.consul.io/) in the construction of Stack.
We will use Consul with the Service Discovery feature and will also strengthen the security of our stack by using Acl's by restricting any attempts to access services below it without a valid token.
The vault's role is to provide the login security of our Cassandra DB and Rabbitmq with the dynamic secrets feature.
Traefik we will use to do load balancing between servers.
The terraform remote state will be using Terraform Cloud.

####Requirements:
- Terraform 11.4
- Vault
- Consul
- Docker

####Step 1:
Create Account Terraform Cloud.
https://www.terraform.io/docs/cloud/free/index.html

Generate your Token:
https://app.terraform.io/app/settings/tokens

Add on the home directory a file terraformrc with credentials:

```bash
cat <<EOF >~/.terraformrc
credentials "app.terraform.io" {
  token = "REPLACE_ME WITH TOKEN GENERATE"
}
EOF
```
####Step 2

Download the repository on github
https://github.com/laund/redstack_terraform_public

####Step 3 - Deploy Stack

```bash
terraform apply -target=module.network

terraform apply -target=module.traefik
```

Access url http://traefik.redstack.local:8081 in your browser for validate.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/6zxg69x6zsaaoiyvymvp.png)


After validation we follow with the deployment of Consul.

```
terraform apply -target=module.consul_cluster

docker exec -it consul-server-1 /bin/sh

consul acl bootstrap

export CONSUL_HTTP_TOKEN=<SecretID>

exit
```

In the file variables.tf add your "SecretID".

```
variable "consul_token" {
  default     = "<SecretID>"
  description = "Secret ID"
}
```

In the next step, configure Acl's for the services that will be part of Consul Server.

```
terraform apply -target=module.consul_runtime
```

Access url http://consul.redstack.local:8500 in your browser and insert SecretID.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/logt4wyeul8h31pb8ahl.png)

In the ACL menu you can view the Acl's created with terraform.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/mhj3un10o67mjdprxehl.png)


Access the container again and run the following command:

```
docker exec -it consul-server-1 /bin/sh

export CONSUL_HTTP_TOKEN=<SecretID>

consul acl set-agent-token default "<Agent Consul Token>"
```

First part completed, in the next article we will continue to deploy the rest of the services :)
Going Beyond Uptime Monitoring
Tags: aws, wordpress, webdev, devops
Published: 2020-01-14 19:43:14

In 2020 it is common knowledge that slow websites poorly affect revenue, brand loyalty, and conversions. Do you know what impacts conversions even more?

Outages!

An unreachable website can’t generate new conversions, revenue, or brand loyalty.

There are a wide variety of services that help monitor WordPress sites from different locations in the world. Most of these services access your site every minute and generate an alert if the site is unreachable. While you can’t go wrong with any of these services, I prefer uptimerobot. The number of false positives is minimal with uptimerobot, plus they have a generous free tier.

Uptime monitoring, in combination with server alerts, is sufficient for most small to medium-sized sites. Afterall there aren’t many things that can go wrong on a single-server setup.

But what happens as your site grows and you move to a distributed setup?

Imagine scaling your site across 200 containers on Kubernetes. 198 of these containers are healthy. Remaining two containers, while active, are returning HTTP 200 responses with white pages to all visitors. In other words, most visitors and uptime monitoring services can access your site just fine, but a small number of visitors see blank pages.

How do you find out about the two faulty containers? You can’t wait for visitors to complain, only to have the Ops team respond, “It works on my machine!”.

This is where you need to go beyond uptime monitoring. In high-availability and distributed hosting environments, transaction monitoring becomes essential.

You can do this using a combination of real user monitoring (RUM) and APM insights using a service like New Relic.

RUM monitors and logs each visitor’s browser timing. RUM helps measure website response time across different browsers, regions, and devices. APM is integrated with PHP to analyze, profile, and logs each transaction. APM helps you measure the response time for uncached pages on your site and transactions such as signups, checkouts, and more.

Services like New Relic support setting up custom events for RUM and APM. For example, you can set up an alert if the response time is more than 3 seconds for any visitor or if the bytes transferred are below 1 Kb for logged-in users.

Utilizing RUM + APM based monitoring can help you catch edge cases and significantly minimize the troubleshooting time. Throw container monitoring in the mix, and you get excellent visibility into the high-availability environment that powers your site.