teleren/devto huggingface dataset:
JavaScript Async Functions
Tags: javascript, beginners
Published: 2021-01-09 11:29:26

#JAVASCRIPT ASYNC FUNCTIONS 

An async function is an object of AsyncFunction declared using the keyword async, also it can be used along with await keyword.

The await can only be used in a function that is declared aysnc. async/await functions can use try/catch block hence error handling for asynchronous code becomes easier. await makes the asynchronous function wait for either being resolved or rejected.

Async functions are used to improve the readability of code which are written to handle APIs that return promises.
```
function imageAPI(){
    return Promise.resolve(5);
}

on using async on the above function it becomes:

async function imageAPI(){
    return 5;
}
```
---

Async/await can be used like below for hooks served from API - 
```
async function imageAPI(){
   let data = await get('../somedoc.json');
   let objects = await data.json();
   await new Promise((resolve, reject) => setTimeout(resolve, 1000));

}
```
---

The rejection is handled with a try/catch block where if the promise results in an error the catch block should handle the code.
```
async function imageAPI(){
   let data = await get('../somedoc.json');
   let objects = await data.json();
   
}
imageAPI().catch(console.log(e));
```
---

await can be used with Promise.all where more than one promise can be handled.
```
async function imageAPI(){
    let data = await Promise.all([
    get('../1.json),
    get('../2.json)
 ]);
```
Pareto Principle (80/20 rule): An observation
Tags: management, lifecoach, planning, agile
Published: 2021-01-09 11:11:55

The 80/20 rule is one of the most helpful concepts for life and time management. Also known as the Pareto Principle, it’s a statistical principle that states that 80% of the results often come from approximately 20% of causes. 

Pareto principle is an observation, which points out that most things are not fair i.e 1:1, where each unit of “input” does not contribute exactly to the same amount of “output”

Other flavors of 80/20 are: 
80 % of the revenue comes from 20% of the sales. 
80 % of the results come from 20 % of the work we do.
80% of the time we use 20 % of the apps on our phone.

[*Microsoft’s CEO*](https://www.crn.com/news/security/18821726/microsofts-ceo-80-20-rule-applies-to-bugs-not-just-features.htm) once stated that *"solving 20 % of the bugs would solve 80 % of the system crashes"*.


*How to implement it is real life*: 
1.	Planning before execution is the key– Spend roughly 20 % of the time planning on activities you want to do and then 80 % on the execution part after thorough planning.
2.	Make a list of activities you do daily 
3.	Check out the ones you really feel are critical 
4.	Non-Checked one, strikeout. 
5.	Repeat it a couple of times to gain clarity

**Final Thoughts**: 
Life is not fair and this principle may not be the best strategy in all use cases. A principle of the 80-20 rule gives clarity of thought. 
Again it’s an observation 😊  

Recently, I came across a book of [“The Small Book of The Few Big Rules”](https://www.outsystems.com//blog/-/media/Files/Resources/The-Small-Book-of-The-Few-Big-Rules-OutSystems.pdf) by [OutSystems](https://www.outsystems.com/). It’s worth a read. 
Note: *I'm not associated with OutSystems.*
Linear Gradient Picker
Tags: html, css, javascript, beginners
Published: 2021-01-09 10:29:10

###CSS Gradient###
CSS Gradient is a happy little website and a free tool that lets you create a gradient background for websites. Besides being a CSS gradient generator, the site is also chock-full of colorful content about gradients from technical articles to real life gradient examples like Stripe and Instagram.

Please Guys Rate My Project
**<a href="https://stackfindover.com/gradient-picker/" rel="dofollow" target="_blank">Gradient Picker</a>**
Useful Java KeyStore Keytool Commands
Tags: java, keytool, jdk
Published: 2021-01-09 09:58:09


#### Create Self-Signed Sertifika and KeyStore

```bash
>keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 720

```

#### Create CSR Certificate

```bash
>keytool -certreq -alias mydomain -keystore keystore.jks -storepass password -file mydomain.csr

```

#### Delete Certificate from KeyStore

```bash
>keytool -delete -alias mydomain -keystore keystore.jks -storepass password
```

#### Add Signed Primary Certificate to KeyStore

```bash
>keytool -import -trustcacerts -alias mydomain -file mycrt.crt -keystore keystore.jks
```

#### Change KeyStore Password

```bash
>keytool -storepasswd -new new_storepass -keystore keystore.jks
```

#### List KeyStore

```bash
>/JAVA_HOME/jre/bin/keytool -list -keystore KeyStore -storepass password
```

#### Create Private Key

```bash
>keytool -genkey -alias KeyToolAlias -keystore privateKey.store

# Enter keystore password:
>1234

# What is your first and last name?
>John Smith
# What is the name of your organizational unit?
>Sowtware Development
# What is the name of your organization?
>dev.to
# What is the name of your City or Locality?
>Istanbul
# What is the name of your State or Province?
>Besiktas
# What is the two-letter country code for this unit?
>TR
# Is your infos correct?
>yes
```
DO Hackathon Dev Log #1
Tags: nextjs, chakraui, react, passportjs
Published: 2021-01-09 10:05:21

Well... I have procrastinated long enough and it is time to start the hacking! 

Inspired from my meat head tendencies, I am going to create a simple react app that allows a user to calculate their 1, 3, 5 (etc) rep max and create a warmup template for them to follow on the big day. 

I will be using the following tech stack: 

* React 
* Next.js
* MongoDb
* Passport.js
* Chakra UI
* Digital Ocean App Platform


Lets Hack Some Shit!
How to promisify node callbacks
Tags: javascript, node, programming
Published: 2021-01-09 09:56:53

Consider having a classic callback in NodeJS like this one:

```javascript
const fs = require('fs');

function readMyFile(myfile, options) {
    fs.readFile(myfile, options, function(err, file) {
        if(err) {
            console.log('err', err);
        } else {
            console.log('file', file);
        }
    });
}

readMyFile('myfile', 'utf8');
```

What if you want to do something like this

```javascript
...
readMyFile('myfile', 'utf8')
    .then(file => console.log('file', file)
    ...
```

You can manually tranform your callback into a promise like this:

```javascript
const fs = require('fs');

function readMyFilePromise(myfile, options) {
    return new Promise((resolve, reject) => {
        fs.readFile(myfile, options, function(err, file) {
            if(err) {
                console.log('err', err);
                reject(err);
            } else {
                console.log('file', file);
                resolve(file);
            }
        });
    });
}

readMyFilePromise('myfile', 'utf8')
    .then(file => console.log('file', file))
    .catch(err => console.log('err', err));
```

The good news is you can use the [util module](https://www.npmjs.com/package/util) to do that. Moreover Util is built in nodejs.

You just have to do this:

```javascript
const util = require('util');
const fs = require('fs');

const readPromise = util.promisify(fs.readFile);
readPromise('myfile', 'utf8')
    .then(file => console.log('file', file))
    .catch(err => console.log('err', err));

```

Have fun
:)
Developing a Grocery app that works🤞🏽(during a pandemic). 
Tags: ux, appdevelopment, mobile, app
Published: 2021-01-09 09:30:58

First nine dyas of January and it's also my first day of school learning UXID.

In my timezone, I'm technically right on schedule in starting my UX Interaction Design course. I was a day early but anyway, the school's in. The first-day introduction has been by far really good. I also found out that one of my major project in the course involves making a grocery app which I think is the standard for anyone doing UXID. 


I am scared quite honestly, but then I've come to terms that things really won't go back to how it was before.I have a vague unease towards that with a faint qualm too. So it only made sense that things shift digitally to combat the threats and constraints that we all have. Though scared, I wanted to put my energy on something good - something that will help me cope and overcome.

I'm keen to know what grocery apps are considered reliable and by far have a friendly UX and UI, and perhaps have a good learning curve for such a time as this.

I've looked for a few which are:

Tare Grocery: https://shop.taregrocery.com/
Out of Milk: https://www.outofmilk.com/
Insta Cart: https://www.instacart.com/

Nervous but also very excited to create something meaningful despite the ongoing pandemic. 

HNY everyone! :)

P.S photo from @gulayatprutas
Face Mask Detector
Tags: python, opencv, covid19, showdev
Published: 2021-01-09 09:17:00

This is an application that I wrote in python to detect the face mask due to the covid-19 situation. It uses two haarcascades to detect face and the mouth. The following image shows the output when a person appears without a face mask. 

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

The following image shows the output when a person with a mask is staring at the camera.

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

Yeaaah cool !!!

But what about your pet ? 😜

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

## Github Repository
 
[Face Mask Detector](https://github.com/vae97/Face-Mask-Detector)

## References

[Mouth Recognition HaarCascade.](https://github.com/Shaligram1234/Python/blob/master/Face_Mask_Detection/data/xml/haarcascade_mcs_mouth.xml)

[Face Recognition HaarCascade.](https://github.com/opencv/opencv)
Beautiful Colored Gradients
Tags: html, php, css, webdev
Published: 2021-01-09 09:14:50

Looking for [colored gradients](https://hexcolor.co/gradient-colors) for your graphic, web, or UI design? Coolest handpicked gradient hues for your next super 👌 amazing stuff. A free collection of 200 linear gradients that you can use as content backdrops in any part of your website. You can download a .png version of each gradient and copy their CSS3 cross-browser codes. Sketch and Photoshop packs are available as well. 

![Beautiful Colored Gradients](https://dev-to-uploads.s3.amazonaws.com/i/yizicrh8n8wtk3vuyj6y.gif)

Hexcolor.co is a free and open platform for color inspiration with thousands of trendy hand-made color gradients.

**[https://hexcolor.co/gradient-colors](https://hexcolor.co/gradient-colors)**
Differences between Error, Defect, Failure and Risk
Published: 2021-01-09 09:12:42

Error(오류) = Mistake by human

Defect(결함) = Fault = Bug
     ↓
     Failure(장애) = Defect + more = Issue = Incident
          ↓
          Risk(리스크) = probability of failure x business impact


They all look similar, but there are the some differences as above.

Somethings are added to the 'Defect' and becomes an 'Failure'
Somethings are added to the 'Failure' and becomes a 'Risk'.

In other words, the further down the 'Risk' is, the more comprehensive it becomes.


** Source: https://myinbox.tistory.com/4
Crack The Coding Interview With Me: Merge Sort
Published: 2021-01-09 08:57:23

## 📚 Theory:
{% youtube KF2j-9iSf4Q %}
# More Sources:
* [Video explanation](https://www.youtube.com/watch?v=4VqmGXwpLqc)
* [interviewcake.com](https://www.interviewcake.com/concept/javascript/merge-sort)

## 👩‍💻 Code:

{% gist https://gist.github.com/olg200492/f282ff14d7934f1363efbef6123d4314 %}

## 🗃 Interview Questions
* [LeetCode](https://leetcode.com/problemset/all/?page=1&topicSlugs=merge-sort)
* [sanfoundry.com](https://www.sanfoundry.com/merge-sort-multiple-choice-questions-answers-mcqs/)
* [GeeksForGeeks](https://www.geeksforgeeks.org/tag/merge-sort/)
* [toptal.com](https://www.toptal.com/algorithms/interview-questions)
DO Hackathon Submission: Personal Site/Portfolio
Tags: dohackathon, javascript, css
Published: 2021-01-09 04:07:21

## **What I built**
I built a new version of my personal site hence I named it v2.0 in the header. It had been a year since I learnt Web development and there's a lot more for me to get my hands on. This hackathon motivated me to learn a new CSS library, hence giving a upgrade to my old site.

### **Category Submission:** 
Personal Site/ Portfolio


### **App Link**
[Click here](https://georgey-r9zrh.ondigitalocean.app/)

### **Screenshots**
![georgey-homepage](https://res.cloudinary.com/dapafwlvo/image/upload/v1610004896/1_fv8q5b.jpg)<br>
![georgey-languagespage](https://res.cloudinary.com/dapafwlvo/image/upload/v1610005376/2-retake_j9zypy.jpg)<br> 
![georgey-darkmode-page](https://res.cloudinary.com/dapafwlvo/image/upload/v1610005126/3dark_sg0gxp.jpg)


### **Description**
So before starting the project I had made up my mind to learn a new framework else it had to be my mentor who would teach me. So at first I was little hesitant to start. I was getting certain thoughts like would I be able to implement it properly or would it become a disaster at last but eventually it weared off and I started working on the project **v2.0** of my personal site.
 

### **Link to Source Code**
Source code on [GitHub](https://github.com/GeoBrodas/personalPortfolioSitev2)

### **Permissive License**
[MIT License](https://github.com/GeoBrodas/personalPortfolioSitev2/blob/master/LICENSE)


## **Background**
So basically I had almost completed my Web Development Bootcamp Course when I came to know about the hackathon, and so I wanted to test my skills I have learnt hence I thought this would be a good chance not only to apply my skills but to learn a new library too which would speed up my work. I was hooked up in my academics but this hackathon gave me a reason to come back to coding and revive.
I had already created a personal site but there was very less functionality to it, less interaction, and I had hardly used BootStrap in it and therefore voila! 

### **How I built it** 
First of all Thanks a lot to **Digital Ocean** for giving this opportunity and a reason for me to skip my academics because I love coding and my friends think I'm weird but I don't care because there's thousands like me and I have interacted with many too.

Well there are 3 new features I learnt and I added to my site and thats :-
+ I used TailWind CSS library.
+ I implemented a Light and Dark mode to the website which toggles according to the OS theme of the users device.
+ I added a AOS library by [Michal Sajnóg](https://twitter.com/michalsnik)


### **Additional Resources/Info**
+ [Tailwind CSS Library](https://tailwindcss.com/)
+ [AOS Library](https://github.com/michalsnik/aos)  by Michal Sajnóg.
What license to use for private NPM/node or composer packages
Tags: opensource
Published: 2021-01-09 08:40:23

As much as I love open-source, not every project or package is meant to become open-source. Especially commercial projects are usually not released under an open-source license. For these cases you can use:

*   Private NPM/yarn packages with a license defined as **"UNLICENSED"** should do the trick. Make sure to not confuse it the "UNLICENSE", which is open-source.

*   Private composer packages can use the license key **"proprietary"** to avoid issues.

That's it. More a public note here than an article, but I guess that's fine.

---
# Other articles of mine that you might like
- [Personal Discovery Journey Into Code-World: FaaSD and OpenFaaS](https://spekulatius.hashnode.dev/personal-discovery-journey-into-code-world-faasd-and-openfaas)
- [Thank me later: How to install PHP ext-intl in docker on Alpine Linux](https://spekulatius.hashnode.dev/thank-me-later-how-to-install-php-ext-intl-in-docker-on-alpine-linux)
- [Common Issues using Laravel Websockets with beyondcode/laravel-websockets](https://spekulatius.hashnode.dev/common-issues-using-laravel-websockets-with-beyondcode-laravel-websockets)
- [PHPScraper and Python3 BeautifulSoup in Comparison](https://spekulatius.hashnode.dev/phpscraper-and-python3-beautifulsoup-in-comparison)
- [How to Upgrade Your Node Versions on Linux Development Machines and Keep up to Date](https://spekulatius.hashnode.dev/how-to-upgrade-your-node-versions-on-linux-development-machines-and-keep-up-to-date)
A basic chat app with React, TailwindCSS, Node, and Socket.io 🦜
Tags: javascript, node, react, tailwindcss
Published: 2021-01-09 08:30:54

Github: https://github.com/lucasmrl/chat-app
Demo: http://chat-app-on.herokuapp.com/

Hey, devs!

I have some ideas for real-time apps, and this project was meant to give me an idea of how to use Socket.IO. Fun experience! Easy to use!

Basically, I followed the available tutorial on the socket.io website. Then, there are quite a lot of examples of chat apps using these technologies. It was really worth it!

Happy new year! 😅
Learn to develop an on-demand roadside assistance app the simplest way
Tags: android, showdev, startup, mobile
Published: 2021-01-09 07:50:16

According to Acumen Research and Consulting, the roadside assistance industry is set to reach 29 USD billion by 2026. And it's no big surprise that the industry will be a huge hit in the future as more and more vehicles on the road and people love traveling. 

Entrepreneurs are trying to start their roadside assistance venture by launching their applications. 

So that the customers can book their services instantly using their mobile applications. 

## How [on-demand roadside assistance app](https://www.rentallscript.com/blog/on-demand-roadside-assistance-app-development/) works? 

The working model of the roadside assistance app is as same as other on-demand apps. 

1. The customers and the service provider will register their profiles in the app. 
2. In case of an emergency, the customers will search and book the required service via a mobile application. 
3. The service provider accepts the request and reaches the customers' location. 
4. After providing the service, the customers pay for the service and rate the provider based on the quality. 

## How do you start an on-demand roadside assistance business?

To start a roadside assistance business online, you need a powerful mobile application that allows customers to book the services. 

Creating a mobile app is considered to be one of the difficult processes in the past decades. But now, technological advancements made it so easy. 

You can either create an on-demand roadside assistance app from scratch, or you can use the readymade solution available in the market. 

**Benefits of using readymade solutions,** 

-Faster development process
-Less resource requirements
-Low cost of development
-Faster time to market

## Ready to create your on-demand roadside assistance app using a readymade solution? 

Then, try **Wooberly**,  a complete on-demand app solution that can be used to create any on-demand services app instantly. 

**Benefits of using Wooberly,** 
-You can get the 100% source code
-It is customizable 
-Scalable to any extent
-Reach a global audience
-Complete support even after launch
-Unlimited updates

Still confused? Get a free demo by contacting them via [WhatsApp.](https://api.whatsapp.com/send?phone=tel:+919626360033)
Macfolio - DigitalOcean App Platform Hackathon
Tags: dohackathon, portfolio, hackathon, digitalocean
Published: 2021-01-09 07:37:06

## 🔰 What I built
I built my portfolio website in a unique way. Everybody is familiar with MacOS but how much would it be amazing to experience the UI/UX of MacOS in Web View. I hope you would get amazed and enjoy my work.
As it's a combination of MacOS and Portfolio, I named it 'Macfolio'.


### Category Submission: 
Personal Site/Portfolio

### App Link
[https://genialkartik.tech/](https://genialkartik.tech/)

### Screenshots
![Macfolio ScreenShot](https://dev-to-uploads.s3.amazonaws.com/i/8z25n3fpw1zlym4wwucy.jpg)
![Windows in Macfolio](https://dev-to-uploads.s3.amazonaws.com/i/cipnnvwin0vjtv4k0wd6.png)

### Description
Macfolio is my visionary project and I initiated this project as Personal Portfolio website. But it is much more than that. The Vision behind this project is to create a futuristic OS which will entirely work on/upon Cloud. Also, the use cases and outcome are endless, it'll be helpful to work using AR (Augmented Reality) and VR (Virtual Reality). Think it like - You can code or do whatever you do on laptop/PC by wearing glasses only (something like this: Instagram ). Sounds fascinating but improbable, right!
This project will also be helpful in getting rid of carrying bulky hardware devices and their unbearable costs. The used cases of this project are boundless. 

### Link to Source Code
[https://github.com/genialkartik/Macfolio](https://github.com/genialkartik/Macfolio)

### Permissive License
[MIT License](https://github.com/genialkartik/Macfolio/blob/master/LICENSE)

## Background
I got my inspiration for this project after visiting some amazing developer's portfolio website like [https://bruno-simon.com/](https://bruno-simon.com/) and [http://www.prateeknarang.com/](http://www.prateeknarang.com/).
I open sourced this project as well.

### How I built it 
I build this project using MERN Stack and hosted it on [Digital Ocean](https://digitalocean.com/) Platform. Used VS Code editor and Open Sourced my code on [Github](https://github.com/genialkartik/Macfolio).
12 Useful OpenShift Commands You Should Know
Tags: devops, kubernetes, opensource, cloud
Published: 2021-01-09 06:48:03

# Introduction

Redhat OpenShift is a Container Management and a Hybrid Cloud Platform. It gives you the ability to develop and run containerized applications along with OOTB integration with existing DevOps tools. Checkout OpenShift [documentation](https://docs.openshift.com/) for more details.

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

`OC` CLI is used to perform various operations on OpenShift. It is similar to `kubectl` CLI and offers all the operations that you can perform with `kubectl` CLI plus additional support for native OpenShift features. Checkout `OC` CLI [documentation](https://docs.openshift.com/container-platform/4.6/cli_reference/openshift_cli/getting-started-cli.html#installing-the-cli) for more details.

# 12 Useful OpenShift Commands

I. Create Service Account `testsa`
```
oc create sa testsa
```
II. Add `anyuid` SCC to Service Account `testsa`
```
oc adm policy add-scc-to-user anyuid -z testa
```
III. Deploy `nginx` application using `nginx` Docker Image from Docker Hub with label `app=test`
```
oc new-app --docker-image nginx --name nginx -l app=test
```
IV. Scale up `nginx` application to 5 replicas
```
oc scale --replicas=5 dc nginx
```
V. Delete `nginx` application using label `app=test`
```
oc delete all -l app=test
```
VI. Export `nginx` application definition to `nginx.yaml`
```
oc new-app --docker-image nginx --name nginx -l app=test -o yaml > nginx.yaml
```
VII. Deploy `nginx` application using `nginx.yaml`
```
oc apply -f nginx.yaml
```
VIII. Deploy Node.js `Hello World` application using GitHub URL with label `app=test` and name `helloworld`
```
oc new-app https://github.com/sagar-jadhav/node-hello --name helloworld -l app=test
```
IX. Export `nginx` application to `nginx-template` template
```
oc export dc nginx --as-template=nginx-template
```
X. Set `requests` & `limits` of `nginx` application
```
oc set resources dc nginx --requests=cpu=250m --limits=cpu=250m
```
XI. Create Edge Terminated Route `nginx-route` for `nginx` service using `nginx.key` & `nginx.crt` files
```
oc create route edge nginx-route --service=nginx --key=nginx.key --cert=nginx.crt
```
XII. Create secret `user-creds` with values `user=admin` and `password=admin`
```
oc create secret generic user-creds --from-literal='user'='admin' --from-literal='password'='admin'
```