teleren/devto huggingface dataset:
Removendo repetições de um array com a classe Set
Tags: javascript, typescript, codequality, node
Published: 2019-09-21 22:30:45

Eu estava assistindo um curso na Udemy e descobri uma forma muito legal de eliminar eventuais repetições de elementos de um array.

Trata-se da combinação da classe **Set** com o **Spread operator**.

## Set

Permite o armazenamento de valores únicos de qualquer tipo.

Exemplo de um set:
```js
const set = new Set([1, 2, 3, 3, 4, 5, 5])
console.log(set) // Set {1, 2, 3, 4, 5}
```

[Clique aqui](https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Set) para conhecer mais da classe Set.

## Spread operator

Servirá para fazer o espalhamento dos elementos do Set resultante.

Exemplo de como funciona spread operator:
```js
const a = [1, 2, 3]
const b = [4, 5, 6]

const c = [...a, ...b]
console.log(c) // [1, 2, 3, 4, 5, 6]
```

[Clique aqui](https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Operators/Spread_operator) para aprender mais sobre o Spread operator.

## Combinando os dois

Agora, podemos combinar os dois e eliminar as repetições:
```js
const initial = [1, 2, 2, 3, 4, 4, 8, 8]
const set = new Set(initial)
const final = [...set]

console.log(final) // [1, 2, 3, 4, 8]
```
Do you like to watch me coding?
Tags: python, github
Published: 2019-09-21 22:21:36

[Watch me coding](https://youtu.be/r8lh-P_ZN68)
I write a small package for blurring secret stuff on videos. I also recording the process and create a video. Check it out.
[Watch me coding](https://youtu.be/r8lh-P_ZN68)
What's your job title? What do you do?
Tags: discuss, career
Published: 2019-09-21 22:18:34

---
title: What's your job title? What do you do?
published: true
description: Hopefully a resource newbie coders can leverage to learn about career options (and/or find mentorship!)
tags: discuss, career
---

Hey #DEVcommunity folks out there with tech jobs:

1. What's your job title?

2. Could you summarize what you do in your day-to-day job?

I originally posted this as a tweet (which still has some great responses coming in!) but figured this is a good group to consult as well :)

{% twitter 1175502015851638784 %}

Thanks and looking forward to learning from the responses!
My first coded game!
Tags: womenintech, codenewbie, github
Published: 2019-09-21 21:38:54

Hey everyone! So today is an awesome day. I completed my first cool game design and code. It's a really nice card matching game. I used HTML, JS, and CSS. I'm a gamer myself so I'm really excited about it. Its also amazing when you see others enjoy something you built. Check my game out at https://mira87.github.io/memory-game/. Hey guys what have you been working on?
Explain Kubernetes to me like I'm Five
Tags: discuss, kubernetes, devops, explainlikeimfive
Published: 2019-09-21 20:57:19

---
title: Explain Kubernetes to me like I'm Five
published: true
description: 
tags: discuss, Kubernetes, devops, explainlikeimfive
---

For the past month I've been working with Docker, it an awesome tool I get what I am doing but I still find it difficult to wrap my head around Kubernetes or Docker Swamp.
Some of git aliases I use to speed up my work
Tags: git
Published: 2019-09-21 20:10:38

Hi everyone! I have read a lot of articles on git (most of them from dev.to) where many of you shared you git tips and tricks. There were also a few cool ones where the concepts of version controlling and how git actually does these things were mentioned. I am really grateful to the wonderful developer community that just keeps growing! In this post I thought to share some of my git aliases that I use which helps me avoid repetitive commands and also enables to maintain a clean git tree. So here goes!

I have bound this command to "lg", and it shows my git commit history in a nice and easy to read one line format. I've forgotten where I took it from but it's either from stackoverflow or here!
```
log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
```

I use rebase a lot to update my feature branches with master. This takes a few commands where I used to update my local master branch and then go back to my feature branch and rebase the updates. There are probably better or different ways to do this, but I just use this since it works without issues! If anyone has any suggestions on this feel free to comment!
```!git checkout master && git pull --rebase && git checkout - && git rebase --interactive master```
Although I wrote this one on my own but I must thank the writer of this post for putting git rebase in such an easy to understand way!
[The Git Rebase Introduction I Wish I'd Had](https://dev.to/maxwell_dev/the-git-rebase-introduction-i-wish-id-had)


This one is a niche command that comes in handy sometimes! Basically it reverts the last changes that I did to my git tree (I think :p), and can even revert rebases!
```reset --hard ORIG_HEAD```

Sometimes I just need to update my last commit with a few new changes. I use this command to do that in a jiff!
```commit --amend --no-edit```

Ez commits! ```!git add -A && git commit -a```

Well that's it for this post! These are the git aliases I found most useful in my day to day work. Thanks to everyone in the dev community (from dev.to or not) for all the help that I receive day to day (not just for git!)!
How were you introduced to DDD ? And how much time did it take to grasp the concepts?
Tags: discuss, ddd
Published: 2019-09-21 18:19:47

---
title: How were you introduced to DDD ? And how much time did it take to grasp the concepts?
published: true
tags: "#discuss,#DDD"
---
There is `Algorithms`, which takes lot of time to grasp.
Then there is Domain Driven Design, where one might think they got the point, but with very next example you feel lost. Too subjective. No Thumb Rules.

So how has been your journey with DDD so far?
When did you first encounter it and how did you learn it?
Spine and Leaf Networks, an Outline
Tags: datacenternetworkin, routingswitching, spineandleaf
Published: 2020-03-08 00:44:26

---
title: Spine and Leaf Networks, an Outline
published: true
date: 2019-09-21 17:08:00 UTC
tags: Datacenter Networkin,Routing & Switching ,Spine and Leaf
canonical_url: 
---

With the previous post, I covered traditional data center networking, and some of the reliability compromises made to accommodate typical workloads. Here I'll be outlining my take as a series of blog posts on the next iteration of data center network design, Spine and Leaf:  
[Lab Diagram](https://dev.to/ngschmidt/switching-lab-topology-diagram-4d9b-temp-slug-4611859)

- [What came before](https://dev.to/ngschmidt/traditional-datacenter-network-a-preamble-to-spine-and-leaf-2aoc-temp-slug-9019935)
- [Introduction: What Layer 3 Leaf Spine is and isn't, Dispelling Myths](https://dev.to/ngschmidt/spine-and-leaf-networks-an-introduction-4pml-temp-slug-9474224)

  - [Topology Diagram](https://dev.to/ngschmidt/spine-and-leaf-networks-a-topology-53ob-temp-slug-4069444)
- Practical Applications with IGPs

  - [RIP](https://dev.to/ngschmidt/spine-and-leaf-practical-applications-ripv2-457g-temp-slug-7341634) 
  - [OSPF](https://dev.to/ngschmidt/spine-and-leaf-practical-applications-ospf-2hb8-temp-slug-8625405)
- Practical application with EGP only

  - [eBGP](https://dev.to/ngschmidt/spine-and-leaf-practical-applications-ebgp-3oc3-temp-slug-2870718)
- [Practical applications with IGPs and EGP](https://dev.to/ngschmidt/spine-and-leaf-practical-applications-egp-and-igp-combined-3ig8-temp-slug-4069918)
- [The IP Portability / Layer 2 problem](https://dev.to/ngschmidt/spine-and-leaf-practical-applications-the-ip-portability-problem-1gnf-temp-slug-8698635)

- What I've found while practically applying this, tips and tricks

  - VMWare NSX-V
  - VMWare NSX-T
  - Cisco NX-OS & Automation

Note: This page may change based on content. I'm going to try and keep things generic up until the very end.
Need Laptop Recommendations for Linux
Tags: help, laptops, linux
Published: 2019-09-21 16:57:21

---
title: Need Laptop Recommendations for Linux
published: true
description: Help me find my new sandbox!
tags: help, laptops, Linux
---

I’m looking for recommendations for a Linux laptop!

I just want a little laptop to play around on and maybe take places that I don’t want to lug my MacBook to. It doesn’t need to be powerful or big. Honestly, 4Gb of RAM and 64Gb of hard drive is probably plenty but more is always gravy. Littler is better, 11 or 13 or 15 inches. And I’d like it to be less than $500 ideally.

But what is necessary—absolutely necessary!—is that the laptop buttons like screen brightness and volume must work without fuss, as well as the lid open and close functionality. 

I’ve got a Dell Inspiron now, but it suspends when I close the lid and never comes back no matter what and I’ve spent *TOO MANY HOURS* fighting with it. It’s no longer fun. So please, only bulletproof compatibility suggestions please.

I’m planning on probably using Ubuntu if that matters, but bonus points if it’s bulletproof for multiple distros. 

Thank you for your help!
Apache Pulsar vs. Apache Kafka
Tags: discuss, java, distributedsystems, kotlin
Published: 2019-09-21 16:51:10

Hi all,

do you have experience with either Apache Pulsar or Kafka for stream processing? Mainly I want to use the underlying distributed log from Pulsar (BookKeeper) to distribute a transaction log and to have certain guarantees (single writer, read your own writes consistency...).

I want to expose this however for other stream processing tasks as an additional API.

Kind regards and have a great weekend everyone
Johannes
Xfce: Custom Keyboard Shortcuts
Tags: xfce, desktopenvironment, keyboard, shortcuts
Published: 2019-09-21 16:35:48

---
title: Xfce: Custom Keyboard Shortcuts
published: true
description: Xfce Desktop supports custom keyboard shortcuts.
tags: xfce, desktop environment, keyboard, shortcuts
---

[Xfce Desktop](https://www.xfce.org) supports custom keyboard shortcuts.

Open Xfce Menu.
Go to [Settings] - [Keyboard].
Then activates "Application Shortcuts":

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

In order to add a shortcut, click "Add" and enter the command and the combination of the keys:

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

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

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

Also, it is possible to "Edit" or "Remove" it afterwards.
NSX-T Datacenter 2.5 Released!
Tags: networksecurity, nsxt, vmware
Published: 2020-03-08 00:43:26

---
title: NSX-T Datacenter 2.5 Released!
published: true
date: 2019-09-21 15:15:00 UTC
tags: Network Security,NSX-T,VMWare
canonical_url: 
---

As of 19 September 2019, NSX-T 2.5 has been officially released and is available for download!  
  
It's been a bit since the announcement, so let's cover some of the new capabilities of interest with NSX-T 2.5. This is a summary of what I found interesting, the complete release notes are [here](https://docs.vmware.com/en/VMware-NSX-T-Data-Center/2.5/rn/VMware-NSX-T-Data-Center-250-Release-Notes.html)

## NSX Intelligence

VMWare will be introducing a new **paid**  service to analyze traffic handled by distributed firewalling, to allow infrastructure administrators to map out service applications, ports, and policies to better secure their east-west network environment. It will also provide the capability that NSX-V has natively, [Application Rule Manager](https://docs.vmware.com/en/VMware-NSX-Data-Center-for-vSphere/6.4/com.vmware.nsx.admin.doc/GUID-163A6DEB-6C40-423C-90E9-446CE27B9A2C.html). 

## Testing and Troubleshooting

VMWare added a ton of good stuff here, some of which seems a little late...

### Layer 2 MTU/VLAN Checking

This one has been a big pain point for NSX administrators everywhere, especially if they don't also control the route-switch infrastructure. Prior to this, NSX-T had tunnel status (which would alarm if no VMs in a port group were on a host, causing a LOT of noise) and NSX-V had **nothing**.

### Layer 3

We get BGP routing information from the API and GUI for the first time!

## New Capabilities

### IPv6

We pick up SLAAC, Router advertisements allowing for automatic IP configuration. Ideally, this would not be something we really need - but I'm sure there's a use case somewhere.

### Firewalling and Security

- **NSX-T now supports configuration management as well, with config drafts!**
- **NSX Cloud is beginning to support native constructs in public cloud for security enforcement. This is a pretty big deal for hybrid cloud shops that won't have to use an agent to enforce consistent multi-cloud security!**
- VMWare has introduced Layer 7 (App-ID) support for gateways and is beginning to introduce FQDN filtering as a precursor to URL filtering.
- VMWare has also added Identity-based firewalling.
- Elliptic Curve Cryptography over IPSEC is now available
- Preset compliance suites for VPNs are also available

### Other

- Load Balancing GUI Improvements - We'll see the simplified GUI in a bit.
- SNMPv3 Polling is supported on all appliances
- The NSX-V to NSX-T migration tool has unlisted improvements
- **NSX Manager to Edge communication is changing ports - from 1234 to 5671. This could potentially break connectivity during an upgrade. Port 1235 does still need to be open.**

Next, let's try it out!
Steem price with Python
Tags: blockchain, cryptocurrency, python
Published: 2019-09-21 16:34:50


Steem is a blockchain-based rewards platform for publishers to monetize content and grow community.

The website steemit rewards its users in steem coin for writing content. This feature isn't available in dev.to yet, but perhaps in the future you'll earn crypto currency with posting.

<img src="https://thumbs.gfycat.com/BonySecondaryAmericanavocet.webp">

## Price changes

Like any currency or asset, the value fluctuates over time. Is it increasing or decreasing? let's find out with Python

The data is available on coinmarketcap,

    #!/usr/bin/python3
    r  = requests.get("https://coinmarketcap.com/currencies/steem/historical-data/?start=20140101&end={0}".format(enddate))
    data = r.text

This link points to an HTML table, not an API call. That's why we need beautifulsoup to parse the data.

    #!/usr/bin/python3
    soup = BeautifulSoup(data, "html.parser")
    table = soup.find('table', attrs={ "class" : "table"})

You can iterate over the table like this:


    #!/usr/bin/python3
    for row in table.find_all('tr'):
        tag = row.findAll('td')
        for val in tag:
            value = val.text

I add the data to an array and plot it with Python, see <a href="https://github.com/codesharedot/steem-price-chart/blob/master/example.py">source code</a>

This shows it's better to trade steem coin immediately for something else, as its price is decreasing.

<img src="https://github.com/codesharedot/steem-price-chart/raw/master/chart.png">

Related links:
* <a href="https://en.wikipedia.org/wiki/Steem">More on Steem</a>
* <a href="https://coinmarketcap.com">Coinmarketcap</a>
* <a href="https://pythonprogramminglanguage.com">Learn Python</a>
🍹🌟 CSS for fun
Tags: css, web, html
Published: 2019-09-21 16:16:36

---
title: 🍹🌟 CSS for fun
published: true
description: One more thing where emoji help.
tags: CSS, web, HTML
cover_image: https://thepracticaldev.s3.amazonaws.com/i/f7dnmf9jlx2pfgnljaqv.png
---

Sometimes you just want to make things work and not to think about names. Emojis here to help.

> ⚠️ Don't overuse it. Read about [how people with vision impairments use emoji](https://www.perkinselearning.org/technology/blog/how-do-people-vision-impairments-use-emoji).

## Example

This is a BEM-like emoji classnames example.

```css
.🦄 {
  height: 100%;
  display: grid;
  align-items: center;
  justify-content: center;
  background: cornsilk;
}

.🦄-header {
  font-size: 72px;
  color: violet;
}

```

And apply it:
```html
<div class="🦄">
  <h1 class="🦄-header">
    Unicorns rule!
  </h1>
</div>
```

## Preview

{% jsfiddle https://jsfiddle.net/zsr0eadc/ result,html,css %}
Daily Challenge #73 - ATM Heist
Tags: challenge
Published: 2019-09-21 15:27:19

---
title: Daily Challenge #73 - ATM Heist
published: true
series: Daily Challenge
description: A thief plans a heist at a local casino.
tags: challenge
---
A thief wants to steal from two ATMs at a very special casino. 

While they mostly care about getting away with money, they are also interested in a unique fact about the ATMs at this particular casino; once a day, each ATM transfers one dollar to each other machine for each unit of distance away it is (e.g. in [0,1] both indices are 1 unit apart). Additionally, when emptied, each ATM will automatically refill with the exact same dollar amount as before, so it's possible to steal from the same ATM twice.

The thief is utlimately interested in is stealing from the two ATMs which have the highest combined total money inside, plus number of dollars each transferred to the other. Your function should return this value.

For example, if we have four ATMs: [2, 3, 4, 5], the ATM at index 0 will transfer a dollar to index 1, $2 to index 2, and $3 to index 3. Similarly, the ATM at index 2 will transfer $1 to indexes 1 and 3, and $2 to index 0.

Note that in the case above, our thief will either steal from the last ATM (index 3) twice, or steal from index 0 and index 3, because it nets her the maximum value of 10 ($5 + $5 + $0 transfer vs. $2 + $5 + $3 transfer). Either way, the answer is 10, returned as an integer.

**Examples:**

<pre>const atms = [3,1,3]
maximumThrill(atms) => 8 // $3 + $3 + $2 transferred between each (atms[0] and atms[2])

const atms = [2,3,4,5]
maximumThrill(atms) => 10 // $5 + $5 + $0 transferred (atms[3] and atms[3] again)

const atms = [10, 10, 11, 13, 7, 8, 9]
maximumThrill(atms) => 26 // $10 + $13 + $3 transfer between each (atms[0] and atms[3])

const atms = [2, 3, 4, 5, 10, 6, 7, 8, 9, 10, 11, 12, 4, 4, 2, 2, 12, 8]
maximumThrill(atms) => 34  // $10 + $12 + $12 transfer between each (atms[4] and atms[16])</pre>

Note: These are magic ATMs, so don't worry about accounting for whether an ATM has enough money to transfer.

Good luck!

***
_This challenge comes from  on CodeWars. Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_

_Want to propose a challenge idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
Many ways to use Apollo
Tags: graphql, react, reactnative, javascript
Published: 2019-09-21 15:15:05

---
description: Apollo has established itself as the most widely used package to use GraphQL on the client side with React. In each version, the usage of Apollo has evolved considerably. There are several ways to use Apollo.
---

Apollo has established itself as the most widely used package to use GraphQL on the client side with React.

In each version, the usage of Apollo has evolved considerably. There are several ways to use Apollo.

Today separate between several packets:
- @apollo/react-hooks
- @apollo/react-components
- @apollo/react-hoc

It is sometimes disturbing to work on another project using Apollo differently.

**But keep calm**

![Keep Calm](https://media1.tenor.com/images/1e3359b1e4b32e4189fa442f92190f75/tenor.gif?itemid=14112646)

Without going into details in this article. I created a GitHub project with 4 different ways to use Apollo :
**- [https://github.com/Bastorx/ManyWaysToUseApollo/](https://github.com/Bastorx/ManyWaysToUseApollo/) -**

In the project, you would find a basic router, leading to 4 identical pages, all in a different way to use Apollo

These are described in `/app/src/containers`

If you are interested, I invite you to discuss or contribute if you have experienced a different way of using Apollo

***Bastien Chevallier
https://bastienchevallier.com***

*PS: This was my first article, so if you have any constructive comments to improve me, feel free to*
Need Help About Cross Browser Compatibility
Tags: ask, code, help, browser
Published: 2019-09-21 14:46:57

Dear All  

I need some help about cross browser compatibility for my website ->  [https://angora.me/blog/](https://angora.me/blog/)  

And here is my CSS code -> 
[https://angora.me/style.css](https://angora.me/style.css)  

On modern browser, my website looks fine like this ->  
![](https://thepracticaldev.s3.amazonaws.com/i/8fdhnzqkvmljncqan763.png)  

But on some old browser, my website looks ugly like this ->  
![](https://thepracticaldev.s3.amazonaws.com/i/3blwd0fk90823dvj63ap.png)  

Even failed connection like this ->  
![](https://thepracticaldev.s3.amazonaws.com/i/elf7wyssh92z9wpzelib.png)  

I use Hugo with Netlify and Let's Encrypt SSL. I don't know if this compatibility issue is from my code side, SSL side, server side, browser side, etc? Any idea how to fix this issue?  

Regards
what are your thoughts on Microsoft going opensource?
Tags: discuss
Published: 2019-09-21 14:30:55

---
title: what are your thoughts on Microsoft going opensource?
published: true
description: 
tags: #discuss
---
As you can see in the recent years Microsoft has open sourced many of their projects to show their adoptation of open source despite it's hatred for Linux and opensource in the past? What are your thoughts?
Javascript🔥 and Everything🔥
Tags: javascript, webdev, discuss, beginners
Published: 2019-09-21 14:12:48

**Javascript** was developed in 10 days, in 1995. It wasn't the same like it is today, it has undergone drastic and revolutionary changes made to put Javascript in a position where it is sufficient in powering most of the web, mobile and even the desktop applications.

 From just a language to making interactive pages, it has evolved to a whole new lev where servers are built using Javascript. In other words **Javascript** is everywhere. There are many developers and engineers involved in this entire long process of development, one of them is offcourse **Ryan Dahl**. 

I came across this tweet from the creator of Javascript, where he is discussing about the design issues regarding the development of the language

![Javascript](https://i.imgur.com/hSs8DNl_d.jpg?maxwidth=640&shape=thumb&fidelity=medium)

**What do you think about this tweet?** 🤔
Fish Shell: string replace
Tags: fish, shell, string, replace
Published: 2019-09-21 13:47:32

---
title: Fish Shell: string replace
published: true
description: fish shell has powerful string modules. The subcommands are lower / upper, trim, sub (string), split, join, repeat, length, match and so on. Thus we can replace strings via fish shell. It's easy :)
tags: fish, shell, string, replace
---

[fish shell](https://fishshell.com/) has powerful [string](https://fishshell.com/docs/current/commands.html#string) modules.
The subcommands are `lower` / `upper`, `trim`, `sub` (string), `split`, `join`, `repeat`, `length`, `match` and so on.

Thus we can `replace` strings via fish shell. 
It's easy :)

The usage is:

```console
$ string replace [(-a | --all)] [(-f | --filter)] [(-i | --ignore-case)] [(-r | --regex)] [(-q | --quiet)] PATTERN REPLACEMENT [STRING...]
```

Besides, my current fish version is 3.0.2.


Well, for example, this is how to replace a file name with one that the size information is added to:

```console
$ string replace -r "\.jpg\$" "\-360x.jpg" "some-file-name.jpg"
```

With iteration, it becomes more powerful 😉

```console
$ for x in ./*.jpg; mv "$x" (string replace -ar "\.jpg\$" "\-360x.jpg" "$x"); end
```

This one-liner program renames files with a regular expression pattern via `string replace`.