teleren/devto huggingface dataset:
[Tutorial Git] git branch: O que são branches (ramos) no Git?
Tags: git, branch, checkout, braziliandevs
Published: 2020-04-25 16:58:40

De maneira simplificada, os **ramos (branches)** no Git são semelhantes a um ramo de uma árvore, onde o tronco seria a base do código. Desse modo é possível criar diversos ramos e fazer alterações, enquanto a base permanece intacta. Por padrão o ramo principal é denominado de **main** (master, na versão antiga).

![ramos no git](https://dev-to-uploads.s3.amazonaws.com/i/69payngupg75rqgabwdg.png)

## Criando branch

Para criar um **branch**, digite

```
$ git branch <nome_do_ramo>
```

- **$** indica que você deve usar o **usuário comum** para fazer essa operação.
- escolha um nome para o seu ramo sem os sinais **< e >**.

Para ir até o **branch** criado

```
$ git checkout <nome_do_ramo>
```

Para usar um atalho para esses dois comandos acima (criar o novo ramo e ser imediatamente transferida para ele)

```
$ git checkout -b <nome_do_ramo>
```

Desse modo o **branch** será criado e em seguida irá transferir você para lá.

## Listar branch

Para listar todos os **branches**, usa-se o comando:

```
$ git branch -a
```

Para saber em qual **branch** você está, digite:

```
$ git branch
```

## Excluindo branch

Para excluir um **branch**, digite

```
$ git branch -d <nome_do_ramo>
```

## Excluindo branch remoto

```
$ git push origin --delete <nome_do_ramo>
```

## Unindo branch

Para unir todas as modificações que foram feitas em diferentes **branches**, ao ramo principal do projeto, digite

```
$ git checkout main
```

para ir até o **branch principal** ou

```
$ git checkout <nome_do_ramo>
```

para ir até o **branch** de destino das alterações.

Então digite

```
$ git merge <nome_do_ramo_onde_as_alterações_foram_feitas>
```

O fluxo dos **branches** será algo como a figura abaixo (unindo **branch 1** a **main**).

![merge](https://dev-to-uploads.s3.amazonaws.com/i/ysigzvh1mlr9lh6yp3qr.png)

Para visualizar os **commits** de **merge**:

```
 $ git log --merges 
```

## Resolvendo conflitos ao unir os ramos no git

Supondo que temos um arquivo na **branch main** com o seguinte código

```py
def soma(x,y):
    z = x+y
    print(x,"+",y,"=",z)

print('SOMA DOIS NÚMEROS')
num1 = float(input("Digite o primeiro número: "))
num2 = float(input("Digite o segundo número: "))
soma(num1,num2)
```

E o mesmo arquivo na **branch teste**, com o código:

```py
def somar(a,b):
    c = a+b
    return c

print('SOMA DOIS NÚMEROS')
numero1 = float(input("Digite o primeiro número: "))
numero2 = float(input("Digite o segundo número: "))
resultado = somar(numero1,numero2)
print(f'Soma: {resultado}')
```

Ao tentar fazer o **merge** o git anunciará o conflito:

```
Mesclagem automática de <arquivo>
CONFLITO (conteúdo): conflito de mesclagem em <arquivo>
Automatic merge failed; fix conflicts and then commit the result.
```

Desse modo, é preciso primeiro resolver a situação conflitante (escolhendo as partes do código que deseja manter) e em seguida fazer o **commit**. Só após isso a união dos branches (ramos) será concluída.

Caso deseje desfazer esse processo, digite:

```
$ git merge --abort
```
I sent a dashboard via curl 
Tags: javascript, node, bash, showdev
Published: 2020-04-25 16:26:05

> Disclaimer: I am one of the members of [tracker-cli](https://github.com/trackercli) team   

I've been using [blessed-contrib](https://github.com/yaronn/blessed-contrib) for creating an interactive dashboard and its really cool! It has many widgets to play and much faster to integrate than implementing my own  blessed components. However, to make it visible to someones screen, they need to clone the repository, or install via npm, etc.. etc.. And for me, doing it for 3 or more projects within the day is exhausting. IMHO, its not always necessary to make everything interactive 

And so... we want it to be different!

We send a static blessed dashboard via `CURL`. Yes you heard it right `CURL`! We implemented it on [covid19-tracker-cli](https://github.com/trackercli/covid19-tracker-cli) and its awesome (well maybe just in my viewpoint? :smile:)

### Try it on your terminal

```bash
   curl -L dev.covid19.trackercli.com/history/charts/us
```
![dashboard for small device](https://dev-to-uploads.s3.amazonaws.com/i/yye9cygbg0kx2s08m1w8.gif)

```bash
   curl -L dev.covid19.trackercli.com/history/charts/us/md
```
![medium device](https://user-images.githubusercontent.com/10413754/79240885-e92d0700-7ea4-11ea-82c6-eeb97cde4227.png)

 > Note: It's currently available in dev branch.

 > Team Members: @warenGonzaga @ianVizarra @jkga

   

**Update:**  you can now view the latest stat directly in your browser
https://covid19-tracker-cli-21t7uvea5.vercel.app/history/web/charts/us
Java interview coding questions - Part 01
Tags: java, interview, tutorial, beginners
Published: 2020-04-25 16:20:37

##__How to count words in a String__

{% gist https://gist.github.com/raviyasas/323893befd4f434147bf95ac7ce79803 %}

##__How to remove duplicates in a String__

{% gist https://gist.github.com/raviyasas/ffefe411b69faa9f182ad2ab26ed8b7d %}

##__How to reverse a String__

{% gist https://gist.github.com/raviyasas/29da53382d104d1273dc057796de8efd %}

##__How to add a List to a Map__

{% gist https://gist.github.com/raviyasas/19d70e68f0ace6e1cdae201bca9a22ae %}

##__How to add a List to a Set__

{% gist https://gist.github.com/raviyasas/9457bb1bb97df07218bf38ec04e701a4 %}

##__How to add a List to an array__

{% gist https://gist.github.com/raviyasas/13a3c45ce7991b28b46d767eb9684ec7 %}

##__How to sort an array__

{% gist https://gist.github.com/raviyasas/dcc9f7de75075badbe32bc339353f305 %}
World of WoqlCraft - Ep.5 load data into Schame.org schema
Tags: database, python, tutorial, schema
Published: 2020-04-25 16:19:24

---
title: World of WoqlCraft - Ep.5 load data into Schame.org schema
published: true
description: We try to put the Schema.org schema that we built into action. However, I discovered there are a few problems with the schema and we fixed that. We scrape the microdata form the event page of our past meetup and put them into the database with our Schema.org schema.
tags: database, python, tutorial, schema
---
We try to put the Schema.org schema that we built into action. However, I discovered there are a few problems with the schema and we fixed that. We scrape the microdata form the [event page](http://events.terminusdb.com/london/2020/02/11/london-1st-graph.html) of our past meetup and put them into the database with our Schema.org schema.

Find the source code from our [tutorial repo](https://github.com/terminusdb/terminus-tutorials).

Join the TerminusDB community at [Discord](https://discord.gg/Gvdqw97)
27: JavaScript Coding Challenge 
Tags: javascript
Published: 2020-04-25 16:11:54

 
#**Problem Solving**

The programmer is not the one who make solutions to problems, It is the same logic as I considered of vanilla JS the most important, before that, there is a necessity to adjust solving problems I want to be more specific to visualize into my JS Code. 

It is relevant to learn algebra, discrete mathematics, data structure, algorithms, and software architecture, I am honestly exhausted of my idealism to make my ideas actualize, however, it is worth to try out and remain as a life lesson, 

* Independent Learner
* Wise Programming 
* To survive among programmers
What would an IDE for writing content look like?
Tags: discuss, webdev, writing
Published: 2020-04-25 16:04:09

---
title: What would an IDE for writing content look like?
published: true
description: What would an IDE for writing content look like?
tags: discuss, webdev, writing
---

### The Problem 
I use VS Code as my IDE. I also use it for writing blog posts in Markdown. **But writing is different than coding.** While I still like the features offered by my IDE, it's not made for writing. I'll notice typos that aren't caught until after I publish. 

While I've found some workarounds, I started wondering - what would an IDE made _just_ for writing content look like?

### Discuss
Share your thoughts, writing hacks, and workarounds!
Git Command Alias
Tags: git, letslearntogether, dailydose, giteveryday
Published: 2020-04-25 15:58:30

>💡 **Shorten long git commands with aliases:-**

- You can add aliases to your git commands as we do for Linux commands.
- You can do it for git commands by adding *_[alias]_* section to  *.gitconfig* file.


>[alias]
 - ca = commit -a -m <message>
 - lol = log --graph --decorate --pretty=oneline --abbrev-commit

- For Example: `git ca "This is a test commit."`
100daysofcodeFlutter Flutter
Tags: 100daysofcode, flutter
Published: 2020-04-25 15:52:25

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

Today lear about connect to firebase, post to firebase
https://github.com/triyono777/100-days-of-code/blob/master/log.md
Setup ESLint, Prettier & Airbnb Style Guide in under 2 Minutes
Tags: javascript, react, eslint, 100daysofcode
Published: 2020-04-25 15:50:07

{% youtube qibrJYImqLU %}

# Quit fighting with ESlint & Prettier
We've all been there...we have just started a new project and we need ESLint and Prettier integrated, and before you know it you're one hour deep into Googling why ESlint and Prettier aren't playing nicely together.

But what about installing all the packages that I need? This will do it for you! You'll get the following out of the box:

   ```
eslint prettier, eslint-plugin-react-hooks, eslint-config-airbnb, eslint-plugin-jsx-a11y, eslint-plugin-import, eslint-plugin-react babel-eslint
   ```

## Installation

1. Navigate to your app directory where you want to include this style configuration.
   ```
cd myapp
   ```

2. Run this command inside your app's root directory. Note: this command executes the `eslint-prettier-config.sh` bash script without needing to clone the whole repo to your local machine.
   ```
exec 3<&1;bash <&3 <(curl https://raw.githubusercontent.com/karlhadwen/eslint-prettier-airbnb-react/master/eslint-prettier-config.sh 2> /dev/null)
   ```

(Optional) Zsh Alias
   ```
alias install-eslint="exec 3<&1;bash <&3 <(curl https://raw.githubusercontent.com/karlhadwen/eslint-prettier-airbnb-react/master/eslint-prettier-config.sh 2> /dev/null)"
   ```

## And we're done, it was that simple!
I recommend forking this (as I did from: https://github.com/paulolramos/eslint-prettier-airbnb-react (thanks for the awesome script, Paulo) and modifying `eslint-prettier-config.sh` - now each time you integrate ESLint & Prettier, you'll have an up to date configuration integration!

🎥 If you enjoyed this little tip, subscribe to my [YouTube channel](https://bit.ly/CognitiveSurge) where I post React, JavaScript, GraphQL videos--and of course quick tips! I'm also on [Twitter](https://twitter.com/karlhadwen).
26: Computational Thinking
Published: 2020-04-25 15:41:10


#*Converting the process*
What I love about the programming is that I can achieve something if I learn deeper and create the output, it makes me feel AWESOME 

* Unlimited possibility to make me grow up intellectual
* Learning Discrete Mathematics is more important 
* Studying Algorithms are essential

I want to work the company who support my philosophy of thinking in terms of computer science, pure mathematics, and Javascript web front-end development, the purpose is set up, then, let me try to be the way I am 

---

Learning to code is my life turning point, then, why not letting myself getting deeper to enjoy Pure mathematics? 


[Enjoy Discrete Math to grow up the computational thinking](https://artofproblemsolving.com/news/articles/discrete-math)
Default methods in Java 8
Tags: java, java8, beginners, tutorial
Published: 2020-04-25 15:25:00

##__The problem__
```
interface Automobile{
    void engineStart();
    void engineStop();
}

class Car implements Automobile{
    public void engineStart() { }
    public void engineStop() { }
}

class Bus implements Automobile{
    public void engineStart() { }
    public void engineStop() { }
}
```
* Just think we need to add another method in the interface in the future.
* But if we add it, we have to change all other classes which are implemented that interface. 

##__Default methods__

* To overcome this, default methods are introduced in Java 1.8
* The interface segregation principle can be replaced with default methods in Java.
* This is the best option to change the existing interfaces without changing implemented classes.
* Until Java 1.7 every method inside an interface is always public and abstract.
* In 1.8 version default and static methods are also allowed.
* In 1.9 version private methods are also allowed.
* Default methods can be overridden in implementing class.
* Default methods cannot be overridden object class's methods.

##__The solution using Java 8 default methods__
```
interface Automobile{
    default void m1(){}
}

interface Car{
    default void m1(){}
}

class Mazda3 implements Automobile, Car{
    public void m1() { }
}
```
* In such cases you have to override the default method.
* Otherwise Mazda3 class won't be able to find which m1( ) method needs to be called.

Or else you can use it like this also using the "__super__" keyword.
```
interface Automobile{
    default void m1(){}
}

interface Car{
    default void m1(){}
}

class Mazda3 implements Automobile, Car{
    public void m1() {
        Automobile.super.m1();    
    }
}
```
simple button CSS
Tags: codepen, css, beginners
Published: 2020-04-25 15:10:52

---
title: simple button CSS
description: A.B.C pure CSS
published: true
tags: codepen, css, beginners
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/gh0jma4i34czq9reaiyb.jpg
---

I want try to cover Css from the basic this is a test.
Fun stuff will come soon 🥳😱.
First we set our html:
```javascript
<button>Log In</button>
```
Now let's write some css, I  set first the main role for my html:
```css
html{
 height: 100vh; /* all the screen */
 background: grey; /* the color for the background */
 box-sizing: border-box; /* we talk soon about it */
 display: flex; /* flexbox */
 align-items: center /* center the button in the middle of the wh */
 justify-content: center; /* center the button in the middle of the vw */
}
```
Now I am ready to apply same simple style to our button:
```css
button{
 padding: 1rem;
 border: 0.5rem solid rebeccapurple; 
 border-radius: 0.3rem;
 font-size: 1.5rem;
 background: rebeccapurple;
 color: white;
}
```


{% codepen https://codepen.io/giandodev/pen/rNOMGLg %}
How to reduce you html output in 11ty
Tags: webperf, eleventy, performance, html
Published: 2020-07-26 15:22:41

---
title: How to reduce you html output in 11ty
published: true
date: 2020-04-25 15:07:02 UTC
tags: webperformance,eleventy,performance,html
canonical_url: https://medium.com/@mattclaffey/how-to-reduce-you-html-output-in-11ty-ec0c358be2ac
---

![](https://cdn-images-1.medium.com/max/1024/1*XenGkM5kGx-LlMl2xx8CYg.jpeg)

Minifying html is a really useful feature that can improve TTFB on the page and with 11ty it is very simple to do. In the eleventy.js config file we need to add a transform to the config which will check if the output is a .html file and if it is we will use an npm plugin called [html-minifier](https://www.npmjs.com/package/html-minifier%5C) to compress our html code.

![](https://cdn-images-1.medium.com/max/1024/1*4iRnWjsbE6aVhEC8KNZQzQ.png)

### Extra’s!

If you use CSS modules in a react project then this concept will be straight forward but for those who haven’t done this there is a way to shorten our css selectors and then that will get reflected in the html too.

Using a plugin [posthtml-minify-css-classnames](https://github.com/posthtml/posthtml-minify-classnames) we can get our selectors shortened into small identifiers which will make our html output even smaller. This can be used with html, css and javascript inside the html document.

#### Before Vs After

![](https://cdn-images-1.medium.com/max/1024/1*oc45IOALlBLbtAlZ3tZMwA.png)

![](https://cdn-images-1.medium.com/max/1024/1*TjbEMd-ZiCapfwXvu7_fyA.png)

In eleventy.js we need to apply the css class names change before we apply the minify on top.

![](https://cdn-images-1.medium.com/max/1024/1*fwIRzk2xvljX2HlCtN9q2g.png)

### Results (Fast 3G test)

In my example I managed to reduce my html output by around 11%.

Before I implemented this I had un-minified html and my css was in a seperate file.

Pro’s:

- caching

Con’s

- critical chain request
- takes longer to load
- unable to do it on a file basis it all needs to live in the html document.

![](https://cdn-images-1.medium.com/max/848/1*v5mHe0cW6Xy_a9tTAPjLJw.png)

After the implementation we managed to reduce the load of the html and css from 1.21s to 0.592s which is nearly a 50% reduction in time it took.

![](https://cdn-images-1.medium.com/max/825/1*XObZPHTR5pQ6Qs4kZRE3oA.png)

### Resources

- 11ty How to minify your html output — [https://www.11ty.dev/docs/config/#transforms-example-minify-html-output](https://www.11ty.dev/docs/config/#transforms-example-minify-html-output)
- html-minfier — [https://www.npmjs.com/package/html-minifier](https://www.npmjs.com/package/html-minifier)
- posthtml-minify-css-classnames — [https://github.com/posthtml/posthtml-minify-classnames](https://github.com/posthtml/posthtml-minify-classnames)
25: Project-based Learning
Tags: javascript, html, css
Published: 2020-04-25 15:04:59


#**Project-based Learning**

1. Applying in order 
2. To proof the ideas 
3. Making beautiful outputs
4. The employable skills 

---
I have zero background of mathematical skills, and, What I can do is actually showing my potential to companies, that I am capable of growing up with my honesty. That is enough for me, I used to think that I would be not qualified enough unless I can programming based on Vanilla JS, which was my fundamental standard. The more I am learning into, I figured out, there is no way to be a perfect software engineer, 

* Growing the Confidence to overcome obstacles
* Self-directed teaching and Getting used to finding out by searching
* The curiosity saves me from the social box, the coding is on my own

--- 
The core is becoming a problem-solver, then everything is solved, the categories do not matter, in my opinion :)
Learn Flutter #1
Tags: flutter, devlive, learntech, dart
Published: 2020-04-25 14:52:59

As a part of my weekend hack today I am going to highlight some key points which I learned while I went through a [Flutter](http://flutter.io/) course.

[Flutter](http://flutter.io/) can be used for Mobile App development as well as Web apps and desktop apps. Flutter apps are build using [Dart](https://dart.dev/) which is a programming language been built by Google.

**Prerequisites to build an app using Flutter:-**

- Experience with [Dart](https://dart.dev/) or any other programming language 
- A little bit of experience with Android or iOS app development
- Ability to grasp things slowly and steadily :)


>**Key features of Flutter:-**

>- Every part of an app is a widget
>- Easy to learn
>- You can build an app with the same codebase for multiple platforms
 
Let me know if you have built an app using Flutter. I have pushed a code-base for a starter with Flutter on [GitHub](https://github.com/howtoflutter/hello_world).
This app is a quiz app.

Share your experiences and help others to learn Flutter.

*Happy learning and stay healthy!*
Hacker ético — Não é fácil!
Tags: devops, javascript, docker, productivity
Published: 2020-04-25 14:39:01

Serei breve, esse artigo não tem imagens para que sua leitura não seja prejudicada por distrações, apenas foque no texto e desentupa sua mente.

São anos de caminhada entre estudar livros, fazer cursos e pesquisas. As áreas de desenvolvimento e segurança da informação, são minhas paixões. Por muitas vezes me senti estagnado, como algumas vezes ainda me sinto, é normal. Mas confesso que: “não é fácil”, o conhecimento vem com as repetições e o passar dos dias. Estude do básico de redes de computadores ao básico de sistemas operacionais, mantenha sua mente focada em programação se quiser ser um destaque. https://github.com/ctf42

Passei por muitas noites quebrando cabeça com algoritmos e formulando a melhor maneira para desenvolver um programa simples, mas que de certa forma fosse funcional para alguém não importasse quem. Estudar um vídeo em umas das plataformas do curso por diversas vezes ao longo do mês, para que o assunto ou parte dele se fixasse em minha mente, enfim.

Tome a iniciativa de aprender simultaneamente outros idiomas, começe pelo inglês se quer uma dica, me ajuda muito na leitura da documentação de algumas linguagens e frameworks. Faça capture de flags no tempo livre, gaste seu dinheiro com cursos depois de ter feito os grátis, mas com a conciência de que tem uma base formada. Não são conselhos e sim dicas de como se manter vivo nesse universo complicado porém muito organizado.

# Redes de computadores # Sistemas Operacionais #Programação #Inglês #CTF

Não é fórmula mágica, mas misture os ingredientes acima e os engula. Vai ver que dá resultado.
What’s your alternative solution? Challenge #27
Tags: challenge, javascript, codenewbie, learntocode
Published: 2020-04-25 14:19:29

# About this series

This is series of daily JavaScript coding challenges... for both beginners and advanced users.

Each day I’m gone present you a very simple coding challenge, together with the solution. The solution is intentionally written in a didactic way using classic JavaScript syntax in order to be accessible to coders of all levels.

Solutions are designed with increase level of complexity.

## Today’s coding challenge

```
Create a function that will receive two arrays of numbers as arguments and return an array composed of all the numbers that are either in the first array or second array but not in both

```

(scroll down for solution)

## Code newbies

If you are a code newbie, try to work on the solution on your own. After you finish it, or if you need help, please consult the provided solution.

## Advanced developers

Please provide alternative solutions in the comments below. 

You can solve it using functional concepts or solve it using a different algorithm... or just solve it using the latest ES innovations.

By providing a new solution you can show code newbies different ways to solve the same problem.

## Solution

```javascript
// Solution for challenge25

var ar1 = [1, 2, 3, 10, 5, 3, 14];
var ar2 = [1, 4, 5, 6, 14];

var ar = mergeExclusive(ar1, ar2);
println(ar);

function mergeExclusive(ar1, ar2)
{
    var ar = [];
    
    for(let el of ar1)
    {
        if (!ar2.includes(el))
        {
            ar.push(el);
        }
    }
    
    for(let el of ar2)
    {
        if (!ar1.includes(el))
        {
            ar.push(el);
        }
    }
    
    return ar;
}

```


To quickly verify this solution, copy the code above in this coding [editor](https://codeguppy.com/code.html) and press "Run".

> Note: The solution was originally designed for [codeguppy.com](https://codeguppy.com) environment, and therefore is making use of `println`. This is the almost equivalent of `console.log` in other environments. Please feel free to use your preferred coding playground / environment when implementing your solution.
With Google Apps Script going to V8, whither ts2gas?
Tags: googleappsscript, javascript, googlesheets, help
Published: 2020-04-25 14:11:01

Maybe I missed something (very likely I missed something!) but I was wondering, now that Google Apps is V8-based, where does that put Typescript and, particularly, [ts2gas](https://github.com/grant/ts2gas)?

ts2gas is part of the workflow for me building things in Google Sheets. I have a project in VSCode with a pile of .gs file and every so often I enter the command `clasp push` which uses the [clasp](https://github.com/google/clasp) tool to push my code up to the server for use in a Sheets project.

Up until now I've been having the Typescript/ts2gas workflow convert the code to something the legacy, pre-V8, engine could evaluate. Now that V8's in the picture I can, supposedly, upload a more modern dialect.

How do I make that happen? Am I still using ts2gas? What do I need to change in my `tsconfig.json` file (if anything)?