teleren/devto huggingface dataset:
DAY 12: Inheritance
Tags: python, beginners
Published: 2020-06-26 12:19:21

I’ve been MIA for a while because of I had some other things to take care of also going through the challenge I have met some concepts that have given me a tough time so I put them on hold for further research and keep going with the concepts I can grasp without so much hustle.

This challenge was focusing on inheritance of classes whereby a **child class(derived)** can get the properties and functions of the **parent class(base)**. I learnt a number of new concepts while doing this challenge and as always, practice is key so that when it comes to tackling such questions or teaching the concept, things flow well.

**The Task:**
You are given two classes, *Person* and *Student*, where *Person* is the base class and *Student* is the derived class. Completed code for Person and a declaration for Student are provided for you in the editor. Observe that Student inherits all the properties of Person.

Complete the *Student* class by writing the following:
A *Student* class constructor, which has  parameters:
1.	A string, *firstName*.
2.	A string, *lastName*.
3.	An integer, *id*.
4.	An integer array (or vector) of test scores, *scores*.
A char *calculate()* method that calculates a Student object's average and returns the grade character representative of their calculated average: 

```python
class Person:
    def __init__(self, firstName, lastName, idNumber):
        self.firstName = firstName
        self.lastName = lastName
        self.idNumber = idNumber

    def printPerson(self):
        print('Name:', self.lastName + ",", self.firstName )
        print('ID:', self.idNumber)


class Student(Person):
    def __init__(self, firstName, lastName, idNumber, scores):
        self.firstName = firstName
        self.lastName = lastName
        self.idNumber = idNumber
        self.scores = scores

    def calculate(self):
        self.ave = sum(self.scores)/numScores
        if self.ave >=90 and self.ave <= 100:
            return 'O'
        elif self.ave >= 80 and self.ave < 90:
            return 'E'
        elif self.ave >= 70 and self.ave < 80:
            return 'A'
        elif self.ave >= 55 and self.ave < 70:
            return 'P'
        elif self.ave >=  40 and self.ave < 55:
            return 'D'
        elif self.ave < 40:
            return 'T'

line = input().split()
firstName = line[0]
lastName = line[1]
idNum = line[2]
numScores = int(input())
scores = list( map(int, input().split()) )
s = Student(firstName, lastName, idNum, scores)
s.printPerson()
print("Grade:", s.calculate())

'''
Sample Input

Heraldo Memelli 8135627
2
100 80

Sample Output
Name: Memelli, Heraldo
ID: 8135627
Grade: O
'''
```
Upgrading your laptop to SSD and fixing unresponsive keys.
Published: 2020-06-26 14:18:44

I had purchased a Dell Laptop ~ 8 years ago.  It was only outfitted with a hard drive. I recently upgraded to [SSD drive from Crucial](https://www.crucial.com/articles/about-ssd/ssd-vs-hdd).

**SSD Installation**

They provide the software to do it, and all the instructions.  The results were astounding. My boot times are less than 10 seconds now. It's performance over all is an exponential increase in horse power.  I've been on this SSD for over a year, and have had no problems. My recommendation is 'buy (today) an SSD for your solid state drive laptop".

Oh yes power-down, sleep and log off are instantaneous.

**Keyboard Problems**
 
Much to my surprise, the [blow-off duster](https://www.google.com/search?q=blow+off+duster) worked tremendously.  I used it each morning for 3 days between the keys and my keyboard is acting new again!



I saved over $1500 USD because instead of buying a Dell XPS; I'll just get another 4 years out of current laptop.

JWP2020
What are JavaScript Promises Anyway?
Tags: javascript, beginners
Published: 2020-06-26 14:09:38

A promise in JavaScript is much like a promise in real life. It's quite a fitting name and I applaud the person who thought of it. In code, you use it to do *something*, typically asynchronously. When the promise is complete, either one of two things happen: you fulfill the promise or you fail to fulfill the promise.

A `Promise` is a constructor function, so you must use `new` to create one. Here's what it looks like:

```js
const pinkyPromise = new Promise((resolve, reject) => {
  // your code here
});
```

You'll notice a `Promise` takes in a function as an argument with two parameters: `resolve` and `reject`. Obviously, you can name these parameters whatever you want. I typically use `res` and `rej` because it's easier to type.

A promise has three states: `pending`, `fulfilled` and `rejected`. The promise I showed you above will always be in the `pending` state because we didn't tell the function how to fulfill the promise.

Here's how we can fulfill a promise:

```js
const pinkyPromise = new Promise((res, rej) => {
  if() {
    resolve("Promise was fulfilled");
  } else {
    reject("Promise was rejected");
  }
});
```

We added a simple `if` statement that tells the promise what it should do if it's resolved or rejected. We use strings here but you can pass anything as the argument. 

A typical use case scenario for promises is to fetch data from an external API or any sort of asynchronous function that takes an unknown amount of time to complete. Let's say we want to get weather data from an API. What do we do after it has successfully fulfilled its promise? That is where the `then` method comes in: 

```js
const pinkyPromise = new Promise((res, rej) => {
  if() {
    resolve("Promise was fulfilled");
  } else {
    reject("Promise was rejected");
  }
})
.then(result => {
  console.log(result)
});
```

In the above example, we are telling the promise `pinkyPromise` to log the results to our terminal so we can read it, like weather data. The `then` method will only run when the promise has been resolved. The `catch` method is used in very much the same way as `then` except it only runs if it was rejected:

```js
const pinkyPromise = new Promise((res, rej) => {
  if() {
    resolve("Promise was fulfilled");
  } else {
    reject("Promise was rejected");
  }
})
.then(result => {
  console.log(result)
})
.catch(error => {
  console.log(error)
})
```

You can see that, again, we are just logging what we receive back into the console but this time it's the `error`. Keep in mind `result` and `error` can be named whatever you want it to be and the `then` and `catch` methods can be on the same line as the closing parenthesis. I only put it on a new line to better see what we added to our promise. 

And that's it! To recap, a JavaScript promise is usually used for an asynchronous task that takes an unknown amount of time to complete, like fetching for data. The promise is either resolved or rejected. If it's resolved, then the `then` method will run. If it's rejected, then the `catch` method will run.
REACTJS PROS N CONS
Published: 2020-06-26 14:07:18

ReactJs is one of the most favoured and popular front end development library based on Javascript programming language for developing innovate user interfaces for single page applications.
One of the best choices of developers,it allows developers to create reusable UI components which help in fast development.
Now let's have a look at the pros and cons of ReactJs. 
PROS-
* Virtual DOM
  Reactjs has a virtual DOM which improves app performance by 
  allowing a page to immediately receive a response from the 
  server and display updates. Each time a change is triggered,the 
  entire virtual DOM is updated hence increasing the efficiency of 
  ReactJs.

* Reuseable Components
  ReactJs supports reusable components i.e. once a UI component 
  is created,it can be used in other parts of code or even in 
  different projects with little or no changes.
  While developing a ReactJS app,it is possible to use open-source 
  libraries of pre-built components.This helps to cut down the 
  time required for UI development.

* Downward Data Flow
  Thee one-way data flow in ReactJs is one more feature 
  developers consider beneficial. This data flow is also called 
  top to bottom or parent to child. It means there is only one way 
  data transmission between the elements in a ReactJs 
  application. A downward data flow prevents errors and  
  facilitates debugging.

* Huge Community
  The ReactJs  community supplies tons of valuable libraries that 
  facilitates the ReactJs development process. ReactJs libraries 
  provide developers with new possibilities and ways to improve 
  the quality of their code and apps. Since ReactJs developers 
  often share the libraries with ready to use components,there is 
  an opportunity to implement some of them in your own application 
  and reduce the time required for development.

* React Developer Tools
  React Developer Tools is an extension for Chrome and Firefox 
  that provides a set of inspection widgets to facilitate 
  development. The extensions simplify debugging, allowing 
  developers to search through a list of all components and view 
  deeply nested components straight in a browser. 


CONS OF REACTJS

* Poor Documentation 
  Documentation of ReactJs and its related libraries is often 
  lacking. Developers tend to release updates to libraries without 
  updating the documentation. This makes it hard for others to get 
  acquainted with new features and integrate libraries.

* JSX
  Yes, JSX is a barrier as it is complex for new developers to 
  understand its complexity correctly and work on the projects 
  like a pro.
  In fact,JSX is suitable for ReactJs,in many cases.It enables 
  developers to mix up HTML and Javascript together while it may 
  provide bad experience to the fresher.

* View Part
  As ReactJs is used for developing the dynamic user interface,it 
  has good reasons behind,but it has some adverse impact as well.
  For example, developers need to rely on other technologies as 
  well.
Angular 10 is now available!🌟
Tags: angular, webdev, javascript, typescript
Published: 2020-06-26 14:02:20

Finally,the wait is over.The Angular 10 is available now.So what's new in Angular 10 and what are the updates in it. let's get started.

Angular 10 is smaller than previous versions of Angular. New capabilities include a new date range picker in the Angular Material UI component library and warnings for CommonJS imports. CommonJS import warnings alert developers when a dependency packaged with CommonJS could result in larger, slower applications, allowing developers to substitute an ECMAScript module bundle.

### **How to update?**

To update your current Angular install, you can run this command:
```CLI
ng update @angular/cli @angular/core
```

or you can find the release in github [here!](https://github.com/angular/angular/releases)

### **Key Features in Angular 10:**

⭐️ New Date Range Picker

Angular Material includes this.
![Data picker](https://dev-to-uploads.s3.amazonaws.com/i/9oomkgiz9fy2fwnnzkgg.gif)

To use this in your code,you can use this following components-
```components
mat-date-range-input
mat-date-range-picker
```

⭐️ Optional Stricter Settings

In Angular 10,you can have more strict settings while using `ng new`
```
ng new --strict
```
The strict flag does the following things:
-Enables strict mode in TypeScript
-Turns template type checking to Strict
-Default bundle budgets have been reduced by ~75%
and some more...

⭐️ Keeping Up to Date with the Ecosystem

A few updates to the dependencies of Angular to stay synchronized with the JavaScript ecosystem.
*TypeScript bumped to TypeScript 3.9
*TSLib has been updated to v2.0
*TSLint has been updated to v6

⭐️ New Default Browser Configuration

Updated the browser configuration for new projects to exclude older and less used browsers.

v9 default browser list-
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/klj8kn0tfg0fz4z16d4m.png)

v10 default browser list-
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/sgivn22x17yrwx7lk67d.png)

....and 
⭐️ Deprecations and Removals
⭐️ Angular Team Fixit

and fixed several issues that raised in Angular v9.

You can find more info in [github](https://github.com/angular/angular/releases) and in [Angular official page.](https://next.angular.io/guide/updating-to-version-10)

Thanks for reading!! 😀
How to Build a Chrome Extension to Spam on WhatsApp using Vanilla JavaScript
Tags: bots, chromeextension, javascript, webdev
Published: 2020-06-26 13:50:19

---
title: How to Build a Chrome Extension to Spam on WhatsApp using Vanilla JavaScript
published: true
date: 2020-06-26 13:50:19 UTC
tags: bots, chromeextension, javascript, webdevelopment
canonical_url: 
---

[![](https://cdn-images-1.medium.com/max/640/1*dZWeCw9-25FJBSXzjw4elA.gif)](https://medium.com/swlh/how-to-build-a-chrome-extension-to-spam-on-whatsapp-using-vanilla-javascript-1c00faa6a2f7?source=rss-43799ec6b23------2)

So in this article I’m gonna show you guys how to build a simple chrome extension to spam your foes on WhatsApp using vanilla JavaScript —…

[Continue reading on The Startup »](https://medium.com/swlh/how-to-build-a-chrome-extension-to-spam-on-whatsapp-using-vanilla-javascript-1c00faa6a2f7?source=rss-43799ec6b23------2)
Countdown to js13kGames 2020
Tags: js13kgames, javascript, gamedev, competition
Published: 2020-06-26 13:44:21

---
title: Countdown to js13kGames 2020
published: true
description: Given the global situation, the preparations to this year's competition got delayed a bit, but we're rolling the announcements of partners, experts, and prizes in the coming days up until the official start on August 13th - follow our Twitter and Facebook for details.
tags:
- "js13kGames"
- "JavaScript"
- "Gamedev"
- "Competition"
---

Given the global situation, the preparations to this year's competition got delayed a bit, but we're rolling the announcements of partners, experts, and prizes in the coming days up until the official start on August 13th - follow our [Twitter](https://twitter.com/js13kGames/) and [Facebook](https://facebook.com/js13kGames/) for details.

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

[Previous countdown](https://medium.com/js13kgames/countdown-to-js13kgames-2019-1b3d989f727f)'s blog post (to js13kGames 2019) was published on April 30th (because of the 13 weeks/days/hours combo), while now we are almost two months further in the calendar. What can I say beside "better late than never"?

We're going to have the same categories as last time: Desktop, Mobile, Server, WebXR, and Web Monetization. Theme will be announced on August 13th, the same day the competition will begin. Remember: you'll have a whole month to create an HTML5 game in 13 kilobytes (or less) of a zipped package containing all the resources you need for it to run.

I hope you are as excited as I am!
Code review: don’t just request a change
Tags: codereview, softwareengineering
Published: 2020-06-26 13:39:15

---
title: Code review: don’t just request a change
published: true
date: 2020-06-26 13:35:12 UTC
tags: codereview,softwareengineering
canonical_url: https://le0nidas.gr/2020/06/26/code-review-dont-just-request-a-change/
---

When reviewing a PR I try to elaborate on my proposals for two reasons:

#### 1. Out of respect to my colleague 

Every piece of code is part of an effort that took time and thought. Requesting a code change by simply asking it (`i don't like it, change it`) or by dictating it (`do it this way`) demotes all the work that has been done.

I figured that, since my colleague spent a few hours to come up with a solution I owe her/him more than a few seconds!

#### 2. I solidify my knowledge or even better, learn something new

By trying to justify the reason behind a request I end up understanding better why I prefer a solution or a format over another.

When I provide an example or when I do a mini investigation to help me clarify why something must change I often find that (a) many things that I thought I knew were not as I had them in mind and (b) I now understand a concept much better because **I had to write about it**. You don’t master something if you can’t explain it!

PS: never forget that it might say “_request a change_” but in reality you start a conversation between two professionals that will eventually benefit of the project
How to use the nullish coalescing operator (??) in Javascript
Tags: javascript, typescript, tutorial, webdev
Published: 2020-06-26 13:24:55

>*The nullish coalescing operator (??) is a logical operator that returns its right-hand side operand when its left-hand side operand is `null` or `undefined`, and otherwise returns its left-hand side operand.*

Simply put, the `nullish coalescing` operator let's us truly check `nullish` values instead of `falsey` values. In JavaScript, a lot of values are `falsey`, like the number zero, an empty string, undefined, null, false, NaN etc. 

Check the code below:

```javascript
console.log(NaN ? "truthy" : "falsy"); // falsy
console.log("" == false); // true
console.log(0 == false); // true
console.log(null ? "truthy" : "falsy"); // falsy
console.log(undefined ? "truthy" : "falsy"); // falsy
console.log(false == false); //true
console.log(-0 == false); // true
console.log(document.all ? "truthy" : "falsy"); // falsy

// NaN, undefined and null are not really false
console.log(NaN == false); //false
console.log(undefined == false); // false
console.log(null == false); // false
console.log(document.all == false); // false

```

*`NaN`, `undefined`, `null` and `document.all` are not really equal to false but they are `falsey`, that's why I didn't make a check against `false` and I used a condition instead.*

With this in mind, let's now look at some examples in which we'll first use the `OR` operator and then the `nullish` operator:

```javascript

// using the logical OR (||) operator

const or_printSomething_1 = null || "random string";
console.log(or_printSomething_1); // prints "random string"

const or_printSomething_2 = undefined || "another random string";
console.log(or_printSomething_2); // prints "another random string"

const or_printSomething_3 = 0 || "what? another string?";
console.log(or_printSomething_3); // prints "what? another string?"

const or_printSomething_4 = false || "ok? too many strings!";
console.log(or_printSomething_4); // prints "ok? too many strings!"

// using the logical nullish (??) operator

const nullish_printSomething_1 = null ?? "random string";
console.log(nullish_printSomething_1); // prints "random string"

const nullish_printSomething_2 = undefined ?? "another random string";
console.log(nullish_printSomething_2); // prints "another random string"

const nullish_printSomething_3 = 0 ?? "what? another string?";
console.log(nullish_printSomething_3); // prints 0

const nullish_printSomething_4 = false ?? "ok? too many strings!";
console.log(nullish_printSomething_4); // prints false

```

As you can see, when using `||`, the left side is always evaluated to false and the right side gets printed to the console. When using `??` and the left side is equal to `undefined` or `null`, only then the right side is returned. 

Being a feature of ES2020, the `nullish coalescing operator` is not fully supported by all browsers, so you can check for compatibility [here](https://caniuse.com/#feat=mdn-javascript_operators_nullish_coalescing).

*Image source: Startup Stock Photos/ @startup-stock-photos on Pexels*
🚀10 Trending projects on GitHub for web developers - 26th June 2020
Tags: webdev, javascript, typescript, react
Published: 2020-06-26 13:20:30

Trending Projects is available as a weekly newsletter please sign up at [www.iainfreestone.com](https://www.iainfreestone.com) to ensure you never miss an issue.

### 1. React Query

Hooks for fetching, caching and updating asynchronous data in React 

{% github tannerlinsley/react-query %}

---

### 2. Discord.js

discord.js is a powerful Node.js module that allows you to easily interact with the Discord API.

{% github discordjs/discord.js %}

---

### 3. NextAuth.js

NextAuth.js is a complete open source authentication solution for Next.js applications.

{% github iaincollins/next-auth %}

---

### 4. Cropper.js

JavaScript image cropper.

{% github fengyuanchen/cropperjs %}

---

### 5. Clean Code JavaScript

Software engineering principles, from Robert C. Martin's book Clean Code, adapted for JavaScript.

{% github ryanmcdermott/clean-code-javascript %}

---

### 6. Winston

A logger for just about everything.

{% github winstonjs/winston %}

---

### 7. Awesome-Selfhosted

List of Free Software network services and web applications which can be hosted locally. Non-Free software is listed on the Non-Free page.

{% github awesome-selfhosted/awesome-selfhosted %}

---

### 8. WebdriverIO

WebdriverIO is a test automation framework that allows you to run tests based on the Webdriver protocol and Appium automation technology.

{% github webdriverio/webdriverio %}

---

### 9. react-use

Collection of essential React Hooks

{% github streamich/react-use %}

---

### 10. Mock Service Worker (MSW)

Mock Service Worker (MSW) is an API mocking library for browser and Node.

{% github mswjs/msw %}

---

Trending Projects is available as a weekly newsletter please sign up at [www.iainfreestone.com](https://www.iainfreestone.com) to ensure you never miss an issue.

If you enjoyed this article you can [follow me](https://twitter.com/iain_freestone) on Twitter where I regularly post bite size tips relating to HTML, CSS and JavaScript.
The Best 30 Seconds of My Day
Tags: devjournal, womenintech, codenewbie
Published: 2020-06-26 12:52:33

_This post was originally published on June 26, 2020 on [my blog] (https://alexlsalt.github.io/blog)._

I'm still not over the idea of just taking things one step at a time. Seriously, it helps so, so much every single damn time!

I've been putting off this random task of checking on an immigration item I have - French administration is known for being somewhat of a tangle of confusion - and so, I've been majorly putting it off because I had this thought that it was going to be this all-consuming task that would literally leave me with zero time ever for every last day of my life..

Well, I'm here on the other side, and I'm proud to share that the question and stress I had about it was answered and resolved within, I kid you not, 30 seconds when I ended up going to the immigration office's website and seeing the response as a broad announcement to all site visitors.

Why do I do this to myself?? Lol I should know this by now - to just jump in, get it done (step by step), and move the eff on!

Anyway, now that that only took 30 seconds of my day (as opposed to the rest of my living days), I'm looking forward to diving into some API learning and practicing within my JS course.

Cheers, and have a fantastic weekend!

Thanks so much for reading along! [Now let's be friends over on Twitter >>] (https://twitter.com/alexlsaltt)

P.S. I'm on the cusp of launching a brand-new podcast! Stay up to date by [signing up for the newsletter here >>] (https://www.ladiescodecollective.com/)