teleren/devto huggingface dataset:
Road to Genius: superior #66
Tags: javascript, beginners, computerscience, codenewbie
Published: 2020-07-31 06:33:39

Each day I solve several coding challenges and puzzles from Codr's ranked mode. The goal is to reach genius rank, along the way I explain how I solve them. You do not need any programming background to get started, and you will learn a ton of new and interesting things as you go.

```JS
function swap(arr, [i, j], [m, n]) {
  const temp = arr[i][j];
  arr[i][j] = arr[🍎][💰];
  arr[m][n] = temp;
}
function rotate(M) {
  const n = M.length;
  for (let i = 0; i < n - 1; i++) {
    for (let j = 0; j < n - i; j++) {
      swap(M, [i, j], [n - j - 1, n - 💎 - 1]);
    }
  }
  for (let i = 0; i < n / 2; i++) {
    for (let j = 0; j < n; j++) {
      swap(M, [i, j], [n - i - 1, j]);
    }
  }
}
let M = [[2, 7, 1], [4, 2, 9], [8, 7, 3]];
rotate(M);
let A = M[2][1];

// 💎 = ? (identifier)
// 💰 = ? (identifier)
// 🍎 = ? (identifier)
// such that A = 9 (number)
```

Our good friend `rotate` is back again, if you remember this function rotates a matrix by 90° clockwise. This time we have to fix three bugs to proceed.

The first two bugs appear on the same line within the function `swap`. This function swaps two elements at `i,j` with `m,n`. Knowing this we know that 🍎 and 💰 should be `m` and `n` respectively.

The final and third bug appears here:
```JS
swap(M, [i, j], [n - j - 1, n - 💎 - 1]);
```
This calls the function `swap` on `i,j` to be swapped with `n-j-1, n-i-1` and is critical for a correct rotation.

![coding challenge answer](https://dev-to-uploads.s3.amazonaws.com/i/vxwsvukw7kzpo19p7doa.png)

By solving these challenges you train yourself to be a better programmer. You'll learn newer and better ways of analyzing, debugging and improving code. As a result you'll be more productive and valuable in business. Get started and become a certified Codr today at https://nevolin.be/codr/
REST APIs & HTTP Requests
Tags: rest, api, http
Published: 2020-07-31 06:27:13

<!-- TOC -->

- [REST APIs & HTTP Requests](#rest-apis--http-requests)
  - [What is an API?](#what-is-an-api)
  - [What is REST?](#what-is-rest)
  - [Types of Requests](#types-of-requests)
  - [API Endpoints](#api-endpoints)

<!-- /TOC -->

## What is an API?

- API stands for "Application Programming Interface"
- Contract provided by one piece of software to another
- Structured request and response

## What is REST?

- REST stands for "Representational State Transfer"
- Architectural style for designing networked applications
- Relies on a stateless, client-server protocol, almost always HTTP
- Treats server objects as resources that can be created or destroyed
- Can be used by virtually any programming language
- All APIs have their own rules and structure

## Types of Requests

- **GET**: Retrieve data from a specified resource
- **POST**: Submit data to be process to a specified resource
- **PUT**: Update a specified resource
- **DELETE**: Delete a specified resource
- **HEAD**: Same as get but does not return a body (only returns header)
- **OPTIONS**: Returns the supported HTTP methods
- **PATCH**: Update partial resources (similar to PUT)

## API Endpoints

Endpoints are URLs that you can access to do certain things:

| Method |               URL               |    Function     |
| :----- | :-----------------------------: | :-------------: |
| GET    |  https://website.com/api/users  |  Get all users  |
| GET    | https://website.com/api/users/1 | Get single user |
| POST   |  https://website.com/api/users  |    Add user     |
| PUT    | https://website.com/api/users/1 |   Update user   |
| DELETE | https://website.com/api/users/1 |   Delete user   |
How to be more effective in building your next solo project

Published: 2020-07-31 06:26:33

I am my least effective when I am working solo, it’s honestly really tough for me.  I have to constantly keep my self motivated, and push my self to keep going when the going gets tough, which is far more difficult when you’re alone.  It really drives home that saying, “ The hardest person to lead is yourself”. 

I just recently wrapped up a solo project, and in hindsight there quite a few things I could have done better.  So, I am going to use this post to reflect on my experience and what I could have done better.

Out of the gate, I should have mapped out more thoroughly what needed to be done and set realistic timelines for how long those tasks would take.  Instead, I just kept it all in my head, and it eventually all snuck up on me towards the end of my deadline and I ended up cramming.

If I could have done it again, I definitely would have used time blocking.  This would have helped me stay on track, and kept me disciplined.  Instead, I just kept checking my phone, writing some code, and then checking my phone some more, and eventually, the day was over and I had only gotten a fraction done of what I needed to.  

I spent way too much time stuck on one thing, I would get stuck and get fixated with finishing that task.  What I should have done instead is move on to other tasks because I could have finished 3-4 other tasks in the time I was stuck on that one issue.  Towards the end of the project, I made this change, fortunately, and when I would come back to tasks I was previously stuck on, I would figure it out pretty much immediately because I took a step away and worked on something else and got rid of the tunnel vision I had when I was stuck.  

I way underestimated how long each of my tasks would take, and as a result, procrastinated a ton because “it’s not even gonna take me that long”.  That is probably the number one thing I would have done differently.  I would clearly outlined everything that needed to be done, then set deadlines for when that stuff needed to be finished.  That in combination with time blocking to increase my focus and odds of getting into a flow state would have made it far easier for me to finish my project before my deadline.
I hope this can help you avoid the mistakes I made in your next solo project :)
Components not solved by hooks?
Tags: discuss, react, hooks
Published: 2020-07-31 06:24:52

Working with a larger codebase I haven't found yet a component I couldn't refactor from classes to hooks (when not counting the obvious error boundaries).

So do you know a use case, preferably with sample code, that cannot be done with hooks? Or that would be "too hacky" if done with hooks instead of a class.
Intro to Ajax & XHR
Tags: javascript, http, xhr, ajax
Published: 2020-07-31 06:24:37

<!-- TOC -->

- [Intro to Ajax & XHR](#intro-to-ajax--xhr)
  - [Synchronous Code](#synchronous-code)
  - [Asynchronous Code](#asynchronous-code)
    - [Most Async code you work with will be part of an API or Library](#most-async-code-you-work-with-will-be-part-of-an-api-or-library)
    - [A few ways to work with Async code](#a-few-ways-to-work-with-async-code)
    - [Ajax "Asynchronous Javascript & XML"](#ajax-asynchronous-javascript--xml)
  - [XmlHttpRequest XHR Object](#xmlhttprequest-xhr-object)
  - [Libraries and Other Methods](#libraries-and-other-methods)

<!-- /TOC -->

## Synchronous Code

```js
posts = loadPostsSync()
// ... wait til posts are fetched
// ... do something with posts

doTheNextThing() // Has to wait until posts load
```

## Asynchronous Code

```js
loadPostsAsync(function () {
  // ... wait til posts are fetched
  // ... do something with posts
})

doTheNextThing() // Doesn't have to wait until posts load
```

### Most Async code you work with will be part of an API or Library

- XMLHttpRequest & Fetch
- jQuery Ajax, Axios, other HTTP Libraries
- Node.js fs (filesystem) module

### A few ways to work with Async code

- Callbacks
- Promises (ES6/ES2015)
- Async/Await

### Ajax ("Asynchronous Javascript & XML")

- Set of web technologies
- Send & receive data asynchronously
- Does not interfere with current page
- JSON has replaced XML for the most part
  - Ajax engine sits between the server and the client as a middleman
  - Client sends JS calls to Ajax Engine
  - Ajax Engine returns HTML response to client
  - Ajax Engine sends XmlHttpRequest to Server
  - Server returns XML/JSON
- Makes async requests in the background
- No page reload/refresh needed
- Fetches data
- Very interactive

## XmlHttpRequest (XHR) Object

- Core tech in Ajax
- API in the form of an object
- Provided by the browser's JS environment
- Methods transfer data between client & server
- Can be used with other protocols than HTTP
- Can work with data other than XML (JSON, plain text)
  - \*Nowadays we mostly just work with JSON data

## Libraries and Other Methods

- Fetch API (part of vanilla JS)
- Axios (external library)
- Superagent (external library)
- jQuery (not recommended if just using it for Ajax. jQuery is a complete DOM manipulation library, which is very bloated for just Ajax)
- Node HTTP (good if using Node.js)
3 técnicas a evitar al estudiar
Tags: productivity, spanish
Published: 2020-07-31 01:35:10

Las formas de estudio pueden ser diferentes para cada persona, sin embargo las técnicas más usadas casi siempre se relacionan con la sensación de ser ¨productivo¨, es así que las estrategias populares más usadas son el releer, subrayar y hacer resumenes. No obstante, existen estudios que concluyen que esas técnicas no mejoran nuestro rendimiento o ¨performance¨. En este estudio  https://pubmed.ncbi.nlm.nih.gov/26173288/, el profesor Dulonsky analiza cientos de estudios relacionados a técnicas de estudio y menciona las tres técnicas populares a evitar, como resultado de su baja utilidad frente a otras.

1-Releer
Esta técnica brinda una sensación de seguridad de que se esta realizando trabajo productivo, sin embargo, el estudio sugiere que es una forma pasiva de estudiar, mientras que el cerebro es más efectivo al retener información cuando se encuentra en un estado activo.

Por lo tanto, Dulonsky concluye que el releer libros y apuntes es de baja utilidad, ya que si bien puede mejorar retención de corto plazo, existen otras técnicas mejores y más efectivas.

2-Subrayar
La segunda técnica comúnmente usada es la de subrayar, se cree que esta técnica es productiva y permite a nuestras mentes creativas hacer notas coloridas.

No obstante, en el estudio de Dulonsky se menciona que tampoco esta técnica tiene mucha utilidad y la llaman una ¨safety blanket¨, peor aún, mencionan que puede perjudicar el rendimiento en temas donde se necesite mucha inferencia por parte del alumno. Este punto es especialmente importante para estudios superiores donde es común que las materias requieran  deducción por parte del alumno.

3-Resúmenes
Hacer resúmenes y tomar notas también son muy usados y va en linea con la sensación de productividad. En este caso el profesor Dulonky concluye que esta técnica podría ser efectiva para personas con buenas habilidades para hacer resúmenes, sin embargo muchos estudiantes necesitan mucha practica y training para lograr esto. Por lo tanto, no es recomendado para todos.

En resumen, si es que sabes hacer resúmenes de manera efectiva, estos pueden ser útiles, pero aun así hay técnicas con mayor utilidad que podrías utilizar.

Por lo tanto, la popularidad de estas técnicas no se correlaciona con su efectividad, no obstante exploraré otras técnicas más efectivas en los siguientes posts que espero sean de tu utilidad.
Mua Hàng Online MuaBanNhanh
Published: 2020-07-31 06:13:03

Mua Hàng Online MuaBanNhanh dễ dàng, giá rẻ
https://goo.gl/maps/uzJ9Z7DWUXPoPki4A 
#Mua_Hang_Online #MuaBanNhanh #Thuong_Mai_Dien_Tu #HaiLyMBN #VietNam
From Now You Shall Be Called Main
Tags: discuss
Published: 2020-07-31 06:03:48

The latest protests in the US engaged the tech community to remove offensive words from the software language. Some of these words include master/slave, whitelist/blacklist, and many more.
For me, the biggest change would be to change git's `master` branch to `main`, I'm so used to it...
I believe it will take time for the industry to get used to these new changes.
What do you think?
Let's solve LeetCode - Is Subsequence
Tags: algorithms, javascript, tutorial
Published: 2020-07-31 05:56:37

# Problem 392 - [Is Subsequence](https://leetcode.com/problems/is-subsequence/)

Given a string `s` and a string `t`, check if `s` is a subsequence of `t`.

A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (ie, `"ace"` is a subsequence of `"abcde"` while `"aec"` is not).

## Examples
```
Input: s = "abc", t = "ahbgdc"
Output: true
```

```
Input: s = "axc", t = "ahbgdc"
Output: false
```

### Conceptual Overview

Since we want to check if `s` is a subsequence of `t` we will want to check every character of `s` against `t` and if a character at `s` matches a character in `t` (in order) then we can move onto the next character in `s` and do the check all over again.

Looking at the example above let's run through a couple of iterations. In ECMAScript 5 we can treat the string as an array-like object, where individual characters correspond to a numerical index.

1) At s[0] = a; t[0] = a; does s[0] === t[0]? Yes, move to the next character in `s` and `t`
2) At s[1] = b; t[1] = h; does s[1] === t[0]? No, move to the next character in `t`
3) At s[1] = b; t[2] = b; does s[1] === t[2]? Yes, move to the next character in `s` and `t`
...
6) At s[2] = c; t[5] = c; does s[3] === t[5]? Yes, and since we went through the length of `s` we found `s` to be a subsequence of `t`

### Code

While-loop variation
```javascript
/**
 * @param {string} s
 * @param {string} t
 * @return {boolean}
 */
const isSubsequence = (s, t) => {
    if (s.length === 0) return true

    let sPointer = 0
    let tPointer = 0
    
    while (sPointer < s.length && tPointer < t.length) {
        if(s[sPointer] === t[tPointer]) sPointer++
        
        tPointer++
    }
    
    return sPointer === s.length
    
};
```

For-loop variation
```javascript
const isSubsequence = (s, t) => {
    if (s.length === 0) return true
    
    let sPointer = 0
    
    for (let i = 0; i < t.length; i++) {
        if (s[sPointer] === t[i]) sPointer++
    }
    return sPointer === s.length
}
```

In both code solutions, we need to keep track of our position in each string so we use pointers to help with that.

### Time & Space Complexity

Time: O(n) - where n is the length of the array
Space: O(1)
Both variations have the same time and space complexity
The 6 Steps To Create A 
Website - Step 1
Published: 2020-07-31 05:34:43

## The One Goal

Creating a website can be just as easy as putting some HTML and CSS together, writing some words and adding some images. 

I have done this before. Started by coding with putting no thought into what I was doing.

This makes things both easy and hard.

It makes it easy as you have no restrictions and you can do whatever you like when you like.

It makes it hard because sometimes you get lost in what you are doing and can spend hours not knowing which direction you are going. You have pieces of the website that look totally different from each other because you were following your creative juices.

Making a website does not have to be hard.

All you need is a little direction. 

Some steps to help you along your way so you can see if you are making the right choice and you can check in with progress that you are making.

It starts with just one thing.

Why?

What is the purpose of the website?

What is its main goal? 

This is your lodestone.

When you are making a decision be it from choosing text or images you can check against the goal of the website and ask "Is this helping achieve the goal?"

If the answer is yes, go mad.

If the answer is no, then you need to review what it was you were about to do.

Looking for the goal can be as easy as asking the person you are making the site for.

If they don't have an answer then going for capturing emails is a sensible option.

Should I have more than one goal?

No. One goal only.

Don't start thinking you can plaster loads of call to actions on the home page.

Two problems for this is that the person visiting the website will get confused on what they are actually supposed to do and it will make it hard to measure on how well the website is doing for the result you are trying to achieve.

You could break it down to have a goal per page of the website. But be careful you aren't watering down your intent.

Start with one goal. Define it. Write it down. Keep it in mind when creating and keep it in mind when you are making decisions.
MIND OF EVERY BEGINNER DEVELOPER...
Tags: beginners, html, javascript, css
Published: 2020-07-31 05:31:14

 Mind of every beginners!!! (front-end developer)

In This 21st Century, the coding skill is the best skill which have been developing day by day, specially concerned about every beginners who ever is facing a big problems about programming are as follows.....
✔ which programming language i should learn first?
✔ will be i am able to attain the specific goals?
✔ which resources i should persue to become a front-end developer?
✔ should i invest my money in taking courses?
✔ how much time it will be take... too become a developer?
✔ will i get job or not..?

and question in your mind goes on......🤔😥

after these question are going in your mind, then you feel being depressed....
On the other hand, there are some  experienced developer in the social media's who just shows off ✌✌to make us more feeling motivates or depressed(based on the situation arise on us).

so guys,
finding a solution,above these things is...

Read carefully,
Before you questioning your mind did u even..try to do it..?
bro I know that, it takes more time to study it and attain that specific goal and makes feel bored. it doesn't matter....
      look guys, i am a beginner for this particular field NOW and i am not taking any online buying courses. i am watching youtube videos(such as Traversy media, freecodecamp.org) to study and for documentation reference i goes for (mdn.docs) and for practicing my knowledge(HackerRank, CodeFights(FOR JS)).THESE ARE FREE RESOURCES. it is best pill that i take now for studying..😂👌
and try maximum to be happy mahnnn...and stay healthy.....
it takes timeeee... be patience..
No worrying about problems as mentioned above. if you lose to get any jobs, just be yourself there are lots of companies who can hire you or you can even build your own startup company and guys try to travel more and more...(due to covid-19 lockdowns). i don't know what to say.....
And try to strong your basics in HTML,CSS,JAVASCRIPT. learn the basics first how they should use in while writing a code. Don't try to learn by-heart. learn like how it is useful to us...
 
so guys,please excuse me if you feel bored 🥱 or didn't understand my any of sentence 🤯 or please mind my grammar..😁,i am sorry for that..😅 
                            or
 In this DEV community, if any beginners get information from my post..😄, I WILL BE HAPPY.

SO SEE ON NEXT POST...... WITH MORE INFORMATION...
the new guy here✋🏼🤓
Tags: javascript, codenewbie, html, css
Published: 2020-07-31 04:57:00

Hello, guys! I’m the new guy here and I’m happy, I want to learn JavaScript, however, is a challenging language for me, I’m reviewing again HTML & CSS in order to start again after 8 years without make code. Could you help me with recommendations to start on this wonderful road? Thanks in advance! 🤜🏼🤛🏼
Overcome Positional Destructuring limitations! | KnowYourKotlin
Tags: android, kotlin, java
Published: 2020-07-31 04:53:26

Hi #androidDevs, This is Androidbites where I try to break down a small concept into an understandable code snippet and share my learning experience with it.

as per my previous article, I discussed how destructuring is limited in kotlin in case you missed it go through the following link.

## 👉 [AndroidBites|Destructuring-limitations](https://chetangupta.net/destructuring-limitations)

Today's snippet tells about the place where you should never use destructuring. 👁 on the code 💻👇

![kotlin restructuring limitations](https://dev-to-uploads.s3.amazonaws.com/i/a57a8jx4rxko9kmdh0o5.png)

You must be wondering then what should be the ideal place when we should be using it or even to use for not, to figure that out and more in-depth explanation with example follow the article below

## 👉 [AndroidBites|Destructuring-safely](https://chetangupta.net/destructuring-safely)

see you on the other side 😈

Happy Hacking!

Stalk Me 👀 :
[LinkedIn](https://bit.ly/ch8n-linkdIn) | [Medium](https://bit.ly/ch8n-medium-blog) | [Twitter](https://bit.ly/ch8n-twitter) | [StackOverflow](https://bit.ly/ch8n-stackOflow) | [CodeWars](https://bit.ly/ch8n-codewar) |[WorkX](https://bit.ly/ch8n-home) |[Github](https://bit.ly/ch8n-git) |[Instagram](https://bit.ly/ch8n-insta) |[Youtube](https://bit.ly/ch8n-youtube)
Mua bán MuaBanNhanh - Trung tâm Thương Mại Điện Tử, Mua Bán Hàng Online
Published: 2020-07-31 04:52:56

Mua bán MuaBanNhanh dễ dàng, bán hàng hàng, kinh doanh online, rao vặt hiệu quả Trung tâm Thương Mại Điện Tử, Mua Bán Hàng Online, MuaBanNhanh - Chi Nhánh công ty MBN
https://goo.gl/maps/ecqU1ba7Sa27dLF86
 #Ban_Hang #Trung_Tam_Thuong_Mai_Dien_Tu #MuaBanNhanh #TPHCM #NgocDiepMBN
The history of writing a Nuxt + Firebase app
Tags: vue, serverless, git
Published: 2020-07-31 04:44:50

Hello everyone!

I recorded myself talking about an app I wrote somewhat recently. This was a lot of fun to build (even if that fact doesn't quite come across on the video 😅).  

I already shared on [my YouTube channel](https://www.youtube.com/playlist?list=PLmJs3lfUmCdR-1js29OeqNR_YBm2Qy2r5) a couple other videos related to this app. 

This time we go through the commits and I tell you what was the situation of the app at that point in time. 

It was an interesting exercise for me to retrace my steps in that way and also talk about the project overall and how it went.

Thanks a lot for watching and I hope you get a chance to catch more of my videos!

{% youtube IpYgl3q7tsw %}
Creating your Rust Functions in Node.js Using SSVM and docker
Published: 2020-07-31 04:41:12

Head over to https://github.com/second-state/ssvm-nodejs-starter to get started. 

Use Docker: 
`$ docker pull secondstate/ssvm-nodejs-starter:v1
$ docker run -p 3000:3000 --rm -it -v $(pwd):/app secondstate/ssvm-nodejs-starter:v1
(docker) # cd /app
(docker) # ssvmup build
(docker) # node node/app.js`


Copy the functions example - https://github.com/second-state/wasm-learning/tree/master/nodejs/functions 

Replace the files and run your node app.

If you want to try out Machine learning with Rust - https://github.com/second-state/wasm-learning/tree/master/nodejs/ml