teleren/devto huggingface dataset:
Atalhos no Git
Tags: git
Published: 2020-04-26 02:30:31

Durante o trabalho utilizo o terminal para executar comandos do git, porém percebo que muitas vezes utilizo o mesmo **comando repetidamente**. Durante o Gitflow repetimos comandos git como checkout, status e log, para facilitar podemos utilizar apelidos (alias). Edite o arquivo **~/.gitconfig**

A própria documentação do git fornece alguns apelidos básicos, vejamos:
```
st = status
br = branch
co = checkout
cm = commit
```

Essa técnica se torna poderosa e útil, pois permite criar comandos um pouco mais complexos:
```
Retirar do stage um arquivo
    unstage = reset HEAD --
O log do último commit:
    last = log -1 HEAD
Log personalizado:
    lg = log --all --graph --decorate --oneline --abbrev-commit
```
Podemos também adicionar comandos externos.
```
Chamada de um programa
    visual = !gitk
Push para a branch atual:
    current-branch = rev-parse --abbrev-ref HEAD
    push-to-current-branch = "!git push -u origin $(git current-branch);"
```
Os comandos que vimos até agora apenas facilitam nossas tarefas mas não as automatizam. Seguindo o fluxo do **gitflow**, após commitar nossas mudanças na branch feature, temos que levar as mudanças para branch dev. Então vamos criar um comando chamado **merge-and-push-to-dev-branch** que facilitará esse processo.
```
Auxiliar:
    aux = "!f(){ git checkout dev && git pull && git merge \"$1\" && git push -u origin dev; }; f"
Merge da branch com dev:
    merge-and-push-to-dev-branch = "!git aux $(git current-branch)"
```

O arquivo **~/.gitconfig** da seguinte forma:
```
[user]
        email = email@email.com
        name = Seu Nome
[alias]
        st = status
        br = branch
        co = checkout
        cm = commit
        unstage = reset HEAD --
        visual = !gitk
        last = log -1 HEAD
        lg = log --all --graph --decorate --oneline --abbrev-commit
        current-branch = rev-parse --abbrev-ref HEAD
        push-to-current-branch = "!git push -u origin $(git current-branch);"
        aux = "!f(){ git checkout dev && git pull && git merge \"$1\" && git push -u origin dev; }; f"
        merge-and-push-to-dev-branch = "!git aux $(git current-branch)"

```
Então você tem alguma dica? Algum processo que gostaria de ser automatizado?
Dev.to/Twilio Hackathon: Rocket Launch bot (Part TWO)
Tags: twiliohackathon, java, bot
Published: 2020-04-26 02:02:04

---
title: Dev.to/Twilio Hackathon: Rocket Launch bot (Part TWO)
published: true
description: Progress on my Twilio hackathon
tags: #twiliohackathon #java #bot
---

Oh well, this was kind of a wild ride I guess.

# Using Twilio bots
Twilio has a great feature called Autopilot, where you can create bots trainable AI bots that parse the messages based on the user and groups it by intent (works similarly to Dialogflow).

In theory you could build fully fledged out bots by using features provided by Twilio, Functions and Autopilot. But as I wanted to implement my Java wrapper we'll be using only one of the two.

# Collecting intent to respond with desired information
For parsing what "type" of request the user intends we are using field types and making samples to our collect task to train it.

![type](https://this-is-a.bad-me.me/5et7usX.png)

After collecting what type of request the user wants to make, we just use a web-hook to our Java application.

# Ending
With these, we can have our project set up with only a couple of tasks and only one field type.

![tasks](https://this-is-a.bad-me.me/32qJpzw.png)

# Links
- [Collect task](https://github.com/NahuLD/launch-twilio-bot/blob/master/src/main/resources/collect.json)
- [Project](https://github.com/NahuLD/launch-twilio-bot/)
My Hackathon Project - Better Late Than Never
Tags: twiliohackathon, mexico
Published: 2020-04-26 01:41:52

I fins interesting that now that we are forced to stay at home (global pandemic) it is extremely hard to find time and to get things done. But i now added a tone of post-its to my computer to slap my face (stay focus) and get things done. I only have at the most 15 hours to complete this project (full time job + sleep + eat + home tasks) 

You can find attached my project in a simple diagram with a simple overview of the user flow, the data to capture and the services i want to use.

So guys wish me luck.
User info not stored in firestore using Redux action object
Tags: react, redux
Published: 2020-04-26 01:41:11

Hi there,

I got a problem with my signUp function, which is a Redux action object called when a user submits a signup form: While a user was successfully created in my firebase authentication page, the user info did not get stored into firestore. I used to place the exact same code for storing user info in firestore in the signup component without using Redux, and it worked fine. I am wondering what might cause the problem. Thanks!

![signUp Redux action object](https://dev-to-uploads.s3.amazonaws.com/i/sspbk1eyrpfg13ok4q4a.png)
Neehow -- Online Learning Chinese
Tags: chinese, learnchinese, python, neehow
Published: 2020-04-26 00:59:19

#Neehow -- Online Learning Chinese

![img](https://miro.medium.com/max/2000/1*-mYkzTBHv2KesNOT5nuH3A.png)

Hi, I'm BM Lee, the founder of Neehow (https://nee.how). I hope Neehow can help more people learn Chinese,  no matter where they are. Much appreciated if you can tell others this message and I will offer them a free learning package. Thanks for reading this message. 

Neehow is an educational platform for learning Chinese online. It uses artificial intelligence technology and speech recognition algorithms to automatically score users, analyzing from four dimensions: pronunciation, intonation, accuracy, and completeness. Because there is no manual intervention, users can learn anytime, anywhere, without any restrictions.

![img](https://miro.medium.com/max/2000/1*s49sISN3A2Yab_DXoENVxA.png)
![img](https://miro.medium.com/max/2000/1*cN-0tmD7GkA2jkI1ZKIQTQ.png)

Neehow 是一个线上学习中文的教育平台。它使用人工智能技术和语音识别算法来自动给用户评分，从发音、语调、准确度和完整度四个维度分析。因为没有任何人工干预，用户无论在何时何地都可以学习，没有任何限制。
Move/Install WSl distro from C drive to another drive
Tags: windows10, wsl, linux, programming
Published: 2020-04-26 17:50:26

---
title: Move/Install WSl distro from C drive to another drive
published: true
date: 2020-04-26 00:00:00 UTC
tags: Windows10,wsl,Linux,Programming
canonical_url: https://www.jskap.com/blog/move/install-wsl-distro-from-c-drive-to-another-drive/
---

!['cover'](https://kapilgorve.s3.ap-south-1.amazonaws.com/blog/covers/wsl.jpg)

I have a small 128GB SSD. I run out of space when I install ReactNative related dev tools. So I wanted to find a way to install/move my existing distro to different location than C drive.

## Move WSL to another drive[<svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg>](#Move-WSL-to-another-drive)

- Install `LxRunOffline` tool. `choco install lxrunoffline`
- 

`lxrunoffline list` List all the installed distros on your system. I get output like this.

```
Microsoft Windows [Version 10.0.19041.207]
(c) 2020 Microsoft Corporation. All rights reserved.
D:\work>lxrunoffline list
Ubuntu-18.04
docker-desktop
docker-desktop-data
D:\work>
```

- `lxrunoffline move -n Ubuntu-18.04 -d G:\wsl\` . Move your distro to another drive. My distro name here is `Ubuntu-18.04`. I am moving it to `G drive` and `wsl` folder inside it. It would take some time to finish moving.

You can use the same move command to move your distro from default location to a different location inside C Drive.

  

👋 Hi! I’m Kapil. I am always chatty about building things, sharing my learnings, freelancing. Come say hi to me at [https://twitter.com/kapilgorve](https://twitter.com/kapilgorve)
Got New Rdoc Merged into Ruby Core!
Tags: ruby, documentation
Published: 2020-04-25 23:57:07

---
title: Got New Rdoc Merged into Ruby Core!
published: true
description: 
tags: ruby, documentation
---
[Previously I put this onto Jess's "What Was Your Win This Week?" thread, but also wanted to share here on Ruby.]

Over at Reddit/r/ruby, @ioquatix, on the Ruby core team, saw my plea about reviews and merges for the enhance documentation I've been building for Ruby.  He's taken an interest, and is working with me to get things moving.

- [Now in review](https://github.com/ruby/ruby/pull/3056/files):  Revision of entire intro to <code>Hash</code> (except what I'd already revised).
- [Merged yesterday](https://github.com/ruby/ruby/pull/3026/files):  <code>Hash::[]</code> along with a new doc "Implicit conversions."
- [Merged earlier](https://github.com/ruby/ruby/pull/3002/files):  <code>Hash.new</code> and <code>Hash::try_convert</code>.
- [Merged earlier](https://github.com/ruby/ruby/pull/2977/files):  New section "Default Values." (Thanks, @nobu.)

In my AboutRuby project I have doc patches for all methods in [Hash](https://github.com/BurdetteLamar/AboutRuby/blob/master/core/Hash/api/markdown.md#hash-api), and for all but the last two in [Array](https://github.com/BurdetteLamar/AboutRuby/blob/master/core/Hash/api/markdown.md#array-api).

TL;DR [Previous lament]

I've been working on enhancements to the documentation for the Ruby project.  Getting these enhancements posted to the Ruby project has been very slow.  They're not actually meeting resistance;  I know because my many PRs for enhancing class ENV were accepted (though not rapidly).  It's just that everyone is busy.

Anyhow, I'm stashing all this stuff on in my own project, called AboutRuby.  The piecemeal migration from there to the Ruby project is not going to be completed in my lifetime (I'm 77 years old).
Meet .map() the Invaluable JavaScript Array Method
Tags: javascript, iteration, productivity, arrays
Published: 2020-04-25 23:24:32

There are several ways one can iterate over data with JavaScript. The tried and true for loop, .forEach(), .filter(), etc. However, depending on what you need to accomplish, I have found the .map() method to be especially useful, and it is one I return to again and again. If you need to iterate over an array of data, transform its elements, and return a new array, .map() should be your go to method. 

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

In the above example we have an array of numbers, and for each number in the array we would like to increment that number by ten. 

Using the .map() method all we have to do is return the value of each number and add ten to it. The .map() method will return a new array with new values, leaving the values in the original array unchanged. 

One extremely important detail is that the .map() method always takes a function definition as its first parameter. As seen in the above code example, the function has three arguments available to it. These arguments are called for each element in the array, and the return values that the function creates will become the data inside the new array.  

I hope this explanation of .map() has been helpful. I find myself using .map() all the time in my own projects, especially as I've been diving deeper into JavaScript and React. Happy coding!
Getter and Setter with Typescript
Tags: typescript, javascript, oop, codenewbie
Published: 2020-04-25 23:11:55

The encapsulation is an important part of OOP and Typescript support gets and sets keywords for members of classes.

The encapsulation can be used with the *get* and *set* keywords, before a function name, then using it we can encapsulate some logic and use our private fields to manage the state.

I will do a small example of how to use get and setter for encapsulating logic for public fields and keep the state with a private field.

The example is the class Student with a private location private field to save the location.

Typescript 3.8 allows creating private fields using # or with the private keyword.


```javascript
class Student {
    #location: string;
    public name: string;
    constructor(name:string, location: string   ) {
        this.name = name;
        this.#location = location
    }
}
```
We want to add a public field to show the Student location and validation that doesn't permit a set of NY as location.

The get and setters come to help us in our code, defining 2 functions with get and set keyword before the function name.

the location function with the keyword get must to have a return the value stored into the private field, in our case this.#location field.

The location function with the set keyword must have a parameter value and be used to store it into the private field location. In our scenery, we take the value parameter and checks if it equals NY then raise an error or if not set it to this.#location private field.

```javascript
class Student {
    #location: string;
    public name: string;
   get location()  {
        return this.#location;
    }
    set location(value){
        if(value === "NY") {
            throw new Error(`${value} is invalid.`)
        } else {
        this.#location = value;
        }
    }
    constructor(name:string, location: string   ) {
        this.name = name;
        this.#location = location
    }
}
```
If create a object with NY location, it will raise an error.
```javascript
let demoUser = new Student('Dany', 'NY');
console.log(demoUser .location);
```

```bash
nodemon] starting `node estudiante.js`
C:\Users\dany\Desktop\curso\estudiante.js:27
            throw new Error(`${value} is invalid.`);
            ^

Error: NY is invalid.
    at Student.set location [as location] (C:\Users\dany\Desk
top\curso\estudiante.js:27:19)

```
It is an easy way to have a validation encapsulated into the public field assignment.

Hopefully, that will give you a bit of help with getter and setter in Typescript. If you enjoyed this post, share it.

Photo by <a href="https://unsplash.com/@henmankk?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Keagan Henman</a> on <a href="https://unsplash.com/s/photos/set?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
Compute Execution Time in loops
Tags: php
Published: 2020-04-25 23:01:20

Compute Execution Time (for - foreach - while - do while - iterator - array_map) :rocket:
```php
<?php

// An array of 1000 units with random string values
for ($i = 0; $i <= 1000; $i++) {
    $units[] = rand(1, 9);
}

// for loop performance
function getForLoopTime($units)
{
    $startingTime = microtime(true);
    for ($i = 0; $i < count($units); $i++) {
    }
    $endingTime = microtime(true);
    return $endingTime - $startingTime;
}


// foreach loop performance
function getForEachLoopTime($units)
{
    $startingTime = microtime(true);
    foreach ($units as $unit) {
    }
    $endingTime = microtime(true);
    return $endingTime - $startingTime;
}


// while loop performance
function getWhileLoopTime($units){
    $startingTime = microtime(true);
    $i = 0;
    while ($i < count($units)) {
        $i++;
    }
    $endingTime = microtime(true);
    return $endingTime - $startingTime;
}



// do while loop performance
function getDoWhileLoopTime($units){
    $startingTime = microtime(true);
    $i = 0;
    do {
        $i++;
    } while ($i < count($units));
    $endingTime = microtime(true);
    return $endingTime - $startingTime;
}



// iterator loop performace
function getIteratorLoopTime($units){
    $startingTime = microtime(true);
    $arrayObj = new ArrayObject($units);
    $arrayIterator = $arrayObj->getIterator();
    while ($arrayIterator->valid()) {
        $arrayIterator->next();
    }
    $endingTime = microtime(true);
    return  $endingTime - $startingTime;
}


// array map performance
function getArrayMapTime($units)
{
    $startingTime = microtime(true);
    array_map(function($unit){
        return $unit;
    },$units);
    $endingTime = microtime(true);
    return $endingTime - $startingTime;
}


print_r("for loop evaluates to: " . number_format(getForLoopTime($units) * 1000, 3) . "<br>");
print_r("foreach loop evaluates to: " . number_format(getForEachLoopTime($units) * 1000, 3) . "<br>");
print_r("while loop evaluates to: " . number_format(getWhileLoopTime($units) * 1000, 3) . "<br>");
print_r("do while loop evaluates to: " . number_format(getDoWhileLoopTime($units) * 1000, 3) . "<br>");
print_r("Array Iterator evaluates to: " . number_format(getIteratorLoopTime($units) * 1000, 3) . "<br>");
print_r("Array Map evaluates to: " . number_format(getArrayMapTime($units) * 1000, 3) . "<br>");



``` 
**Output**
```
for loop evaluates to: 0.030
foreach loop evaluates to: 0.013
while loop evaluates to: 0.034
do while loop evaluates to: 0.034
Array Iterator evaluates to: 0.118
Array Map evaluates to: 0.074
```
From Results show that 
1. foreach
2. while - do while
3. for
4. array map
4. iterator
MY DAILY STATUS
Published: 2020-04-25 22:53:47

Successfully completed the project "My Daily Status", developed during the Fullstack Lab week, organized by the DevPleno staff (devpleno.com). On the platform, a pre-registered user can make a periodic record of their health status during this pandemic that is plaguing us and follow the records of other users around them.

Technologies Used:

- Node.js
- React.js
- Next.js
- Tail wind CSS
- Auth0 authentication
- Firebase database
- Zeit

Link to the project repository: (https://github.com/JoramirJr/my-daily-status)
Laravel Custom Login and Registration Example
Tags: laravel
Published: 2020-04-25 22:43:35

Hello Artisan

In this tutorial i am going to show you laravel 7 custom authentication. Though laravel provides auth scaffolding but in this tutorial we will create our own custom login and registration. Laravel provides the basic auth there includes the basic login, registration, and password reset functionalities. These functionalities can be easily customized.

https://www.tutspack.com/blog/laravel-custom-login-and-registration-example
Which backend programming language should I choose?
Tags: go, python, ruby, php
Published: 2020-04-25 21:55:11

PHP and Javascript are my current tools as a web developer. I made some first steps with Python and. Ruby, but did not use it for a real project yet.
There is nothing wrong about PHP or JS, but I would like to learn a new programming language primarily focused on the backend. The problem is that I am not entirely sure which language to pick. That's why I am asking you for advice.

The language I would like to learn should mostly be used to craft backends for all sorts of websites and services: from "simple websites" with contact forms and so on, up to large SaaS products with a broad range of capabilities. It should be easy to start with but powerful enough to handle critical workloads. Ideally, it has mature frameworks which provide a solid base for things like user auth, ORM and database handling.
Also,it should be future proof, meaning no declining but raising usage.

The languages which seem most appropriate are
* Python
* Ruby
* Go
* Kotlin/Java.

## The languages in detail

The following list contains some assumptions about the languages. I hope that some could verify or correct them if wrong. :) 

Python is one of the most popular languages and is known as a universal language for programming in all sorts of fields, and became quite popular in the AI sector. It has popular frameworks for the web environment. A large con is that it's dynamically typed.

Ruby is used by many top web services such as Github or Stripe. From what I heard a lot of people swear on Ruby. I already worked with Rails a bit and it really is a great tool.
On the other hand I read some comments that it's kind of a dying language because it never had a large market share and now others take over.

Go is kind of the newcomer on the block. I heard a lot of good things about it because it was created to be used for the web, has a strict type system and should be easier to learn. Con seems to be the rather small usege at the moment. I did not find many job offers for it.

Last but not least, Java, or the more modern Kotlin. Java always was an "enterprise language" for me and feels rather slow and bulky, although it's used in many high-class systems.
I am not sure about Kotlin. It looks modern and like a nice evolution of Java, but I did not find many job postings for it. 

---

What do you think about all these modern languages? Which one should one pick if starting fresh into the web programming business and what would be the most important selling point?

Or do you have other suggestions in mind?
Enceladus Project Dev Blog 1: Introduction
Tags: enceladusproject, unity3d, gamedev
Published: 2020-04-25 21:51:37

#Enceladus Project
__Enceladus Project__ is an in-progress hobby project that I've been working on in my spare time. It is being developed in Unity (C#) and is a very "early stage" work in progress

This is the first in what I hope will be many useful dev blog post related to the development of this game. I'm not the most experienced Game Developer, but I am a professional Software Engineer and I will be applying what I've learned through my career to Game Development on this project.

##So, what is it?
Enceladus Project is (or will be?) a 2D, sprite-based Space game with Newtonian style flight mechanics. 

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

It is definitely inspired by games like [Elite Dangerous](https://www.elitedangerous.com/) and [No Man's Sky](https://www.nomanssky.com/), and my goal is to give this game the same level of customization and freedom, while also giving the player a focused narrative to aim to achieve. 

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

If you're interested, please stay tuned for updates on the progress of the game as well as some tutorials and code snippets related to the more interesting challenges I've solved while creating this game!
Multiple GitHub accounts and Windows
Tags: github, windows
Published: 2020-04-25 21:46:55



Windows has a great tool called the Credential manager. It works well when you are using `git` in the `command prompt` or through `git bash`. I used it without being aware of it for years. It seemlessly creates a Personal Access Token for GitHub in the background. It saves you so much time by not having to sign in each time. I recommend using it unless you are on a shared computer.

![](https://media.giphy.com/media/toXKzaJP3WIgM/source.gif)

### But wait, what if you have multiple user accounts.


At a previous full time position I had both a personal and a business GitHub account. All was hunky dori until i needed to switch back and forth between the two.

![](https://media.giphy.com/media/UZ12sB7FMkjG8/giphy.gif)

I had to repeat the steps below every time I wanted to switch. Thankfully this only lasted a short time.

Process for switching between accounts.

1. Open the Credential Manager - in control panel
2. Locate `git@github.com`
3. Delete that record
4. start a push or pull to github
5. enter credentials for other account
6. repeat steps 2-5 to switch back.

> Note: you will likely recieve an email each time you change since a new Persoal Access Token has been added to your account.

I hope this helps anyone else who ends up with the same issue.