teleren/devto huggingface dataset:
Useful array methods with JavaScript
Tags: javascript, beginners
Published: 2021-02-08 18:23:06

First, We need to know what's an array and what is used for.

**Array** is a data structure that consists of a collection of elements (number, boolean, string, object, ...) and we commonly use it to organize and represent a group of elements that are related to each other.


**Example:** An array of objects that represent users of a system with their year of birth and the role they perform.

```
const users = [
    { name: "Daniel", birthYear: 1996, role: "Sysadmin" },
    { name: "Sarah", birthYear: 1993, role: "Sysadmin" },
    { name: "Stiven", birthYear: 2000, role: "Tester" },
];
```
On some occasions we will see it necessary to perform operations with the arrays to filter or obtain information regarding it.

To do this we can use some methods that will allow us to manipulate and extract information regarding the array that we use in a simple way.

##Some of these methods are:


&nbsp;
### Filter

Filter helps us to obtain the elements within the array that fulfill a truth condition.

**Example:** We want to get all the users that their role is "Sysadmin".

**truth condition**: When users.role is equal to "Sysadmin".

```
const sysadminUsers = users.filter(user => user.role === "Sysadmin") 
/* returns [{name: "Daniel", birthYear: 1996, role: "Sysadmin"},{name: "Sarah", birthYear: 1993, role: "Sysadmin"}] */
```
&nbsp;
### Map

Map helps us perform a task on each of the elements of the array.

**Example:** We want to get the age of each of the users.

```
const currentYear = new Date().getFullYear();
const AgedUsers = users.map(user => currentYear - user.birthYear);
/* returns [25,28,21] */
```

&nbsp;
### Some
Some check if one or more elements fulfill a truth condition, if it happens return true else false.

**Example:** We want to know if exist a user with role "Tester" and "Developer".

```
 users.some(user => user.role ==="Tester") // returns true
 users.some(user => user.role ==="Developer") // returns false
```

&nbsp;
### Every

Every check if all elements fulfill a truth condition

```
const numbers = [1,2,3,4,5,6,7,8,9]
```

**Example:** We want to know if all numbers in the above array are greater than 0.

```
numbers.every(number => number > 0) //returns true
```
How To Get your PRs merged faster
Published: 2021-02-08 18:18:06

---
title: How To Get your PRs merged faster
published: true
description: 
tags: 
//cover_image: https://source.unsplash.com/y2yWnOkOUM0/1600x900
---
Every developer wants their code in production as soon as possible. I am assuming you are in a team or at least have someone else to review your code before its merged into staging or production environments. In the past two years I have seen an improvement in the time it takes to get my code merged.

I've had my PRs waiting for review for days on end. Its annoying to say the least. I'll share a few points that helped me get my PRs reviewed and merged a lot faster.


## Its a team thing.

As developers we tend to be fiercely independent. This unfortunately does not help deliver products to clients any faster. As a team you need to learn to set aside your individual goals and work on team goals. I used to say things like "I managed to complete all the tasks I set out to do this week" during retro. Now I try to see did we complete all tasks assigned to our team. Changing this mindset is hard and slow but its worth the results.
Agree as a team to be setting aside time to review each other's PRs. Maybe at the start of the day and end of the day. This will leave you with enough time to focus on your tasks.

## Have a good relationship with your team mates.

Try and have a good relationship with your team mates. Be interested in them as people. This helps resolve any conflicts when they do arise and we all work better with people we like. Remember at some point you will need help from your team mates and having a good relationship with them allows you to ask for help without things getting weird.

## Write clean code.

Write good code. No one likes to read spaghetti code and super huge functions in which you have to spend a lot of time piecing together. If you regularly write bad code, your team mates will avoid your PRs and only check them when its completely unavoidable. This is a skill that can be learnt. There are good books and articles out there for this. A quick google search will guide you.
High Performance HTML Rendering: How to properly use a game loop with HTML canvas drawings
Tags: javascript, webcomponents, animation
Published: 2021-02-08 18:17:52

---
title: High Performance HTML Rendering: How to properly use a game loop with HTML canvas drawings
published: true
description: Game programming uses a software pattern that's also applicable to more serious endeavors such as: time-series charting, interactive data visualization, and scientific modeling.
tags: javascript, webcomponents, animation
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/otvfpqep6f2hzuy8u27n.png
---
Game programming uses a software pattern called a *game loop*. It’s an important technique for any software developer to study, having applicability to serious endeavors beyond graphic animations, for example in: time-series charting, interactive data visualization, and scientific modeling.

This [article](https://medium.com/javascript-fanboi/2021-034-high-performance-html-rendering-4372fc32f23c) shows how to improve the continuous `requestAnimationFrame` callback to handle:
* real-time fidelity,
* throttling things to a fixed rate,
* placing canvas drawing functions behind promises,
* completely skipping unnecessary drawing.
Flutter Loading Screen with Future Builder
Published: 2021-02-08 18:10:32

---
title: Flutter Loading Screen with Future Builder
published: true
description: 
tags: 
//cover_image: https://source.unsplash.com/pNGJpcrbfM4/1600x900
---

When developing UIs you need to give the user some feedback on a long-running process. A loading widget is normally the go-to solution. In React you would have a boolean property in the components state. If for example, you are fetching some data from the internet, you would set the boolean to `true`. In the component's `render` method you would display a loading widget based on the value of that boolean property. When you have your data you show the right component. Something like:

{% gist https://gist.github.com/lenniezelk/e4e394e64d585714ff0d555103948dd7 %}

This can be achieved easily in Flutter with [Future Builder](https://api.flutter.dev/flutter/widgets/FutureBuilder-class.html). FutureBuilder allows you to specify a future and a builder function. The builder function will be passed snapshots based on the state of the future. You can then check the snapshot and display your loading widget. The same can be achieved by using view models and state management tools like [Provider](https://pub.dev/packages/provider). This is so much easier though. Example:

{% gist https://gist.github.com/lenniezelk/7275c14bcd1b61d3e190b80b4895c524 %}
[India]Best Newsletters To Subscribe to in 2021
Tags: startup, finance, tech
Published: 2021-02-08 17:46:44

​
I like learning about startups and finding out what interesting things are happening in the Indian Startup Ecosystem but I don't want to search through different sources as it is too time-consuming.

So, what's the solution? Newsletters

Newsletters are basically Curated content delivered at your door-step or your mail address:-)

There are newsletters for everything startups, finance, cutting-edge technologies, and so on.

 

Here are a few of my favorite newsletters which you should definitely subscribe to:

1. Filter Coffee: A daily newsletter for business and technology news. It is run by [Tanvi](twitter.com/trdessai) and she is doing great work by consistently delivering great content every day.
A sneak peek:

​​​​​​​​



Subscribe here: [Link to the newsletter](filtercoffee.substack.com/)
 

2. Keeping Up With India: Very detailed and well-researched articles on the Indian Startup Ecosystem. It is run by @[anmolm](twitter.com/anmolm_) and @[vedicakant](twitter.com/vedicakant).  It is a WhatsApp newsletter delivered straight to your phone

It started as a paid newsletter around Jan or Feb 2020 and I was one of the early subscribers(I paid 150rs) and it's totally worth it. But, starting 2021 it's   Free now.



Subscribe here: [Link to the newsletter](www.kuwi.news/), [Link to WhatsApp group](keepingupwithindia.com/api/wa)
 
That's all for today, I'll keep sharing things I find interesting and useful :-)
​
factory-handler
Tags: javascript, node, mongodb
Published: 2021-02-08 17:58:40

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/f5advvsd8xs8pcwdbkxg.png)
A handler factory function documents from all the other collections,with one simple function.Adding very similar handlers to all of your controlles,will create a lot of duplicate code,right?All this create handlers, post handlers, update handlers , or all this delete handlers, they really all just look basically the same , right? Also imagine that we wanted to change, like some https status code or status message, then we would have to go into each and every contollers, and then change all the handlers in there and so , instead of manually writing all these handlers why not simply create a factory function that's gonna return these handlers for us.So a factory function is exactly that it's a function that returns another function and is this case our handler function , so for deleting , for updating , for creating, and for reading resources.For every single model that we have in our application and that we might have in the future, So this function need to be prepared for that and so what that means is that inside the factory function we will pass in the model , so we pass the model and then we create a new function and that function will right away then return our async function.
https://www.npmjs.com/package/factory-handler
My Internship Experience
Tags: internships, career, csharp, dotnet
Published: 2021-02-08 17:45:46

I recently completed a semester-long(5 months) internship as part of my college curriculum, at a small sized organization with about 80 employees.

##What was my work was about?
**Backdrop** :  The company offers an [ERP](https://en.wikipedia.org/wiki/Enterprise_resource_planning) Software. Over the years, as the size of the database increased significantly, the performance of the software became noticeably slower. So it was planned to do database reorganization and restructuring, in order to improve the query time.
 
**Task** : I was supposed to develop a tool that would automate the process. I had to work individually, along with the help from my mentor. So, initially I studied the codebase in order to understand some parts of the business logic and the database design. The tech stack that I had to use was c#/.Net  

##My learnings from the internship :

####1. One should be able to Learn, Unlearn & Relearn things without much resistance 
Before starting the internship, I had no experience in writing code in c#/.Net. Also, my knowledge of DBMS was limited to what I had read in online articles and through YouTube tutorials. I had to spend about one month learning all the necessary things, and doing some practice assignments given by my mentor. I also had to understand and use the coding practices followed there, which was a new thing for me. In the beginning it seemed quite daunting and face paced, but I caught up eventually. 

####2. _“People leave managers, not companies”_
This is a statement I read somewhere in an article. Fortunately for me, I had a very positive experience with my mentor. He is an extremely polite and supportive person. He helped me with a lot of things, despite being worked up with his duties as the CTO of the organization. After I began my actual work on the application, he let me decide the timelines for day to day tasks. And even after wrong estimations initially, he didn't correct me until I got the hang of it. To summarize, a good manager/supervisor/mentor plays a very important role in determining your learning curve and overall experience at work, regardless of the company.

####3. Work Satisfaction => Happy Developers :)
I have always wanted to work on stuff that is going to have some impact on the end user experience. In this case, the users were the account managers of around 40 Enterprises, who would now have to see the loading screen for a couple of seconds less. Seeing my application being deployed on production servers was a moment of pride for me.
Install MacOS in a VM on Linux
Tags: linux, discuss, tutorial, codenewbie
Published: 2021-02-08 17:11:49

#Why would you do this?
The answer is simple if you're a cross-platform developer wanting to test your software on a mac without buying one or just want a hackintosh without all the hassle then this might be for you.

#What are we going to do?
We are going to install a snap package on a computer running a linux distrbution and then with the help of that snap package install macOS on the computer in a virtual machine.


####What are we installing:
We are going to install a snap package called sosumi which is based on [macos-simple-kvm] (https://github.com/foxlet/macOS-Simple-KVM) project that creates a macOS virtual machine easily for us to use.

#####Requirements:
* A computer running a modern linux distrbution of linux that supports snap packages.

####Installation:
* Open your terminal and type `Snap` to check if snap is installed.

* If not then type `sudo apt/dnf/pacman install snapd`.

* Now snap should be installed on your system.

* Now install sosumi by typing `sudo snap install sosumi`.

* A new application will be installed on your computer called sosumi.

####Configurations:
Now the last thing to do is to run the sosumi app and install macOS from the macOS recovery screen. But before you do that you need to know that it will use minimum system resources at first you can configure it to your liking for that just go into your home directory and then you need to go to `/snap/sosumi/common` and then edit the `launch` file present in the folder. The file is set to use 2gb of ram and 2 cores of your processor, you can easily set that your preference.

There is also a file called macos.qcow2 which is the virtual harddisk of the virtual machine you can resize it to your liking by typing 
`qemu-img resize macos.qcow2+"your required size" ` and then launch the sosumi app and it will show you the macOS recovery screen from there you can install macOS.

> If you just want to run only macOS I recommend you use a arch host for better performance.
Announcing Burritalks.io, a curated list of talks for product people
Tags: techtalks, news
Published: 2021-02-08 17:00:31

I read many books and blog posts and watch a lot of talks about software product creation. People I've worked with know that I always have resources to share on many subjects related to software product creation.

I started keeping a list of exciting talks a few years ago. Speeches that made me think, gave me new perspectives or ideas, reshaped the way I think about building software, and helped me grow as a developer.

After a while, I stopped adding items to the list. Even if it was public, no one was using it, not even me. It wasn't easy to find nor looking good. I decided to trust my memory and others medium - Twitter or Pocket - as good places to keep track of these talks. Time proved me wrong.

I hope that creating and curating a website will help me commit to keeping track of them.

The content is primarily oriented for developers. A lot of talks are about system architecture, testing, agile transformation, and choosing the right tool for the job.

So, here it is: [Burritalks.io](https://www.burritalks.io/?
utm_medium=social&utm_source=devto&utm_campaign=announce_post) !

I hope you'll get as many insights as I got from watching some of this content. Let me know what you think!

Edit: fixed link 😅
SFTP server in Ubuntu
Tags: sftp, sftpserver
Published: 2021-02-08 16:56:32

---
title: SFTP server in Ubuntu
published: true
description: How to setup a basic SFTP server in Ubuntu
tags: sftp, sftpserver
//cover_image: https://direct_url_to_image.jpg
---

How to setup a basic SFTP server in Ubuntu.

## Requirements

* No login
* Read and write permissions
* Access only to a base directory
* Default directory should be the base directory

## Instalation

##### Install the sftp server package

    sudo apt-get install openssh-server

##### Create sftp group and user

    sudo groupadd sftpgroup
    sudo useradd myuser -m -G sftpgroup -s /usr/sbin/nologin
    sudo passwd myuser

##### Prepare base sftp directory

    sudo chown root:root /home/myuser
    sudo mkdir /home/myuser/data
    sudo chown myuser:sftpgroup /home/myuser/data

##### Configure sftp server

Edit the file `/etc/ssh/sshd_config`

Comment the following line:

    #Subsystem sftp /usr/lib/openssh/sftp-server

Add the folowing lines at the end of the file:

    Subsystem sftp internal-sftp
    Match group sftpgroup
    ChrootDirectory %h
    X11Forwarding no
    AllowTcpForwarding no
    ForceCommand internal-sftp -d /data

Restart the server

    sudo service ssh restart

## Test

```
$ sftp myuser@localhost
myuser@localhost's password:
Connected to localhost.
sftp> pwd
Remote working directory: /data
sftp> put test.txt
Uploading test.txt to /data/test.txt
test.txt                                                                              100%    0     0.0KB/s   00:00
sftp> ls
test.txt
sftp> quit
```
Responsive, accessible navigation 1: Intro
Tags: webdev, a11y, css, design
Published: 2021-02-09 20:53:58

---
title: Responsive, accessible navigation 1: Intro
description:  "Overview"
published: true
series: "Let's build a responsive, accessible navbar"
date: 2021-02-08 15:00:00 UTC
tags: webdev,a11y,css,design
canonical_url: https://katiekodes.com/responsive-navigation-1/
---

I have a "dream nav bar" in mind, but building it is another issue.  Follow me through this series on a journey through building a minimalistic, accessible, responsive 2-level top-of-site navigation menu.

## Requirements

* It needs to look good on mobile and desktop.
* No weird visual bugs at any screen/window size, no matter what length content _(e.g. `supercalifragilisticexpialidocious`)_ a site author types into the nav's labels.
* All elements need to be big enough for shaky hands to touch / click
* It needs to work well with a mouse or with a touchscreen at all screen/window sizes
* It needs to work well when navigating by keyboard, both "forward" and "backward" through its items
* It needs to be screen-reader friendly, both "forward" and "backward" through its items
* It needs to be visually accessible when navigating through its items _(so that you know what you're looking at before you "click" it)_, whether by keyboard, mouse, voice command, touchscreen, etc.
* It needs to work just fine w/ JavaScript turned off, even if it's not as pretty
* It needs to be visually pleasing enough that I'm not embarrassed to put it on a real web site

## Git repository

[See all my steps & missteps on GitHub](https://github.com/kkgthb/web-site-11ty-04-navbar/commits/main)

## Pictoral highlights

A sneak preview of how far I've gotten...

1st render:

![Screenshot of 1st render](https://katiekodes.com/images/screenshots/screenshot-responsive-navigation-2021/001-beautifying-baseline-screenshot.png)

1st insert of data:

![Screenshot of mostly-unstyled nav data](https://katiekodes.com/images/screenshots/screenshot-responsive-navigation-2021/011-unstyled-loop-html.png)

1st use of flexbox, wide screen:

![Screenshot, first flexbox, big screen](https://katiekodes.com/images/screenshots/screenshot-responsive-navigation-2021/012-grd-loop-wide.png)

And narrow screen:

![Screenshot, first flexbox, small screen](https://katiekodes.com/images/screenshots/screenshot-responsive-navigation-2021/013-grd-loop-narrow.png)
Top 10 Upcoming Anime Movies from 2021 to 2022
Tags: javascript, webdev
Published: 2021-02-08 16:34:27

Top 10 Upcoming Anime Movies from 2021 to 2022
Let me guess, you are wondering:

 

Which anime movie will be shown in the theater this year?

 

Continue reading!

 

More anime movies are being screened than ever before, and there are many promising ones!

 

We have created a list of some of the most interesting films that will be shown in Japanese theaters throughout 2020. For convenience, the list is sorted from closest to the farthest from the release date.

 

All release dates are for Japanese theaters. If you have a chance to see it for yourself, don't miss it!

 

let's start:
http://www.thetrippers.com/forums/topic/36818/wan-zheng-ban-ji-xiang-ru-yi-the-reunions-zai-xian-guan-kan-dian
https://www.myminifactory.com/posts/--the-reunions--602135407ed55
https://www.eventbrite.com/e/-the-reunions-tickets-140826448699
https://www.eventbrite.com/e/the-reunions-tickets-140828637245
https://www.myminifactory.com/posts/---hd-602146923d243
http://www.thetrippers.com/forums/topic/36821/shen-qi-nu-xia1984-wonder-woman-1984-2021wan-zheng-ban-shan-bi
http://www.thetrippers.com/forums/topic/36823/gui-mie-zhi-ren-ju-chang-ban-wu-xian-lie-che-pian-hd-zui-xin-zh
https://www.eventbrite.com/e/hd2021-tickets-140837383405
https://www.myminifactory.com/posts/----hd--602152c9f2c88
How to Install ZNC on AlmaLinux 8
Tags: znc, almalinux, irc, linux
Published: 2021-02-08 16:26:27

In this article, we’ll explain how to install ZNC on AlmaLinux 8.

ZNC is a popular IRC bouncer, a program that allows you to mask your IP address when using IRC and log messages while offline. Multiple clients from different locations can connect to a single ZNC account simultaneously and therefore appear under the same nickname on IRC.

<strong>Prerequisites</strong>
A <a href="https://www.hostnextra.com/vps-hosting.html">AlmaLinux 8 installed server</a>.
A root user access or normal user with administrative privileges.

Learn more: <a href="https://www.hostnextra.com/kb/how-to-install-znc-on-almalinux-8/">Install ZNC on AlmaLinux 8</a>