teleren/devto huggingface dataset:
My Regex Cheatsheet - 25 Example Regex Rules
Tags: regex, javascript
Published: 2018-04-29 01:35:25

---
title: My Regex Cheatsheet - 25 Example Regex Rules
published: true
cover_image: https://thepracticaldev.s3.amazonaws.com/i/y9tqms6lamb7wilkkvlo.JPG
description: I had a hard-time finding a great article that outlined the rules of Regex. So, I'm mostly writing this for myself in the future.
tags: regex, javascript
---
First off, sorry for the clickbait dog photo. I read my title after typing this up and it sounded way to dry. So, I added a cool picture of my dog to spice things up.

...onto the post.

If you're like me, Regex can sometimes elude you. I've been looking for a great course on the topic for almost 6 months now. Just something to make [regexr.com](https://regexr.com) actually useful...and not a site where I randomly try strings of code until something MAGICALLY works. 😬

Today, I found that course. And, I'm documenting my lessons here so that hopefully someone else can benefit.

{% gist https://gist.github.com/tylerzey/d220867bd3221f9756edda94797a64d0 %}

In terms of using these functions, here are the most common js functions:

1) exec() [About The Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec)
- This function returns an array or null.
2) test() [About the function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test)
- This function returns true/false if it was found
3) search() [About the function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/search)
- This function returns the index the search finds the regex at or -1 if it doesn't find anything
4) replace() [About the function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace)
- This function returns a new string with the search being replaced.



The best course I found for this was a JS course by Brad Travery on Udemy. [Here's the link](https://www.udemy.com/modern-javascript-from-the-beginning/). I highly recommend it. He covers some great ways to structure your JS files and more.
Installing DotNet Core in Ubuntu 18.04
Tags: dotnetcore, ubuntu, bionic, beaver
Published: 2018-04-28 22:45:05

---
title: Installing DotNet Core in Ubuntu 18.04
published: true
description: Steps to install DotNet Core in Ubuntu 18.04
tags: dotnetcore, ubuntu, bionic, beaver 
cover_image: https://tecnoec.files.wordpress.com/2018/04/dotnet-core-ubuntu-18-04.jpg
---

---
#Update

Since the time this article was published Microsoft has released the official way of installing DotNet Core you can find them in [DotNet Ubuntu 18.04 Downloads](https://www.microsoft.com/net/download/linux-package-manager/ubuntu18-04/sdk-current) 

---

With the release of Ubuntu 18.04 the new LTS version of the popular Operating System, people might be eager to try **dotnet** on the platform.

Sadly, at the time of writing this post, neither the page getting stater page [DotNet Get Stated](https://www.microsoft.com/net/learn/get-started/linux) nor the downloads page [DotNet Downloads](https://www.microsoft.com/net/download/linux) list a compatible package with this OS.

In fact, if you try to install following the instruccions for the closest release which was 17.04 [Instructions Ubuntu 17.04] 
(https://www.microsoft.com/net/download/linux) you will get an error of missing dependencies.

In order to install you have to used the following steps as it is indicated in this [GitHub issue] (https://github.com/dotnet/core/issues/1400).

## Registering Microsoft keys and feeds

It is necessary to add the keys and the feed to the system so you have to type in a terminal the following commands.

    sudo apt-key adv --keyserver packages.microsoft.com --recv-keys EB3E94ADBE1229CF

    sudo apt-key adv --keyserver packages.microsoft.com --recv-keys 52E16F86FEE04B979B07E28DB02C46DF417A0893

To add the feed you need to type:

    sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic main" > /etc/apt/sources.list.d/dotnetdev.list'

And update the packages list with

    sudo apt-get update

## Installing DotNet Core

To install dotnet you can use the stable version with:

    sudo apt-get install dotnet-sdk-2.1.105 

Or the newest preview version with:

    sudo apt install dotnet-sdk-2.1.300-preview2-008533

Remember that you can have both installed side by side, newer dotnet have the **dotnet --list-sdks** and **dotnet --list-runtimes**, although the newest will be used if it is not overridden with a **global.json file**. You can find more info in this [Scott Hanselman's post](https://www.hanselman.com/blog/ManagingDotnetCore20AndDotnetCore1xVersionedSDKsOnTheSameMachine.aspx). Also

## Testing the installation

Inside a folder create a new console project with:

    dotnet new console

To run it, you need to use:

    dotnet run

And everything works correctly qou will be able to see a Hello World message on your terminal:

    Hello World!
How do we architect technology to solve the privacy problem of the internet?
Tags: discuss
Published: 2018-04-28 17:28:31

---
title: How do we architect technology to solve the privacy problem of the internet?
published: true
tags: discuss
---

I've long thought about how one might use internet services but still maintain my data. I've imagined a system where an application connects to a database you own. Is it that simple or am I missing something?
Weekly UI Challenge Week 3 Day 7: Tweak, refactor, and/or fix your code
Tags: ui, weeklyui, challenge
Published: 2018-04-28 16:32:26

---
cover_image: https://thepracticaldev.s3.amazonaws.com/i/4y9hihc5u5h1rplv80mv.png
title: "Weekly UI Challenge Week 3 Day 7: Tweak, refactor, and/or fix your code"
published: true
description: "Week 3 Day 7 of my Weekly UI challenge: All the fixings"
tags: ui,weeklyui,challenge
---

Welcome to Week 3, Day 7 of my Weekly UI challenge! Week 3 will focus on a **results page** UI component; each day throughout this following week, I will pick one or two (usually related) subelements of the design to implement. For day seven, our goal is to…

## Tweak, refactor, and/or fix your code

Today is all about you and your design/code perfectionism. Did you want to change your component API to be more flexible? Did you mean to tweak spacing on Day 5 but didn't have time? Perhaps you needed more time to research how to fix a few more a11y issues before you get that perfect score on Day 6. We all have to get sleep, spend time with friends and family, and have other things pop up that may affect your workflow; today is your day to finish strong and get everything up to spec as *you* see fit.

Please add your repos and/or images of your designs in the comments for inspiration! I would love to see what you all created throughout the week.

Happy fixing! 🎉

### Week 3 Calendar

1. (Sunday 4/22) Design component ✅
2. Result entry, sponsored/best seller indicators ✅
3. Grid/list view toggles ✅
4. Sorting ✅
5. Pagination/load more ✅
6. 100% a11y score ✅
7. Tweaks, refactors, fixes 🎯
Array reference... and how to not!
Tags: javascript, array, reference, tricks
Published: 2018-04-28 15:56:48

---
title: Array reference... and how to not!
published: true
description: 
tags: javascript,array,reference,tricks
---

#Sometimes it's sticky...

Look at this code... what do you think is going to happen to the _breeds_ array?

```js
let breeds = ["Labrador","Akita","Siamese"]

// Let's make an array of only Dogs Breed... splice out Siamese.

let doggy = breeds;

doggy.splice(2)

console.log(doggy)
// -> ["Labrador", "Akita"]

console.log(breeds)
// -> ["Labrador", "Akita"]
```

So... we just wanted to change the doggy _array_, and not the _breeds_ one.

We told JavaScipt:
1. I want a new array;
1. Call It _doggy_;
1. Give doggy the **same values** of _Breeds_;

```js
let doggy = breeds;
```

But Javascript with the _"="_ has created a **REFERENCE**.

With our declaration _doggy_ and _breeds_ are pointing at the "same object" by reference... the same memory, and by changing one, you're changing both!

<center>**evil TWINS**</center>

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


#Let's make a list... how not to create a reference

If we want to pass just the _values_ of an array into another, and at the same time create a _"new object"_.
We can use this useful methods.

```js
//1. Create a copy with slice.
let doggy = breeds.slice();

//2. Create a concatenation with an empty array.
let doggy = [].concat(breeds);

//3. Spread an array into another one.
let doggy = [...breeds];

//4. Use the Array.from() method, to create an array, with the same value of //another one
let doggy = Array.from(breeds);
```

All the methods, up here, are creating a totally **NEW** _doggy_ array, without any reference to the _breeds_ one.
You can now take off the _Siamese_ without any collateral effect.


```js
let breeds = ["Labrador","Akita","Siamese"]

let doggy = breeds.slice();

doggy.splice(2)

console.log(doggy)
// -> ["Labrador", "Akita"]

console.log(breeds)
// -> ["Labrador", "Akita", "Siamese"]
```

<center>Now they're in different arrays... but can still love each other!</center>

![love](https://media.giphy.com/media/796g6BvEXi7v2/giphy.gif)
Just got AWS Certified
Tags: certification
Published: 2018-04-28 10:58:13

---
title: Just got AWS Certified
published: true
description: 
cover_image: https://thepracticaldev.s3.amazonaws.com/i/1226a2rbpj8qysw2b080.jpg
tags: certification
---

[As I wrote](https://dev.to/kayis/going-full-stack-with-aws--a-cloud-guru-56ch), I tried to get into back-end development to become a full-stack dev with AWS certification and did the next step in that journey.

After learning for about three weeks I finally took the first two exams the __AWS Solutions Architect Associate__ (SAA) and the __AWS Developer Associate__ (DA) exam. Since the testing centers are rather far away, I could only take two and will be taking the third and final associate exam next month when I'm near the next center.

Thanks to my buddy [Adrian Föder](https://github.com/afoeder), who took these exams with me. Having a fixed date really pushed me into finishing this, haha.

## Difference

When I started I asked myself: which certificate should I take? Which is the right one for me?

Somehow they differed in name, but these names didn't really say anything to me.

I read a bit but it didn't really help. An solution architect was just a fancier name than developer for me.

First I wanted to go with the DA, because the name spoke to me.

I started to search for online training and found [A Cloud Guru](https://acloud.guru/), they make money from certification training so they were inclined to say "TAKE ALLE THE EXAMS!", but since I didn't found a big difference between two of the associate certificates anyway I thought: well, why not? They aren't _that_ expensive so why not do all?

After doing the courses and taking the exams I can finally say: Well they aren't that different.

Somehow the two overlap about 70%.

The SAAs remaining 30% is more about choosing the right technology. Think "When to install your MySQL on EC2 and when to use RDS?"

The DAs remaining 30% is more about using the APIs right and some implementation details you need to consider for performance/security reasons. Think "How much capacity units do you need to provide for your DynamoDB table?"

I found this a bit sad, they should have differentiate them more.

## Difficulty

My friend, who took a few cert exams in his time, said they were really hard, but fair. 

Many people said the DA is easier. If you worked with S3 and DynamoDB for years, you probably got most of the details covered, but I never did that, so I had the impression the SAA was easier.

In the end I had 77% in the SAA and 88% in the DA. So the outcome was quite different from what I expected.

## Next

My next step is learning the rest needed for the __AWS SysOps Administrator__ which I'm gonna take next month.

And then? I don't know!

Hopefully getting some nice projects :D

I'm really into this whole Serverless thing with [SAM](https://github.com/awslabs/serverless-application-model). The [Mobile Hub](https://aws.amazon.com/de/mobile/) also seems rather interesting with [AppSync](https://aws.amazon.com/de/appsync/) and [Amplify](https://github.com/aws/aws-amplify).
The way I have learned programming
Tags: learntocode, programming, webdev
Published: 2018-04-28 10:55:15

---
title: The way I have learned programming
published: true
description: I have learned programming 16 years ago and right now I continue to learn things every day. By the way I improved how I learn. In this article, I will teach you how is my process after a many years of programming and learning many things.
tags: Learn to Code, Programming, Web Development
---
---

![Programming](https://thepracticaldev.s3.amazonaws.com/i/c6758lhjd6q249bffkko.png)

I have learned programming 16 years ago and right now I continue to learn things every day. By the way I improved how I learn. Here, I will teach you how is my process after a many years of programming and learning many things.

For me, there are **3 levels** of expertise in the field you want to learn:
- **Basic flow and concepts**, for this I recomend videos
- **Intermediate level**, for this I recommend textual tutorials
- **Advanced level**, I recommend technical documentation and blog posts from experts in the field

# Videos 🎥

Videos are really nice when you don’t know how or where to click in the screen. I see video tutorials when I don’t know how to do basic things such as using an IDE or the workflow of an specific tool. In these cases, seeing things in video is insightful.

# Textual Tutorials 📚

If you have learned the basics, you should read and follow textual tutorials. The main advantage is that reading tutorials is faster than seeing videos. Also you can copy & paste example code and try it out by yourself.

#Technical Documentation and Expert Blog Posts 📎

The best tip for being a better programmer is IMO:

> *Gain a deeper understanding of the system*. [André Staltz](https://staltz.com/)

After experimenting and applying the knowledge you learned in textual tutorials you can go ahead and read technical documentation that allows you to going **deeper** in the field.

Also, you should see for expert blogs that helps you with **advanced concepts and the best practices**. Follow them and constantly search for new articles.

And a bonus step …

# Iterate over and over ➿

Once you have an advanced level in a field, starts seeing for specific things or **complementary topics you feel uncomfortable with** and start seeing videos, read textual tutorials and so on.

There are many **amazing knowledge** out there and you can learn a lot if you are **curious** and **disciplined**. So I ecourage you to **start learning** something you want right now! A paradise of insights and awesomeness are waiting for you behind your screen.


---

I would love to read in the comments what is the way you learn, so go ahead and write it!

Thanks for reading :)
Explain Docker Like I am Five
Tags: explainlikeimfive
Published: 2018-04-28 10:39:44

---
title: Explain Docker Like I am Five
published: true
description: 
tags: explainlikeiamfive
---
Hello, I am Jysan Aziz. A Junior developer from software industry. Want to know a brief about docker. So, I will be obliged if someone explains docker like I am five about inner architecture and implementation.
Encouragement of Review Meeting
Tags: productivity, programming, coding, culture
Published: 2018-04-28 10:15:57

---
title: Encouragement of Review Meeting
published: true
description: An idea to encourage a smooth review process in development
tags: productivity,programming,coding,culture
---

Initially, I wrote this snippet for internal purpose as an answer for what I had heard from another team's product managers; "our team's review takes much time", "we are struggling to estimate exact development term".

Then I introduced an idea to have a review meeting for smooth review; then I found it's even worth to be public.

---

## Background

I recently heard some product managers (or even developers) are troubled with reviewing time. Is the situation like below?

~ One day ~

Manager: "How is your work going?"
Developer: "Almost finished, but... it still needs to go through review."
Manager: "Understood."

~ Another day ~

Manager: "Did your PR get merged?"
Developer: "Ah, not yet. I'll ping them again."
Manager: "Hmm, I see. How long does the review take?"
Developer: "Umm, not sure."

~ To be continued... ~

---

It's quite frustrating for everyone. Estimation by a developer tends to vary from the original one, and its release date does.

On the other hand, our team sometimes have kind of "pair reviewing" or "review meeting" for a complicated (large) pull-request in person. So far, it works so well that I'd like to share the way.

## Premises

Most of the review time issues are caused by a _large_/_complicated_ pull request, and lack of adequate description. 

So first of all, developers should;

- Split pull-requests into adequate size ones if possible
- Write an appropriate description, chart, wiki, etc. for a feature they develop

Even though the idea above is right, we are sometimes compelled to implement a _large_/_complicated_ pull request. And it will have been neglected for a long time...

## Details

To avoid such situation, our team sometimes have "review meeting." 

How?

1. An author who needs a review prepares PR and wiki (if necessary) beforehand, and book a review meeting
   - 2 or 3 is a good number of reviewers. If it's too much, all of them might not actively join a discussion.
2. The author explains his/her implementation by showing PR, wiki, chart, etc.
   - I know some devs are quite good at to write a chart.
3. A reviewer can ask/discuss anything anytime in the review meeting
   - Be calm. It's not an interview.
4. Note Questions/Discussion points as a review comment on GitHub
   - If we skip this step, some points will be missed.
5. After that, the reviewee reflects the content of the review meeting
   - Even if there are so many fixes, it's much easier to re-review since reviewers know why those changes are needed.

## Note

- Not all of the pull requests requires "review meeting" and "pair review."
- They are just communication tools, so
   - If you are an author, don't be afraid to ask a review.
   - If you are a reviewer, it's quite encouraged to pay a high compliment to one's code.
Fellow runner devs out there? Would love to know what made you choose running
Tags: discuss, running, sports, hobbies
Published: 2018-04-28 09:29:07

---
title: Fellow runner devs out there? Would love to know what made you choose running
published: true
description: 
tags: discuss, running, sports, hobbies
cover_image: https://thepracticaldev.s3.amazonaws.com/i/iiy4mcty41nxzhhszn8u.jpeg
---

As posted on [my blog](http://www.preslav.me), I have recently reached my [longest running distance](http://www.preslav.me/2018/04/22/longest-running-distance-23-1km/) (23.1 km) without a single stop. For someone who had not done a single sport in his life up until two years ago, I find this quite remarkable.

I decided to use to opportunity, to look for other fellow runners among this wonderful community, as well as for what got them into the sport. 

Personally, I discovered running in my late 20s, after about about a couple of years of questioning my goals in life, my career, my personal life, etc. Running came out of nowhere - nobody made me do it. I just felt the need to move. Step by step, I made my first couple of hundred meters, all sweaty, hating myself for trying something so excruciating. I was ready to quit, but I kept on. And I am glad that I did. Running became my friend, my therapy, my meditation, my way of reading and learning (audiobooks and podcasts). With time, distances increased with less effort on my side, but besides, I saw significant transformations in both my body and moreover, my mind. 

Now, two years later, I am moving forward not to a small part because of running, and I wanted to tribute this post to this most natural and enjoying way of becoming both physically and mentally strong. As developers, we need this more than ever.

I am passing the mic on to you, fellow runners. I would love to know what got you into the sport, and how you keep up.
How can I preview emails on Apple Watch without one?
Tags: help
Published: 2018-04-28 08:30:52

---
title: How can I preview emails on Apple Watch without one?
published: true
tags: help
---

I'm testing email sent from my site, and I set up a separate text/watch section as advised. However, I do not have an apple watch. I'd like to see the emails before sending them to users who may have them.

Any ideas?

Ideally, I won't have to use the iOS simulator on my mac, but I will do that if it is the only way.
Linux Web Server (Apache)
Published: 2018-04-28 07:29:17

---
title: Linux Web Server (Apache)
published: true
description: 
---

1 How Web server Works
2 Linux Webserver Implementations
3 Understanding HTTP
4 Install Apache Web server
5 Configuring Apache Web server
5.1 ServerRoot Option
5.2 Listen Option
5.3 ServerName Option
5.4 DocumentRoot Option
5.5 MaxRequestWorkers Option
5.6 LoadModule Option
5.7 Include Option
5.8 UserDir option
5.9 Alias Option
5.10 ErrorLog Option
5.11 VirtualHost Option
5.12 Virtual Host Types
6 Apache Process Ownership
6.1 User Option
6.2 Group Option
7 suEXEC Support
8 Apache Authentication
9 Troubleshooting Apache Web server

https://likegeeks.com/linux-web-server/

Hope you like it.

Regards,
Background-Image-On-Load
Tags: react, javascript, style, css
Published: 2018-04-28 05:45:18

---
title: Background-Image-On-Load
published: true
description: A simple way to check `background-image` is loaded.
tags: react, javascript, style, css
---

# Background-Image-On-Load
A simple way to check `background-image` is loaded.

### Installation

npm:
```bash
npm install background-image-on-load --save
```
yarn:
```bash
yarn add background-image-on-load
```

### Usage
```js
import React, { Component } from 'react';
import BackgroundImageOnLoad from 'background-image-on-load';

class App extends Component {

  state = {
    bgIsLoaded: false
  };
  
  render() {
    const { bgIsLoaded } = this.state;
    return (
        <div
          style={{ 
            height: 300,
            backgroundPosition: 'center',
            backgroundSize: 'cover',
            backgroundImage: `url(${!bgIsLoaded ? 'https://picsum.photos/310/310?blur' : 'https://picsum.photos/1600/310'})`
          }}
        >
          <BackgroundImageOnLoad
            src={'https://unsplash.it/1200/310?random'}
            onLoadBg={() =>
              this.setState({
              bgIsLoaded: true
            })}
            onError={err => console.log('error', err)}
          />
        </div>
    );
  }
}

export default App;
```

If you like this library please click on the start button on github.

https://github.com/alirezavalizade/background-image-on-load