teleren/devto huggingface dataset:
Recursion
Tags: javascript, html, css, webdev
Published: 2021-01-29 18:55:35


---
title: Recursion
published: True
description: 
tags: javascript, html, css, webdev
//cover_image: https://direct_url_to_image.jpg
---

                       -Why use Recursion
                       -The Call Stack 
                       -Helper Method Recursion

             


###Why use Recursion

There is another opportunity to create repetition in programs without using loops. Recursion makes it possible to do so because it's a process where a function calls itself over and over again. 



![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/37covlra34uqjpjekyo5.png)






###The Call Stack 
The call stack is stack data structure. Any time a function is invoked it is placed or pushed on the top of the call stack. 
When JavaScript sees the return keyword or when the function ends, the complier will remove or pop off. 




Call stack example 

```javascript 

function takeShower(){
    return "Showering!"
}

function eatBreakfast(){
    let meal = cookFood()
    return `Eating ${meal}`
}

function cookFood(){
    let items = ["Oatmeal", "Eggs", "Protein Shake"]
    return items[Math.floor(Math.random()*items.length)];
}
function wakeUp() {
    takeShower()
    eatBreakfast()
    console.log("Ok ready to go to work!")
}

wakeUp()

```

```javascript 

function countDown(num){
    if(num <= 0) {
        console.log("All done!");
        return;
    }
    console.log(num);
    num--;
    countDown(num);
}
countDown(3)

// Iterative Version
function countDown(num){
    for(var i = num; i > 0; i--){
        console.log(i);
    }
    console.log("All done!")
}

```




###Helper Method Recursion

```javascript 

function collectOddValues(arr){
    
    let result = [];

    function helper(helperInput){
        if(helperInput.length === 0) {
            return;
        }
        
        if(helperInput[0] % 2 !== 0){
            result.push(helperInput[0])
        }
        
        helper(helperInput.slice(1))
    }
    
    helper(arr)

    return result;
}

collectOddValues([1,2,3,4,5,6,7,8,9])

```
Recommendation algorithms: collaborative filtering
Tags: php
Published: 2021-01-29 18:49:42

Choosing the right product to recommend is very important to getting a good sale, but we must intelligently recommend, that is, check if there is a possibility that a customer may like a particular product. The collaborative filtering technique helps to solve this problem. For this we use logical concepts and mathematical techniques in the recommendation algorithms, which assist in collaborative filtering. a simple example follows:
User1 liked movie B and don't like the movie A, and User2 liked movies A and C. User3 liked movies A, B and D.
Comparing the similarity between these individuals the result of the recommendation would be:
User1 = D, User2 = D and User3 = C


![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/4hqikd9nfc7rz9fpr3in.gif)


I launched a package with recommendation algorithms: collaborative filtering. 

[source code](https://github.com/tigoCaval/recommendation-algorithm)
Breaking Changes em Aplicações
Tags: productivity
Published: 2021-01-28 01:36:36

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

Gostaria de tentar esclarecer o significado de um termo frequentemente usado no desenvolvimento de _software_ que é o **Breaking Changes**

Breaking Changes é uma comunicação entre criadores de _libraries/frameworks_ e seus usuários afim de informar que houve mudanças nas API públicas do _softwares_ e dependendo que como a tecnologia for usada pode causar comportamentos inesperados, não necessariamente erros.

Do ponto de vista de uma aplicação os criadores são os times (_squads_) que são compostos de pessoas de diferentes áreas não apenas desenvolvedores, já os usuários normalmente são os clientes da empresa e/ou pessoas internas de outras áreas. Dentro desse escopo uma breaking changes é uma mudança no uso da aplicação que pode gerar um resultado inesperado.

No nosso dia a dia nós usamos o termo para se referir a: 
- Inclusão de funcionalidades
- Correções de bugs 
- Mudanças internas da qual os usuários não conhecem ou não usam

Sendo que nenhum desses casos representam uma breaking change.

Mudanças internas mesmo aquelas que podem quebrar algum código existente não representam uma breaking change, dado que é de responsabilidade dos criadores manter as API internas do _software_ funcionando com o passar do tempo.

Um uso correto do termo seria: 
- Informar a remoção de uma funcionalidade pública. 
- Informar que houve mudanças de regras de uma funcionalidade pública de tal forma que possa gerar um comportamento inesperado.

Em linhas gerais, deveria ser raros os casos onde uma aplicação gera uma breaking change.
How JavaScript uses hashing
Tags: hashing
Published: 2021-01-29 18:02:28

<h3><b>What is hashing and what is it used for</b></h3>

- Hashing is the process of converting a given key into another value.
- Hashing is used for authentication.

<h3><b>What a hash table is and what the benefits of this data structure are:</b></h3>

- hash table (hash map) is a data structure that implements an associative array abstract data type, a structure that can map keys to values.

<h3><b>Benefits of hash table</b></h3>

- Hash tables are data structures that make finding data a lot quicker

- Hash tables are more efficient than search trees or any other table lookup structure

<h3><b>Difference between hashing and encryption</b></h3>

- Encryption: Reversible transformation of data format, used to preserve usability of data.
- Hashing: Is a one-way summary of data, cannot be reversed, used to validate the integrity of data

<h3><b>What is map object</b></h3>

The Map object holds key-value pairs and remembers the original insertion order of the keys.

<h3><b>Comparison between objects and maps:</b></h3>

<h5><b>Map:</b></h5>

- A Map's keys can be any value (including functions, objects, or any primitive).

- The number of items in a Map is easily retrieved from its size property.


<h5><b>Object:</b></h5>

- The keys of an Object must be either a String or a Symbol.
- The number of items in an Object must be determined manually.

<h3><b>Reference:</b></h3>

- https://www.thesslstore.com/blog/difference-encryption-hashing-salting/

- https://www.thedshandbook.com/hash-tables/

- https://www.packetlabs.net/encryption-encoding-and-hashing/

- https://developer.mozilla.org/enUS/docs/Web/JavaScript/Reference
What was your win this week?
Tags: discuss, weeklyretro
Published: 2021-01-29 17:56:28

---
title: What was your win this week?
published: true
description: Got to all your meetings on time? Started a new project? Fixed a tricky bug?
tags: discuss, weeklyretro
cover_image: https://cl.ly/188e843c2985/download/Image%202019-02-15%20at%202.36.37%20PM.png
---

Happy Friday!


**Looking back on your week — what was something you're proud of?**

All wins count — big or small 🎉

Examples of 'wins' include:

- Starting a new project
- Landing a new job
- Reaching a new level on your favorite game... or whatever else might spark joy ❤️ 

---

Have a great weekend!

![Rainbow Time](https://media.giphy.com/media/RhGNDLk9plXWWqW9RM/giphy.gif)
Product / Stack
Tags: discuss, advice, devlog
Published: 2021-01-29 17:53:16

The title is supposed to signal a virtue (if it can be called such), which I have picked up after being in the industry for a few years. A virtue that took me too long to grasp and has been subtle hindrance in my career.

The virtue is this: care more about making a product (or project) good and useful, rather than the technology used to build it.

Countless times I have seen "X built using Y and/or Z", almost as if building "X" is deemed valuable and useful by "Y" and "Z" tech used in its development. What I have grown to care more about is if the thing being developed is actually a net benefit (whatever that means for your project or personal life).

To make things a bit less philosophical, I don't care if about something being built in a MERN stack, or a frontend app is built on jQuery, or Java Server Pages with good ol' Java 7, etc... I care if it makes the lives of the software users better/easier.

My encouragement to you, reader, is to strive to build amazing and useful products/projects, seeing the technology used only as a means to an end.
DC motor Arduino
Published: 2021-01-29 16:23:10

Last week I got some distance sensors to start working on the problem of "what happens when my robot runs into an obstacle". I got a basic sensor working that printed out the distances that were being recorded. This week I took it a small step forward and added a DC motor to the mix.

I worked out a pretty simple solution for now that will cause a motor to turn on based off something being within 5cm of the sensor. Since I already had the code from before to determine the distance. It was as simple as adding the pin the motor is connected to and then making a conditional statement about what distance the motor should turn on/off at. 

First we declare our variable for the pin we are connected to:

```
int motorPin = 6;
```

It looks like this inside the setup():

```
pinMode(motorPin, OUTPUT);
```

and this in the loop():

```
if ( distance <= 5 ) {
    digitalWrite( motorPin, HIGH ); 
 } else {
    digitalWrite( motorPin, LOW );
 }
```

After completing that test I noticed that the motor seemed to be going really fast and that didn't seem like a very good way to turn around. So I did a little bit more digging and found that you can control the speed of the motor. So I made a small tweak to the code:

```
if ( distance <= 5 ) {
   analogWrite( motorPin, 100 ); 
} else {
   digitalWrite( motorPin, LOW );
}
```

This will just set the speed of the motor to a specific speed instead of running at its fastest speed by default.

On a bigger scale I would have to do some programming to turn one set of wheels on in one direction while the other side goes in the opposite direction. At least as of now that will be my plan, but I am still contemplating between making a four or three wheeled little robot friend!
Leenker.com a place to organize and share useful Links and bookmarks
Tags: showdev, node, react, projects
Published: 2021-01-29 17:50:07

---
title: Leenker.com a place to organize and share useful Links and bookmarks
published: true
description: Leenker, a place to organize and share useful links.
tags: showdev, node, react, projects
cover_image: https://leenker.s3.amazonaws.com/leenker-colored.png
---


Hey, this is Enmanuel, just another passionate software developer like you, I love innovating where possible and bringing ideas to life, my most recent creation being https://leenker.com/.

In a nutshell, Leenker brings the Browser's bookmarks experience online with extra capabilities, it is probably my most ambitious project so far and I am very excited to share it, I thought about writing a long text about it, but it is better to let the project do the talking instead of getting you bored.

**If you want to get to know the why's of the platform, learn about it and its policy:** https://leenker.com/help

**If you want to use it, I would highly recommend you to do it alongside the chrome browser extension for a better Experience** https://chrome.google.com/webstore/detail/leenker/dnkgochdfgehdfbkpkpdbccefphnnmoa

Finally, this is an in-progress project and has _many_ things to improve, (Accessibility, security...) take into consideration that it was built by only one person, so your feedback would be highly appreciated, any bugs or improvements you may recommend you can send them to admin@leenker.com

Hope you like it.

Come join me on https://leenker.com/
VS Code: Forget History On Launch
Tags: vscode, editor, ide, code
Published: 2021-01-29 17:26:09

During a recent CTF challenge I had changed my laptop's power settings to not go to sleep while on battery.  Of course, I forgot to change it back. So after it being unplugged all night it was as dead as a doorknob this morning.

I plugged it in, powered on, and fired up VS Code to keep hacking away at things. However, at the moment the laptop died I had about 10 separate VS Code windows with 5-10 files open in each. This is exactly what VS Code wanted to open again, all at once, and things were not going well.

The only other apps running were a terminal window and Chrome with 44 tabs...nothing right? I mean a Pixelbook Go i7 with 16GB of memory should be able to handle that :shrug:

Regardless, I would prefer VS Code not remembering everything that was open on a cold start. It is also worth mentioning that I have Auto Save on.

## stackoverflow, ftw

Thanks to [this](https://stackoverflow.com/a/65217427/1820006) very underrated answer I was able to quickly get back to business.

I created `~/.vscode/tasks.json` and `~/.vscode/launch` as follows:

### tasks.json

```json
{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "clear-editor-history",
      "command": "${command:workbench.action.clearEditorHistory}"
    }
  ]
}
```

### launch

```json
{
  "version": "0.2.0",
  "configurations": [
    {
      "preLaunchTask": "clear-editor-history"
    }
  ]
}
```

## Relaunch

Because of the unstable state VS Code was in I went ahead and rebooted my machine, but now VS Code only launches what I ask it to. For added sugar, recent projects can still be found under **Recent** in the Welcome tab :wink:

## Conclusion

Not a technically riveting article, but it was something that got me out of a tight spot, offered as an unaccepted answer in Stack Overflow.

Hopefully this short article helps someone in a similar predicament, and if it does, please up-vote the Stack Overflow answer to which we're crediting this solution to.
Just another rapid growth startup...
Tags: showdev, react, watercooler
Published: 2021-01-29 17:13:28

Offerly applicant tracking system and recruiting software is the newest product out for all things jobs. Offerly comes packed with features and is constantly pushing out fixes and features every week. Offerly has easy pricing including a free tier to get started and using our easy to use pay as you grow model its perfect for any size business! 

Some key features include, Job postings, Job flow boards that instantly get filled with applicants as they apply (email sent to you as well), contact management and much more! 

Some key features coming down the line - zoom integration to hold interviews right in our system, SMS directly with applicant and much, much more! 

Give us a look at either offerly.io or app.offerly.io
Scrum in Agile Methodology, Scrum Process, Roles and responsibilities in Scrum.
Tags: beginners, testing, tutorial, devops
Published: 2021-01-29 16:58:12

**What Is the Scrum?**

SCRUM is an agile method of development that **focuses primarily on how to handle activities within a team-based system of development**. Scrum is literally derived from the action that happens during a rugby match.

*Scrum process includes three phases:* 
**Pre-Game:**
**Two sub-phases** are included in the pre-game stage:
 
*Planning:* Description of the software that is **being developed.** A list of Product Backlogs is generated including all the currently known specifications.
The **requirements are prioritized** and the effort necessary for their execution is estimated. With new and more specific items, as well as more specific **estimates and new priority requests, the Product Backlog list is continually updated**.  

*Architecture:* Based on the current items in the Product Backlog, the **high-level design** of the system, **including the architecture, is scheduled.** 
In the case of an update to an existing system, the modifications necessary to introduce the **backlog items are listed along with the issues** they may cause. A **design review meeting** is held to review implementation plans and **decisions are taken on the basis of that review.**

*Development phase (Game phase):*
 
This stage is regarded as a "**black box**" where it is supposed to be unpredictable. **In Sprints, the system is built.**
![Random](https://dev-to-uploads.s3.amazonaws.com/i/6rqe9vusdsqox03aih5q.png)
 
*Post game:*
When an agreement has been reached that the environmental variables such as **the requirements are completed**, this stage is entered into.
No more things and problems can be found in this case. The system is now ready for release and during the post-game stage, including **activities such as integration, system testing, and documentation, planning** for this is being done.

*Roles and responsibilities:*

**Scrum Master:** The Scrum Master is **responsible for ensuring that the project is managed in accordance with Scrum's practices**, principles and rules and that it proceeds as expected. During the project, **Scrum Master communicates with the project team** as well as with the client and the management.
 
**Product Owner:** The **project, management, monitoring, and control** of the Product Backlog list is officially the **responsibility of the Product Owner**. The Scrum Master, the customer, and the management pick him. He makes the final decisions on the tasks relating to the Backlog product.

**Scrum Team:**  The Scrum Team is the project team that has the **ability to decide on the actions required** and to coordinate itself in order to achieve each Sprint's objectives. 

**Customer:** For the system being built or improved, the consumer **participates in the activities related to product backlog products**.

**Management:** Management, along with the charters, rules, and conventions to be observed in the project, is **in charge of final decision making**. In the setting of goals and criteria, management frequently participates.
Book notes: Clean Code - Chapter 5
Tags: books
Published: 2021-01-29 16:54:25

I will jump right into the notes, the description for the note formatting is in the first post of this series

### Chapter 5 - Formatting 

* Good formatting is good for communication, and we should strive to have good communication
* Small files are better to understand (and therefore better to work with) when compared to big files 
* Vertically close lines of code should have a close logical relation

> Variables should be declared as close to their usage as possible

* Functions that are called by another function in the same file should be right below the caller
* Big lines of code are bad, 120 characters/line is fine, more than that is not
* The team has the final word on the formatting rules for the codebase
New package to add authentication scaffold to an API using Laravel
Tags: laravel, passport, sanctum
Published: 2021-01-29 16:52:03

Today I am launching a new Laravel package to add all the authentication scaffold for APIs like Laravel UI or Laravel Breeze does to a monolith.

#### [Documentation](https://json-api-auth.netlify.app/)

#### [Screencast to implement JSON API AUTH package with Passport & Sanctum](https://www.youtube.com/playlist?list=PLjAr12Su1SUJEZ-Osb_qEo9m2wdTyu_e3)
Listing all the possible values for an enum in Typescript
Tags: typescript, enum, ts, javascript
Published: 2021-01-29 16:28:43

Today I have spent quite a few hours trying to contribute a P.R. to a project I really like, and often use in my day-to-day work, the excellent [`class-validator`](https://github.com/typestack/class-validator).
The problem I was trying to solve consisted in listing the possible values for a given enum, in order to let `class-validator` print them in its enum-related error messages.

The main problem is that enums get transpiled di

When values are not specified, an incremental integer is assigned to each key, so the transpiled JS looks like the following:
```js
// Before
enum Steak {
    Medium,
    Rare,
    WellDone
}

// After
var Steak;
(function (Steak) {
    Steak[Steak["Medium"] = 0] = "Medium";
    Steak[Steak["Rare"] = 1] = "Rare";
    Steak[Steak["WellDone"] = 2] = "WellDone";
})(Steak || (Steak = {}));
```

When an inteer number is assigned as the value, it is simply assigned instead of the deafult incremental integer in the example before.

When a string value is assigned, though, the transpiled JS code looks a bit different:
```js
// Before
enum Steak {
    Medium = "MEDIUM",
    Rare = "RARE",
    WellDone "WELL_DONE"
}

// After
var Steak;
(function (Steak) {
    Steak["Medium"] = "MEDIUM";
    Steak["Rare"] = "RARE";
    Steak["WellDone"] = "WELL_DONE";
})(Steak || (Steak = {}));
```

These transpilation differences lead to obvious inconsistencies when attempting to retrieve an `enum`'s list of possible values when using the common `Object.values()`, `Object.keys()` and `Object.entries()` methods. By fiddling with an heterogeneous `enum` like the following:
```js
enum TestEnum {
	a = 'aA',
	b = 'bB',
	c = 1,
	d = 2,
	e = '01'	
}
```


The following conclusions can be drawn:
- `Object.values()` returns an array containing all the possible values for the given enum AND the keys for the properties which have integer numbers as values (`[ 'c', 'd', 'aA', 'bB', 1, 2, '01' ]`)
- `Object.keys()` returns an array containing all the enum's keys plus all of the integer values defined (`[ '1', '2', 'a', 'b', 'c', 'd', 'e' ]`) 
- `Object.entries()` returns an array of [key, value] arrays, plus N [value, key] entries for N of the enum's properties which have integer numbers as values (`[ [ '1', 'c' ],
     [ '2', 'd' ],
     [ 'a', 'aA' ],
     [ 'b', 'bB' ],
     [ 'c', 1 ],
     [ 'd', 2 ],
     [ 'e', '01' ] ]`)  

  
So, finally, the solution I came up with is:
```js
Object.entries(TestEnum).filter(entry => !parseInt(entry[0])).map(entry => entry[1])
```

Which starts from `Object.keys()`'s results, filtering out all the redundant [value, key] entries.