teleren/devto huggingface dataset:
Adding and removing items from an array in JavaScript
Tags: javascript, beginners, todayilearned
Published: 2020-01-09 17:36:20

There many different ways of adding items from and array and removing them again. For adding you might want to look into: push(), unshift(), concat(), and destructuring. For removing you could take a closer look at shift(), pop(), and splice().

Here are some code snippets for adding:

```
const cars = ['Audi', 'BMW', 'Ford'];

cars.push('Fiat'); // add one to the end
cars.push('Tesla', 'VW'); // add multiple to the end

cars.unshift('Peugeot'); // add to beginning

const moreCars = ['Honda', 'Bentley'];

cars.push(...['Toyota', 'Volvo']); // add another array to the end
const allCars = cars.concat(moreCars);
```
{% youtube eK3e99FWohM %}

Here are some code snippets for removing:

```
const cars = ['Audi', 'BMW', 'Ford'];

cars.pop() // last car gone
cars.shift() // first car gone
cars.splice(2, 2); // cars at index gone

// You can also remove by value like this:

for (const i = 0; i < cars.length; i++) { 
   if (cars[i] === 'BMW') {
     cars.splice(i, 1); 
     i--;
   }
}

const newCars = cars.filter(carName => {
    return carName !== 'Ford';
});
```
{% youtube ZsOpw-IEur0 %}

How would you go about doing some like this? What do you think would be best from a performance perspective?
Le fobie più strane del mondo
Tags: curiosita, fobie, stranezze
Published: 2020-01-09 17:35:51

In Italia circa <strong>5 milioni di persone soffrono di fobie</strong>, paure che si esprimono in forma patologica. Sono molte le forme di fobia esistenti e di queste molte sono davvero strane e bizzarre a tal punto da non sembrare possibili.

La <strong>fobia</strong> più in generale è una paura irrazionale, persistente e patologica per qualcosa che non rappresenta un reale pericolo. Può essere qualsiasi cosa, come una persona, una situazione, un oggetto o un animale, ma nonostante la persona riconosce la sua paura non riesce a controllarla. 

Le fobie solitamente scaturiscono da <strong>associazioni mentali e traumi</strong> spesso accaduti nell’infanzia.

Di seguito un elenco di alcune delle <a href="https://www.brucofalla.com/curiosita-dal-mondo/fobie-piu-strane/">fobie più strane</a>:

<h3>Panofobia: la paura di tutto</h3>
La panofobia (chiamata anche omnifobia, panfobia o pantofobia) è la paura persistente di tutto, scientificamente nota come “paura non specifica”. 

<h3>Hexakosioihexekontahexafobia: la paura del numero 666</h3>
La hexakosioihexekontahexafobia è la paura irrazionale del numero seicentosessantasei. Il termine hexakosioihexekkontahexafobia deriva dal greco ἑξακόσιοι (seicento), ἑξήκοντα (sessanta) e ἕξ (sei).

<h3>Omfalofobia: la paura dell’ombelico</h3>
La omfalofobia è la paura di toccare o semplicemente vedere l’ombelico, il proprio o quello degli altri. 

<h3>Cenosillicafobia: la paura del bicchiere vuoto</h3>
La cenosillicafobia o cenosillicaphobia è la paura del bicchiere vuoto.

<h3>Papafobia: la paura del Papa</h3>
La papafobia è la paura del Papa e di tutto ciò che è collegato al capo della Chiesa cattolica.

<h3>Uranofobia: la paura del cielo o del paradiso</h3>
L’uranofobia è la paura del cielo o del paradiso. Le persone che soffrono di uranofobia provano una forte ansia della vita dopo la morte. 

<h3>Pogonofobia: la paura della barba</h3>
La pogonofobia è la paura irrazionale della barba, in particolare quelle più folte e lunghe. 

<h3>Tripofobia: la paura di buchi o protuberanze</h3>
La tripofobia è la paura irrazionale di buchi o protuberanze. Il termine tripofobia deriva dal greco τρύπα, trýpa, che significa “buco” e φόβος, phóbos, che significa “paura”.

Seguimi e scopri altre <a href="https://www.brucofalla.com/">curiosit&agrave; e stranezze dal mondo</a>.<br /> <br /> </p>
Differences between `whoami`, `who` and `w` - Linux Tips
Tags: linux, bash, ubuntu
Published: 2020-01-09 17:24:14

### whoami

If I ssh to a linux server, and use `whoami`, it will *print effective userid*:

```bash
$ whoami
bo
```

And if I su to root, then do the `whoami` again, it will print `root`:

```bash
$ whoami
root
```

### who

`who` will *show who is logged on*.

```bash
$ who
bo   pts/0        2020-01-09 11:33
```

Even if I already su to root:

```bash
$ su
$ whoami
root
$ who
bo   pts/0        2020-01-09 11:33
```

### who am i

Huh? I heard `who`, but I don't know you can run `who am i`.

```bash
$ who am i
bo   pts/0        2020-01-09 11:33
```

And what's the difference with `who`? The answer is, `who` will show all users who has a login-tty, and `who am i` will only show the current login-tty user. Say if I ssh'ed to server in another terminal window, then run `who` and `who am i`:

```bash
$ who
bo   pts/0        2020-01-09 11:33
bo   pts/1        2020-01-09 11:45
$ who am i
bo   pts/0        2020-01-09 11:33
```

Now you can see the difference. Ok, if this weird `who am i` works, how about `who are you`? Let's try:

```bash
$ who are you
bo   pts/0        2020-01-09 11:33
$ who is this
bo   pts/0        2020-01-09 11:33
$ who logged on
bo   pts/0        2020-01-09 11:33
```

They all print the same thing as `who am i`! Actually as long as there are 2 parameters followed by `who`, it will print the current login-tty user, no matter what the parameters are.

But you can't run it with 3 parameters, it will print errors:

```bash
$ who is this tty
who: extra operand ‘tty’
Try 'who --help' for more information.
```


### w

w will *Show who is logged on and what they are doing*, so it is like `who`, plus the "what they are doing" info:

```bash
$ w
12:12:01 up 78 days, 15:52,  2 users,  load average: 0.25, 0.34, 0.29
USER TTY      FROM          LOGIN@  IDLE   JCPU   PCPU  WHAT
bo   pts/0    67.xx.xx.xx   11:33   0.00s  0.13s  0.00s sshd: bo[priv]
bo   pts/1    67.xx.xx.xx   11:45   26:49  0.04s  0.04s -bash
```

Then can we use `w am i`? let's try it:

```bash
$ w am i
12:15:25 up 78 days, 15:55,  2 users,  load average: 0.08, 0.22, 0.25
USER TTY      FROM          LOGIN@  IDLE   JCPU   PCPU  WHAT
```

You can see it only prints the header info, but no users in the USER section. This is because with extra parameter, `w` will only take the first parameter as a user id and print user with that id. So for `w am i`, it will try to find a user with user id `am`, if this user exists and has a login-tty open, print it out, otherwise show nothing.

```bash
$ w bo
12:17:01 up 78 days, 15:57,  2 users,  load average: 0.25, 0.34, 0.29
USER TTY      FROM          LOGIN@  IDLE   JCPU   PCPU  WHAT
bo   pts/0    67.xx.xx.xx   11:33   0.00s  0.13s  0.00s sshd: bo[priv]
bo   pts/1    67.xx.xx.xx   11:45   26:49  0.04s  0.04s -bash
```
Testing Apollos reactive variables in Vuejs and GraphQL
Tags: graphql, vue, testing
Published: 2020-01-09 16:48:07

We love [Vue.js](https://vuejs.org/), we love [GraphQL](https://graphql.org/), we love testing, and we love [Vue Apollo](https://github.com/vuejs/vue-apollo). 

We have been having some great discussions in the office about how to test specific parts of [Vue Apollo](https://github.com/vuejs/vue-apollo). They have a great guide on testing that allows you to assert that `Mutations` were sent, or you can test how a [smart query's](https://apollo.vuejs.org/guide/apollo/queries.html) data causes the Component to render. These are great if your queries are static but what if you have dynamic or reactive variables on your query.

On one hand, you can test the dynamic nature of the query with an `e2e` test but that feels heavy-handed instead you can test the variables on your query directly.

Say you have this component

```ts
const wrapper = mountVue(GroupShow, {
  mocks: {
    $route: {
      params: { userId: this.$route.params.userId },
    },
  },
});

```

Then a simple test to say the queries variables could be 

```ts
it('queries the correct group', () => {
  const data = {
    userId: 6,
  };

  const wrapper = mountVue(GroupsIndex, {
    mocks: {
      $route: {
        params: { userId },
      },
    },
  });

  wrapper.setData(data);

  expect(
    wrapper
      .vm
      .$options
      .apollo
      .groups
      .variables
      .bind(wrapper.vm)().userId,
  ).toEqual(6);
});
```

A couple of things to note. 

1. I only feel obligated to test the variables function because I trust [Vue Apollo](https://github.com/vuejs/vue-apollo) to handle the variables correctly.
1. Notice the `Function.bind` call. When executing the function outside of Vue's event loop you don't have the same this so you need to bind back to the wrapper's view model.

Hopefully, this saves someone some time!
Analytics Engineer - REMOTE
Published: 2020-01-09 16:45:02

Analytics Engineer - Cincinnati, OH (REMOTE)- Direct Hire
The company offers; Unlimited PTO, Flexible work hours, and employer-paid health, dental and vision insurance for you and your dependents
You have experience with JavaScript and JQuery
You have a good understanding of web technologies and frameworks
Preferred - experience with Java development, Python development , Could Services and mobile web development.

502-805-5851
ryan.anderson@russeltobin.com
How To Deploy Apollo Server To Elastic Beanstalk
Tags: deployment, aws, beginners, graphql
Published: 2020-01-09 16:39:16

---
title: How To Deploy Apollo Server To Elastic Beanstalk
published: true
description: Beginners guide to deploying Apollo server to Elastic Beanstalk
tags: Deployment, AWS, Beginner, Graphql
cover_image: https://thepracticaldev.s3.amazonaws.com/i/cg5013t4i2y5r6bhavil.jpg
---
Deploying an application to Elastic Beanstalk was pretty tricky for me at first. It's pretty simple but somehow I messed it up so many times. Here is a guide to get you started so you don't make the same mistakes I did. 

## First things first

1. clone or download this repo [https://github.com/ikey2244/apollo-server-elastic-beanstalk.git](https://github.com/ikey2244/apollo-server-elastic-beanstalk.git)
2. navigate to wherever you downloaded it
3. click on the apollo-server-elastic-beanstalk folder
4. highlight everything, right click and create a zip called application.zip
5. we will be using this zip later so just hang on to it for now

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/d1u3ler75cnz90g4haqx.gif)

## Getting Started with Elastic Beanstalk

Sign into your AWS console [https://aws.amazon.com/](https://aws.amazon.com/). Or go to [https://portal.aws.amazon.com/billing/signup#/start](https://portal.aws.amazon.com/billing/signup#/start) if you haven't made an account

**dislaimer: AWS makes you put in a credit card in order to make an account. It's free but you have to monitor your usage. It's very easy to wrack up charges.*

Once you've signed in or created your account you will be greeted with this page. Go ahead and search for Elastic Beanstalk. Click the "Elastic Beanstalk" from the suggestions list

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/ri8idymlymo3mumfyc94.png)

Click the blue "Get Started" button

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/y81g6zwqvzee0pkiouir.png)

This is where we will configure our Elastic Beanstalk environment and application.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/x1gv9raed1hg664yynwa.png)

Go ahead and do the following:
1. **Application name**: apollo-server
2. **Platform**: Node.js
3. **Upload your code: click "upload" button**
a window will pop up that looks like this:

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/xkyf090n95o2n1b4yyhn.png)

4. Choose the zip file called application.zip that we created earlier
5. Click "Upload" button
6. Finally click the "Create Application" button

After following those steps you should see something like this:

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/r0vc5o2vdacwmquorpmt.png)

Now we wait...

## Finishing up

If followed each step correctly you should see something like this. Success!

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/2qvf99uyow026n5mjvym.png)

Click on the URL that was generated at the top and see your new application in all of its glory!

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/hmysdb2bascoll13k72i.png)

This is a pretty simple setup. Stay tuned for a more complicated example. :)
Code Challenge #5 | styled jsx | Raising Card
Tags: challenge, javascript, css
Published: 2020-01-09 16:28:09

## Challenge

Make the card component be able to receive an image prop and display it on the top half of the card. 

{% codesandbox kjnik module=/components/card.js %}

[Solve the challenge on CodeSandbox](https://codesandbox.io/s/raising-card-sample-kjnik?module=components/card.js)

**Remember**

To edit the sandbox you'll need to fork it.

## Solution

You can send your solutions and request any help by reaching us via twitter to [@thatgoodcompany](https://twitter.com/thatgoodcompany) or via email to [contact@thatgoodcompany.com](mailto:contact@thatgoodcompany.com).
Would you like to have better XML support in SQL Server?
Tags: sql, database, sqlserver
Published: 2020-01-09 16:01:49

If so, you should check out and vote for Yitzhak Khabinsky's proposal [SQL Server vNext (post 2019) and NoSQL functionality](https://feedback.azure.com/forums/908035-sql-server/suggestions/38142115-sql-server-vnext-post-2019-and-nosql-functionali) on feedback.azure.com.
Learn Docker From Scratch
Tags: docker, microservices, kubernetes, devops
Published: 2020-01-09 15:57:41

# The problem

Imagine being approached by a friend who has an idea for a startup and you need to launch your app as quickly as possible. You've successfully completed the web app and you're ready to deploy the app but you then realize that your app is running different versions of a technology which would result in version conflicts when deployed .🤔 Now what would you do? "Duuh🤷‍♀️ deploy on several Virtual Machines". Well, possible but then what if we want to perform updates, load balancing? You don't want to be handling hosting environments, runtimes, libraries and OS needed by your application.That would  be a lot of work.  Enter containers !!

Containers help us deploy our apps easily. Deploying is a simple as running a new container. You can even route users to containers, and trash old ones…If you want less work you can even automate those with orchestrators..

![Docker and Virtual Machines | Desmond Nyamador - Dev.to](https://thepracticaldev.s3.amazonaws.com/i/5uz69hip2nkl8h1tz37h.png)

# How do containers work?
Unlike virtual machines which provide hardware virtualization, a container provides OS level virtualization by isolating the software from it's environment and ensuring that it works uniformly despite differences. They make applications easier to work with. 

Docker is an example of  container based technology.


**Let's Get Started!!**
To get started with docker head over to [Docker](https://hub.docker.com/?overlay=onboarding) and download docker desktop for your OS (Mac, Linux or Windows)

**WINDOWS**
Before you install docker on windows you have to:
	1. Enable Hyper-v
	2. Enable hardware vitualization

**Linux**
Various packages exists depending on your flavour of linux. You can find post installation steps here [Docker for linux](https://docs.docker.com/install/linux/ubuntu/)

**MAC**
Docker Desktop need MacOs Sierra 10.12 or above.


# Run a Container
NB: All commands are the same and do not differ when using a different os
After successfully installing docker desktop, run the following code in you terminal

`docker run hello-world`


![Docker Hello World](https://thepracticaldev.s3.amazonaws.com/i/jmcjs1im3d1909bdfuz1.jpg)

That’s it: your first container. The hello-world container output tells you a bit about what just happened. Essentially, the Docker engine running in your terminal tried to find an image named hello-world. Since you just got started there are no images stored locally `(Unable to find image...)` so Docker engine goes to its default Docker registry, which is Docker Store, to look for an image named “hello-world”. It finds the image there, pulls it down, and then runs it in a container. And hello-world’s only function is to output the text you see in your terminal, after which the container exits.


In the next post we'll take a look at Images.
Why software development is so conservative?
Tags: watercooler
Published: 2020-01-09 15:43:15

---
title: Why software development is so conservative?
published: true
description: Software development history at high level
tags: #watercooler
---

It might sound unexpected, but software development is extremely conservative and slow to accept new ideas. Few examples:

##Agile Methods
A thing which can be considered a prototype of traditional agile team was introduced almost 50 years ago - it was [Chief Programmer Team](https://en.wikipedia.org/wiki/Chief_programmer_team). In 1974 Ernest  Edmonds published a paper “A process for the development of software for non-technical users as an adaptive system,” (General Systems, vol. 19, pp. 215–217, 1974) which describes iterative approach to software development - the core of Agile Methods.

Wider acceptance of these methods began another 30 years later, but even today you can see "scrum experience ... is a plus" in job descriptions, meaning that it's something relatively new for the hiring company.

##OOP
The whole software development history is a fight with complexity. And most complexity in software appears from internal dependencies. One of the first and most successful attempts to fight this complexity was introduction of structural programming. Basically it introduced encapsulation for the code - every function/method is considered a black box with defined interface. From this point of view OOP is a natural extension of structural programming - it adds encapsulation to data. Due to this no one should be surprised that OOP did born in about the same time frame as structural programming - around second half of 60's. 

Wide switching to OOP started somewhere in 90's and there are still areas (bare metal embedded software development) where many developers consider OOP as bad and harmful.

---

List above contains only most prominent examples which show how actually conservative software development is. The only thing which I still don't understand - why...
Using Static Keyword in JavaScript
Tags: javascript
Published: 2020-01-09 15:38:25

---
published: true
title: Using Static Keyword in JavaScript
description: Learn how and when to use the static keyword in JavaScript
tags: javascript, typescript
canonical_url: https://coryrylan.com/blog/using-static-keyword-in-javascript
---

This post, we will learn how the `static` keyword works in JavaScript.
First, let's take a look at a simple JavaScript Class.

```javascript
class Person {
  constructor(firstName, lastName) {
    this.firstName = firstName;
    this.lastName = lastName;
  }

  greet() {
    console.log(`Hello, ${this.firstName} ${this.lastName}`);
  }
}

const person = new Person('Cory', 'Rylan');
person.greet(); // Hello, Cory Rylan

const person = new Person('John', 'Doe');
person.greet(); // Hello, John Doe
```

With JavaScript Classes, we can add methods and properties that can be accessed per instance of the Class. This is standard behavior when you make multiple instances of a Class. If we create a method that does not access an instance property, we can use the `static` keyword.

```javascript
class MathUtils {
  static add(num, num2) {
    return num + num2;
  }

  static subtract(num, num2) {
    return num - num2;
  }
}

// Static Methods
console.log(MathUtils.add(1, 2)); // 3

// Cannot access static values on instance
const instance = new MathUtils();
instance.add() // error undefined
```

When creating a static method, it can only be accessed on the Class definition itself. If you try to access the method on an instance, it will fail. Static methods are useful for utility methods that do not contain any state. One could argue that if you have `static` methods, you could refactor them to be plain functions instead.

You can also use the `static` keyword on properties and getters.

```javascript
class MathUtils {
  static value = '';
}

// Static Properties
MathUtils.value = 'Hello from static property';
console.log(MathUtils.value);
```

When using `static` properties, you can access them and set them any time, but they exist only on the Class itself and are not accessible to any instance of the Class. Along with `static` properties, you can create `static` getters.

```javascript
class MathUtils {
  static get random() {
    return Math.random();
  }
}

// Static Getter
console.log(MathUtils.random, MathUtils.random); // two different values
```

Static getters allow you to compute values on the fly with a property.
For this example, we return a new value anytime we access the `random` property.

Check out the [full working demo](https://stackblitz.com/edit/js-2fqpwe)!
Sad Status in Punjabi Video | Sad status video | Punjabi Song 2020
Tags: whatsapp, status, video, punjabisong
Published: 2020-01-09 15:21:38

Sad Status in Punjabi Video | Sad status video | Punjabi Song 2020.If any pain comes in our life then painful songs are useful for feeling relaxed. At video song status you'll find painful sad video status. This video status flawlessly demonstrates things of somebody who is facing sad-alone time period in life. you'll download this punjabi sad status video and set as your WhatsApp story...
Looking for Front-end / Back-end developers to give comments about the perfect brief
Tags: help, discuss, career
Published: 2020-01-09 14:54:00

We are writing an article "marketers vs. developers" and need developers to answer a couple of questions: 

1. What are the main and the most important things in the brief for the developer? 

2. What is often forgotten to be included in the brief (something needed for further work)? 

3. What is not as important but appears in brief? 

4. How can marketers help developers with his/her work? What information to provide, how to set a task? 

5. How do marketers interfere developers while thinking that they are being useful? 


The main point of the article is to explain to marketers how to create an ideal brief. I would say a big-big Thank you for those who decide to help us :)
A trickier but simple JavaScript question
Published: 2020-01-09 14:19:44

<h1>Question</h1>
Write a js code that prints to the console the numbers from 1 to 100. But for multiples of 3 print “Fizz” instead of the number and for the multiples of 5 print “Buzz”. For numbers which are multiples of both 3 and 5 print “FizzBuzz”?

<h3>Answer</h3>
<code>
*1. We declare a variable*
*2. Do a for loop, let y equal to 1 and whenever y is less than x, the loop runs again*
*3. Check for y values that are divisible by both 3 and 5 and print FizzBuzz instead of the number*
*4. check for y values that are divisible by 3 and print Fizz instead of the number*
*5. check for y values that are divisible by 5 and print Buzz instead*
*6. Else print the number*

let x = 100;

for(let y = 1; y<=x; y++){
   if(y%3==0 && y%5==0){ console.log('FizzBuzz') }
else if(y%3==0){ console.log('Fizz') }
else if(y%5==0){ console.log('Buzz') }
else{ console.log(y) }
}
</code>

Hope this was helpful
Daily Challenge #157 - Is N Divisible by X and Y? 
Tags: challenge
Published: 2020-01-09 14:43:02

---
title: Daily Challenge #157 - Is N Divisible by X and Y? 
published: true
description: Create a function `isDivisible(n, x, y)` that checks if a number `n` is divisible by two numbers `x` AND `y`. All inputs are positive, non-zero digits.
tags: challenge
---

Create a function `isDivisible(n, x, y)` that checks if a number `n` is divisible by two numbers `x` AND `y`. All inputs are positive, non-zero digits.

*Example*:
`is_divisible(3,1,3)--> True because 3 is divisible by 1 and 3`
`is_divisible(12,2,6)--> True because 12 is divisible by 2 and 6`
`is_divisible(100,5,3)--> False because 100 is not divisible by 3`
`is_divisible(12,7,5)--> False because 12 is neither divisible by 7 nor 5`



***
_This [challenge](https://www.codewars.com/kata/5545f109004975ea66000086) comes from naaz on CodeWars. Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_

_Want to propose a challenge idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_