teleren/devto huggingface dataset:
Beginners guide to async-await in Javascript
Published: 2021-04-26 16:48:08

Async Await is syntactical sugar wrapped around to make the implementation of promises easier, If you don't understand how promises works make sure you check out [this post](https://dev.to/a_shokn/beginners-guide-to-promises-in-javascript-5efp)  

>The purpose of async / await is to simplify the syntax necessary to consume promise-based APIs.

Let's jump into an example that will help us understand Async Await in a better way.

```
function newRequest(place) {
	return new Promise((resolve,reject)=>{
  	if(place === 'home') {
    resolve('You have reached home');
    } else {
    resolve("You haven't reached home");
    }
  })
}

function makeRequest(response) {
	return new Promise((resolve,reject)=>{
  	console.log(response);
    resolve(`Current location:- ${response}`);
  })
}

newRequest('home').then(response =>{
return makeRequest(response);
}).then(makeResponse => console.log(makeResponse)).catch((err) => console.log(err));

//Output
//"You have reached home"
//"Current location:- You have reached home"
```

In the above example, the `newRequest` function returns a promise that takes a parameter place based on which promise is resolved. The `makeRequest` function returns a promise which is always resolved.   The two functions are executed in order the second promise waits for the first one.

The above code can be simplified by with the use of Async/Await

```
function newRequest(place) {
	return new Promise((resolve,reject)=>{
  	if(place === 'home') {
    resolve('You have reached home');
    } else {
    resolve("You haven't reached home");
    }
  })
}

function makeRequest(response) {
	return new Promise((resolve,reject)=>{
  	console.log(response);
    resolve(`Current location:- ${response}`);
  })
}

async function checkLocation() {
try {
const  response = await newRequest('home');
const  processed = await makeRequest(response);
console.log(processed);
} catch (err) {
console.log(err);
}
}

checkLocation();

//OUTPUT
// "You have reached home"
// "Current location:- You have reached home"

```

In this example, `checkLocation` is declared using the async keyword. The async keyword tells javascript that the following function is asynchronous. The `checkLocation` works exactly the same as the promises returning the same output. As you can see it looks a lot better and readable than the first example.
Error handling is done with the help of a try-catch block.


> Async Await is just like promises in a way makes it easier to write promises.

Thank you for your time. That's All folks
Job Search Tips 101
Tags: discuss, codenewbie, cnc2021, beginners
Published: 2021-04-26 16:47:15

---
title: Job Search Tips 101
published: true
tags: #discuss, #codenewbie, #cnc2021, #beginners
---

I hope these tips help focus the CodeChallenge #cnc2021 job hunters. What would you add/subtract?

1. **Find organizations** that interest you. 
2. **Research organization**.
    - Use: Google, Linkedin, Twitter,
    - Learn about its competitors,
    - Note recent important news (*Good or bad*),
    - Prepare company spreadsheet for info (*Basic or detailed, up to you*),
3. **Study Job Description**.
    - What do you have? 
    - What don't you have? (*Less Important*)
4. **Write out *YOUR* answers for common interview questions**.
    - Tell me a little about yourself,
    - What are your biggest strengths & weaknesses?
    - Where do you see yourself (*In x years, up to you*)?
    - Describe your dream job,
    - Why did you leave your last position or What have you done during your employment gap?
    - Why do you want this job?
    - What type of work environment do you prefer?
    - How would your co-workers or managers describe you?
    - Why are you the best candidate for this role?
    - What achievement(s) are you most proud of?
    - Tell me about a challenge you’ve faced at work and how you dealt with it?
5. **Practice your answers out loud**.
    - Make it feel natural,
6. **STAR**: Situation, Task, Action, & Result.
    - Explain the **Situation**; set the 'stage,'
    - **Task**; discuss the task set out for you
    - **Action**; explain the specific actions you took to handle the situation.
    - **Result**; describe the outcome you reached through your actions
    -  **Finally**; tie it back to their position with your final sentence.
WordPress REST API: Delete method returns an error
Tags: wordpress, javascript, php, tutorial
Published: 2021-09-18 13:38:14

---
title: WordPress REST API: Delete method returns an error
published: true
date: 2021-04-26 16:31:58 UTC
tags: wordpress,javascript,php,tutorial
canonical_url: https://indexforwp.com/quick-fix-wordpress-api-delete-method-returns-an-error/
---

WordPress provides `GET, POST, PUT, `and` DELETE` methods for a variety of content. In Index, we use the `/post/<id>` endpoint with the `DELETE` method to trash posts when a user clicks delete. This seemed pretty straightforward, but during testing we ran into a problem: our posts were not being deleted.

## The problem we ran into with DELETE

Every time we introduce a new feature to [Index](https://indexforwp.com/), or install it on a new machine, we do a few commands to make sure the core experience of the plugin is intact:

- Select and edit posts
- Select and trash posts
- Permanently Delete some trashed posts
- Restore some trashed posts
- Attempt all the above with a user role that can’t do it

Around December of last year, we started using [Local](https://localwp.com) for all local WordPress development. When we switched, we did the above steps. Everything worked great, except when we tried to trash posts. No matter what post we tried to delete, we would receive an unauthorized error, and the post was never removed. We double checked that our role should be able to delete posts, and once we confirmed that, we opened up the Postman app and tested some other api requests that require authentication. All of those were working, so why couldn’t we delete a post?

Next, we tried was removing a post from the Gutenberg editor. That worked, so clearly there wasn’t some unfixable issue with the web server. So we opened up our web inspector, reviewed the network requests and discovered that WordPress was using the same `post/<id>` endpoint, but it was using `POST` instead of `DELETE` for the method.

## The solution to deleting posts using the WordPress API

After some digging, we found that Local uses nginx as a web server and only has the `GET` and `POST` methods enabled for api requests (others like `PUT` and `DELETE` are not enabled). The solution ended up being simple, but might not be obvious to anyone that doesn’t work with APIs every day.

Send the request with the method set to `POST` and add an additional header to your fetch statement:

```javascript
'X-HTTP-Method-Override': 'DELETE'
```

Doing this ensures broader support for different hosting environments that may not have methods other than GET and POST enabled. Nothing has to happen on the PHP side, and if you are making your own endpoints with `register_rest_route`, you can keep setting up your methods per the WordPress documentation website.

## Author

{% user david_woolf %}
Our Continuing RenPy Pirate Game Journey
Tags: python, tutorial
Published: 2021-04-26 16:25:51

# Last Time
In our [last post](https://dev.to/iceorfiresite/learning-renpy-for-visual-novels-1onk), I introduced *RenPy* and outlined the story for our family-friendly Pirate Visual Novel/Choose Your Own Adventure.

# Moving Forward
In our [latest tutorial](https://www.iceorfire.com/post/our-renpy-game-part-5-variables-conditionals-and-screens), I explain RenPy variables, conditionals and screens. I'll show you how to allow the user to name the main character as well as add images that run code when clicked. I even have screenshots of the game so you can see what it'll look like.

# Let's Learn Together
I'm learning RenPy as I make these tutorials. I welcome your feedback and questions on [this project](https://www.iceorfire.com/post/our-renpy-game-part-5-variables-conditionals-and-screens)!

# Support Me
If you find these tutorials helpful, please consider [buying me a coffee](https://www.buymeacoffee.com/z4F8QVS6w). Thanks!
DESIGN PATTERNS
Tags: designpatterns, csharp
Published: 2021-04-26 16:21:43

**What are design patterns ?**

Software development is an iterative process and there may be many design problems during development. Design patterns are the solution to software design problems which every developer faces very frequently. Patterns are simply `reusable designs`.

**Types of design patterns**

There are three different types of design patterns :

1. Creational
2. Structural
3. Behavioural

**Creational Patterns**

These patterns are used for instantiation of classes. They are concerned with the way of creating objects. Normally object creation happens in the below way by using the new keyword.

```
Employee emp = new Employee();
```
The above code is more than enough for object instantiation, but in some cases `the object must be changed according to the nature of the program in runtime`, in such cases, creational design patterns will be useful.

* Abstract Factory
* Builder
* Factory Method
* Prototype
* Singleton

**Structural Patterns**

Structural design patterns are concerned with how objects and classes are composed. This pattern helps in simplifying the structure by identifying the relationships. It focuses on `how classes inherit from each other and how they are composed from other classes.`

The main goal is to `increase or extend the functionalities` of the class `without changing its composition.`

* Adapter 
* Bridge
* Composite
* Decorator
* Facade
* Flyweight
* Proxy


**Behavioural Patterns**

These patterns are designed depending on how one class communicates with other. Interaction between classes should be in such a way that `they should easily communicate with each other`; still thee classes would be loosely coupled.

* Chain of Responsibilities
* Command
* Interpreter
* Iterator
* Mediator
* Memento
* Observer
* State
* Strategy
* Template Method
* Visitor


**OTHER TERMS TO KNOW**

**What is an abstract class ?**

Abstract class means `hiding the implementation` and just `showing the function definition` to the user. Abstract classes `cannot be instantiated`, it should be inherited and then instantiation should be done for the subclass. It can `have both abstract and non-abstract methods`.

**What is a concrete class ?**

A concrete class is a class which has implementation for all of its methods. It cannot have any unimplemented methods. It is simply the sub class which is inherited from an abstract class.


![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wj93h68rwktlk79prohl.png)
Envrionment in .NET Core
Tags: dotnet, dotnetcore, csharp, environment
Published: 2021-04-26 16:20:08

We can setup different environments while developing an application in .net core.

When we first create an application in .net core using the web api template, we have two different profiles available in the launchSettings.json.

1. IIS Express
2. {Name of the project}

**Note: launchSettings.json file is only available at the time of development.**

{% gist https://gist.github.com/aman-singh-parihar/15572b8095316166bb20562d6a485859 %}

Lets try to understand this file.

In the profile section we have two profiles available.

1. IIS Express
As we can see commandName is set to IISExpress, and in the environment varialble section we have ASPNETCORE_ENVIRONMENT variable set to Development.

2. {Name of the Project}
Here we can see commandName is set to Project, and in the environment varialble section we have ASPNETCORE_ENVIRONMENT variable set to Development.

We can select any of these profile to run our application.

If commandName is set to IISExpress, then the application will be launched using IISExpress and if the commandName will be set to Project, then the application will be launched using kestrel server along with a reverse proxy server.

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t8suak9iblbw2ni0w37n.png)
 

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uikiohmltu5azfbarlry.png)

And as in both the cases ASPNETCORE_ENVIRONMENT set to development, so the environment will be development. We can check for different environment in the startup.cs file using various extension methods.

{% gist https://gist.github.com/aman-singh-parihar/51f118986cfa1d275a13d91364bdf79b %}

And if no value is set for ASPNETCORE_ENVIRONMENT  variable in launchSettings.json, then it will look in the System Environment Variable and if it is also not set there, then the value will be production by default.
Earn money using the Web Monetization API
Tags: webdev, monetization, javascript, html
Published: 2021-04-26 16:03:05

_Content inspired after I receive [my first payment using Web Monetization API](https://twitter.com/obetomuniz/status/1385026594285236234)_

## 🧑‍🔬  The How 

- Sign up to [wallet.uphold.com/signup](https://wallet.uphold.com/signup) and verify yourself

- Find the Interledger Payment Pointer in the Transact panel

![1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3pd0mbyoumewzccnd57p.png)

![2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jdsvnqcygexw4burot6e.png)
  

- And pick a currency target. It could be USD, BTC, etc 

![3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4e01yeoj1wixdflccllg.png)

The Web Monetization API needs a [Payment Pointer](https://paymentpointers.org/) to address micropayments for you.

## 🏗 The Where

You could now use your already created Uphold's Payment Pointer on your website using this declaration:

```html
<meta name="monetization" content="$ilp.your.payment/pointer" />
```

Also, dozens of services offer support:

- [Twitch](https://help.coil.com/docs/monetize/content/twitch)
- [DEV.to](https://dev.to/devteam/you-can-now-web-monetize-your-dev-posts-but-don-t-get-your-hopes-up-too-quickly-goc)
- [Hashnode](https://hashnode.com/post/how-to-enable-web-monetization-on-your-hashnode-blog-in-2-steps-ckdu4rspj003tn0s1959c0ruq)
- [Cinnamon](https://cinnamon.video/)
- [WordPress](https://help.coil.com/docs/monetize/content/wp-overview)

Even [YouTube](https://help.coil.com/docs/monetize/content/youtube-monetize-channel), when connected in a creator account on [Coil](https://coil.com/creator).

## 💰 The Web Monetization API

![Web Monetization API](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gzoxgdhsllxa29qas93x.png) 

The [Web Monetization API is a W3C Standard](https://webmonetization.org/) that uses a neutral payment protocol called [Interledger (ILP)](https://interledger.org/) for transferring money for anyone by anyone. 

The proposal help web creators avoid systems that slow down the web and creates annoying UX

### 📚 More about Web Monetization Standards

- [Get Monetized - A Coil's Overview about Web Monetization API](https://help.coil.com/docs/monetize/content/get-monetized-overview/index.html)
- [Videoin 🇧🇷 about Web Monetization API on my YouTube Channel](https://www.youtube.com/watch?v=dcBxWV8fu8k)
VSCode Remote Connection
Tags: vscode, remote, ssh
Published: 2021-04-26 15:55:33

In this article I will go through how to connect remotely in VSCode using SSH remote extension.

* In both **local** and **server**: check that you have open SSH installed by searching Manage Optional Features in the Windows start menu.

* In both **local** and **server**: open `services.msc` and make sure that the services of ssh are running.

* In **Server** cmd: `run netstat -a | findstr 22` You must see something like this (Listening):
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k2eyhdnk76n0cqugl0qe.png)

its default port is 22.

* From **Local** cmd: To go to the server run `ssh <SERVER_USERNAME>@<SERVER_IP>`
You’ll be asked to enter the server password.

* In **Local** cmd: Now I am in a cmd seeing the Server


* In **Remote** in `C:\Users\<USERNAME>.ssh`: run `ssh-keygen` and name the file of the ssh e.g. `testSSH`.

* In **Local**: Create a **config** file (with no extension) in `C:\Users\<USERNAME>.ssh`.

```
Host <AnyName>
  HostName <IP>
  User <USERNAME>
  IdentityFile ~/.ssh/<name of the ssh file on the server made in previous step (e.g. ~/.ssh/testSSH)>
```

# In VSCode in **Local**: 

* In **Local**: Make Sure to install Remote extension by Microsoft. 

* Click on its icon (1)

* (2) select `Remote-SSH: Connect to Host`

* Either do one of the following

* Choose the just configured SSH Host 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/727y8hghj8uxi3l3nnmi.png)

or 

* (3) Enter e.g.:  `ssh <SERVER-USERNAME>@<SERVER-IP>`

* (4) Choose as below in the image
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/plbgt9c24y5rylo1ykt1.png) 

* A new instance of VSCode will be open.

* You’ll be asked for the Operating System, the Server Password.

* You’ll find that you’re connected to the Server 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kulgy4av4vihj3q6xnf9.png)

* You can open terminal in VSCode but firstly make sure that the server has Git downloaded.

* You are now in the Server terminal: 


* Now you can download plugins and extensions as `Live Server` on the server from your opened VSCode window.

* In **Local** VSCode: File → Open Folder → type your project path on the server. 

* You can run Live Server extension and it will show that it is running on a port e.g. 5501 so now you can browse to http://<SERVER-IP>:5501/ to see live dev.

Thanks for your time, and I am happy to get feedbacks.
Khaled Taymour
PHP Upload File Using Ckeditor Example - Itwebtuts
Tags: php, tutorial, programming
Published: 2021-04-26 15:50:29

<p>Here, i give you full example of How to How to do custom file upload with in CKEDITOR step by step like create one file in this file we are integrate CKEDITO and secound another file which we are created for uploadin custom file.</p>

<p>Following The Step:</p>

<p>1)create one index.php file</p>

<p>2)create cstom file uploading file </p>
more...
https://itwebtuts.blogspot.com/2021/04/php-upload-file-using-ckeditor-example.html
Beautiful Chase RGB Glow Effect CSS
Tags: html, css, webdev, rgb
Published: 2021-04-26 15:36:34

As an extension to Nikhil's: {% post nikhil27b/amazing-button-hover-with-css-5egi %}I have created a full 360° "chase" effect using an altered version of the original design.

##With text effect:
{% codepen https://codepen.io/MysticZA/pen/qBRvjEX %}

##Without text effect (better visual accessibility):
{% codepen https://codepen.io/MysticZA/pen/zYNbzrN %}

Please be sure to check out Nikhil's original post.
Comments welcome!
What is your Calling?
Published: 2021-04-26 15:33:24

There’s a difference between a job, a career, and a calling. What are you being called to do?

Snakes shed their skin to allow for more growth, even though they go temporarily blind. Nature requires it.

When you’re no longer afraid, you embrace mistakes. You redefine mistakes, because you grow beyond them.

Find your must. What moves you? What burns you?
Best Tool To Design Graphics Instantly
Tags: beginners, design
Published: 2021-04-26 15:33:21

Hi,

Today in this post I will introduce the best graphic designing tools for beginners.

When I have started designing for Social Media & Website, experts suggest me tools like Coral, Photoshop, etc

But my suggestion for people who want to start graphic designing & learn everything easily without some expertise then starts Graphic Designing using these online tools -

## 1. [Canva](https://bit.ly/3sN9AaU)
![Canva screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c54ucom4aoeuh2wmou7d.jpg)

Canva is a graphic design platform, used to create social media graphics, presentations, posters, documents, videos, and other visual content. The app includes templates for users to use. The platform is free to use and offers paid subscriptions like Canva Pro and Canva for Enterprise for additional functionality.

**Canva offers 30 days of free pro access for new users.** If you haven't used canva before then [click here](https://bit.ly/3sN9AaU) to try.

For more information check [canva free trial](https://techcopes.com/canva-free-trial/) page

## 2. [Visme](https://bit.ly/3ezabIg)

![Visme screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pi2t497nho6yzi7iby5u.jpg)

Visme is an all-in-one visual content platform that allows everyone, including non-designers, to create beautiful presentations, infographics, reports and social media images in minutes.

## 3. [Crello](https://bit.ly/32OqoUj)

![Crello screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k1q5vzmamjqa6nxovds4.jpg)

Crello is a video and graphic design tool for everyone – it will help you create visuals for social media in just a few minutes (be it a post, video Story, or an ad), design a business card or a flyer, create marketing collateral for print, social and blogs, as well as create long-form content like presentations and more.

Also read - [8 Best Online Graphic Designing Software](https://hubsadda.com/online-graphic-designing-software/)

I recommend Canva because in terms of features and simplicity.

Which tool you are using now for graphics designing. Let me know in comment.
Setting Up a Blog: My Takedown
Tags: blogging, beginners, learning, devjournal
Published: 2021-04-26 15:28:43

> If only I could have read these words before setting up my original blog. 

The post photo shows the original “before” version of my blog.  The re-launched version of that blog is at [ardithann.com](https://ardithann.com/). Here’s hoping my missteps will help you!

# Need a theme
My biggest mistake was picking [Eleventy](https://www.11ty.dev/) for my blogging platform.  I cloned the blogging repo and started updating the pages.  Eleventy offers high flexibility and is a great option for many.  But as a newbie, my challenges are writing clearly and mustering the courage to post.  So, I needed a theme to simplify my delivery.  Thus, the move to the [Hugo uBlogger theme](https://themes.gohugo.io/ublogger/).

# Theme flexibility helps
With the uBlogger theme, I love the generated posts, tags, and categories pages.  I am fond of the featured photo layout and post styles.  Additionally, the theme is installed as a git submodule, so it can be updated.  I was able to tweak the javascript used for link defaults.  Also, styles can be overwritten by updating a Sass file. 

# Inline comments can wait
Communities like [Indie Hackers](https://www.indiehackers.com/), [Twitter](https://twitter.com/home), or [DEV.to](https://dev.to/), have their own commenting forums.  As a beginner, I don’t expect to get much SEO traffic. So adding [Disqus](https://disqus.com/) to my original blog was unnecessary.  Honestly, I am not a fan of the look and bloat it added.  So, for now, I will hope to get comments in communities where my blog is posted.

![original blog eleventy blog disqus comments](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kt9z7nemt0ki00grzhfp.png)

# Newsletter for better distribution?
I added a newsletter using [ConvertKit](https://convertkit.com/) with the promise of more user engagement.  The idea that newsletters are replacing RSS feeds is interesting to me.

# Seek out blogging examples
Multitudes of blogs exist in your niche.  Most bloggers will give credit to the frameworks they are using in their blog footer.  My impression is that indie makers and founders tend to have more polished blogs than developers.  So, inspiration for this blog change came from respected bloggers, too!

# What’s next?
Someday, I expect to perform another redo of this blog as my needs evolve.  But, for now, I would like to focus on product development and sharing the lessons I learn along the way. 

> I would love to hear your ideas and feedback on blogging.

# Special thanks ...
to Monica Lent for her [Blogging For Devs](https://bloggingfordevs.com/) 7-day email course.