teleren/devto huggingface dataset:
How to Have a Good Code Review Mindset, Tips for New Developers
Tags: beginners, career, productivity
Published: 2020-02-14 19:43:02

Lot has been written about code reviews - how to submit good code reviews, how to be an effective reviewer, things to do and not do. What I want to talk about is the developer mind and the games it plays during this process. 

Developers have feelings. Really. We feel good when we write code that works in production and is being used by real users. We feel bad when someone finds a bug in our code. We feel embarrassed when we submit a 20 line code review and there are 10 comments on it.

But actually this can be good news. It means we can now learn 10 things and our next code can benefit from those tips!

So how can we tell our mind to feel energized instead. Here are some things to try: 

1. Submit code reviews to one or two experienced developers who are also good at the art of reviewing code (i.e. don't submit to a dozen people). Find a willing developer and do a pre-review with them if necessary.

2. Address all review comments as fast as possible and get back to the reviewer to tell them you've done that immediately. This helps keep up the momentum towards 'ship it!' which is important for your mind to not get distracted and feel lazy about following through. 

3. Ask questions to clarify the suggestion, use code snippets to ask specific detailed questions (would this line of code be better than this?). Don't engage in vague theoretical conversations.

4. Once you've resolved all code review comments and made code changes, rerun tests and do basic sanity testing of the functionality before pushing (to confirm your new changes has not introduced bugs. You mind will feel good if you catch it and embarrassed if someone else does later)
 
5. After you push code, keep an eye on the CI builds and if something breaks immediately jump in and investigate why (even if it is not your change, offer to help!)

6. Keep a written list of all the tips you've gotten during code reviews and each time you're ready to submit a code review go through that checklist. So review your own code first, and try not make repeat mistakes (instead make new mistakes!)  

Participating in code reviews like this demonstrates confidence. You're new and you're learning but you're confident and you know how to incorporate feedback. Nothing can stop you now! :)

In my first coding job after getting a computer science undergrad degree there was no real code review culture. It was a really big company and it was hard to figure out how to learn from other developers around me. I wish someone had told me to write code and get other developers to tell me what's wrong with it! And keep doing that until I could tell myself :)
Algorithmic problems in technical interviews
Tags: computerscience, algorithms, interview, career
Published: 2020-02-14 19:10:22

When facing an algorithmic problem in a technical coding interview, is the expectation that you'll break down the problem and intuitively find the optimal answer or that you'll know the right algorithm to use for that specific problem?

Like thinking of using Kadane's algorithm for a Maximum Sum Subarray Problem for example.
Creating custom VSCode snippets (now in video format!)
Tags: vscode, snippets, tutorial
Published: 2020-02-14 18:19:48

Creating custom snippets to fit your unique workflow will help you code faster.

I turned my first [dev.to article](https://dev.to/ryanwarner/creating-custom-vscode-snippets-35bf) into video format to better communicate the content.

My full snippets file is on [GitHub](https://github.com/RyanWarner/vscode-snippets/blob/master/Global.code-snippets).

There's a lot more you can do with snippets. Take a look at the [official documentation](https://code.visualstudio.com/docs/editor/userdefinedsnippets) to see what's possible.

This video is also posted on [YouTube](https://www.youtube.com/watch?v=bJ4yc2o7Cds).
Create a 2x2, 3x3 or NxN matrix with JS
Tags: javascript
Published: 2020-02-14 18:11:05

The matrix 2x2 is simple, :
I think the matrix of 2x2 and 3x3 is easy.

#### Example: Matrix [2x2];
```javascript
var det=(matriz[0][0]*matriz[1][1])-(matriz[1][0]*matriz[0][1]);
 ```
#### Example: Matrix [3x3];
```javascript
var r1=(matriz[0][0]*matriz[1][1]*matriz[2][2])+(matriz[0][1]*matriz[1][2]*matriz[2][0])+(matriz[0][2]*matriz[1][0]*matriz[2][1]);
var r2=(matriz[0][2]*matriz[1][1]*matriz[2][0])+(matriz[0][0]*matriz[1][2]*matriz[2][1])+(matriz[0][1]*matriz[1][0]*matriz[2][2]);
var result = r1-r2;
 ```


First create a function for get size the matrix.
```javascript
 function Matriz(size){
     var matriz = new Array(size);
         for(i = 0; i < size ; i++){
                matriz[i]=new Array(size);
               
          }
     return matriz;
 }

 ```

#### to be continue
Dungeons & Dragons Max Hit Points Calculator
Tags: project, hobby, dnd, csharp
Published: 2020-02-14 18:03:26

---
title: Dungeons & Dragons Max Hit Points Calculator
published: true
description: In this post I'm sharing a fun little project I built to save some time in D&D when determining HP as my characters level up.
tags: Project, Hobby, DnD, CSharp
---

This week I wanted to do something different and share a fun little side project I put together! A bit of backstory: I've recently begun playing Dungeons and Dragons with some friends and think it's awesome, and going through the trouble of learning how to determine my character's HP at each level was some combination of humorous and frustrating. When I figured out the math, I decided to really solidify the concept and save future me some time in the process... and so the D&D Max Hit Points Calculator was born!

I built the Calculator as a Windows Form Application and it is quite simple and easy to use (and would be a fun learning project for anyone getting into C#). Simply enter your character's current max HP (or 0 if it's a new level 1 character) into "Current Max HP", put your Constitution modifier value into "Const Modifier", and click Roll after selecting the hit die your class was designated to generate your rolled die value. Click Calculate Max Hit Points and voila - the math's been done for you! The "Current Max HP" value will even update, making rolling for multiple levels a snap.

![Max Hit Points Calculator](https://dev-to-uploads.s3.amazonaws.com/i/h7gn759qkboptveivrgs.PNG)

Here's a link to the source code: [D&D Max Hit Points Calculator](https://github.com/rsoderberg/D-D-Max-Hit-Points-Calculator). You are welcome to use this project for whatever you'd like (except selling or distributing it, obviously). Feel free to learn with it, copy and tweak it, use it for your own D&D games, or even comment/email me with suggestions (r_soderberg@yahoo.com).

---

If you'd like to catch up with me on social media, come find me over on [Twitter](https://twitter.com/RachSoderberg) or [LinkedIn](https://www.linkedin.com/in/rachelsoderberg/) and say hello!
Using Case Statements
Tags: ruby, codenewbie, refactorit, beginners
Published: 2020-02-14 17:58:24

As a true beginner, every line of code is a learning opportunity. 

This week, I paired with another student and successfully completed our first-ever CLI program as part of our curriculum at Flatiron School. We implemented many of the skills that we learned in just 2 weeks of the program including:  OOP, Ruby, SQL and ActiveRecord. 

Just when I thought I had leveled up and written the perfect block of code in our “Main Menu”, my teammate slacked me with a question. He asked if I considered using a case statement in place of my many “If…else…” lines of code. Honestly, this never crossed my mind. I was familiar with the terminology but didn’t realize it would be much easier and “cleaner” to refractor this block of code.

In short: A case statement starts out with an optional condition accompanied with a number of “when” clauses. The first “when” clause to evaluate to true is executed.

A simple case statement example:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6s1zbeaxwlw9vys4jsr3.png)

In the Main Menu of our CLI program, each "when" clause executes a method that helps the user navigate the program:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/2x2r5g2zphn9vlkbtfxi.png)

The user only sees the following text:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/hxgtx37sim1r7ad5p5jg.png)

Typically, case statements are a better choice over "If...else..." conditional statements when you have 3 or more conditions to evaluate. 

You can also write a case statement with multiple "when" clauses, separated by commas:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/qchhrkyjkmnrafu8569d.png)

Personally, this was a short but valuable lesson in refactoring code that I was able to implement in multiple parts of our program! There are many creative uses of case statements beyond these examples.

Visit www.ruby-doc.org to learn more.
What was your win this week?
Tags: discuss, weeklyretro
Published: 2020-02-14 17:32:21

---
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
---

👋👋👋👋

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

All wins count -- big or small 🎉

Examples of 'wins' include:

- Getting a promotion!
- Starting a new project
- Fixing a tricky bug
- Cleaning your house...or whatever else that may spark joy 😄

![cool-dog](https://media.giphy.com/media/kiBcwEXegBTACmVOnE/giphy.gif)

Happy Friday!
Dracula PRO released! 🧛‍♂️
Tags: theme, dracula, productivity, darkmode
Published: 2020-02-14 17:27:59

_First I want to start by saying that I am not affiliated with Dracula nor is this a sponsored post, I am just a fanboy 🤓_

People that use a dark theme for their dev environment might have already heard about [Dracula](https://draculatheme.com/), it is one of the most used custom dark themes and has support for a wide variety of applications (Jetbrains, iTerm, Slack, ...).

I have been using Dracula for some time now and for every application that it supports. I find this useful to have a similar theme across multiple tools. Also it being [open-source](https://github.com/dracula/) is a huge bonus for me.

A couple of weeks ago @zenorocha announced that he was working on a Dracula PRO alternative but didn't share any details about it. I was very excited to see that the creator of Dracula is working on something new.

This week he finally released [Dracula PRO!](https://draculatheme.com/pro/) It is a very similar dark theme but for this he did a lot of research in color palettes  and used a more mathematical approach to define the colors that he used.
Also instead of only 1 theme he created 6 different variants that are slightly different from each other so that users can decide which one they like more according to their personal taste.

Zeno also handpicked 4 monospaced fonts with ligature support that would work best with the Dracula theme. He released the Dracula Pro theme with support for 10 application and from I heard more will be added in the future.

I know that I will be buying and trying out the new Dracula PRO this weekend!

**What do you think about this new theme and would you consider spending money on a theme?**

---

Also if you haven't seen it yet [ploi.io](https://ploi.io/) is giving away a Dracula Pro license on their Twitter!

{% twitter 1227548548683747328 %}
My Research paper on the 2017 Equifax Breach and potential AWS solutions
Tags: security, aws, news, watercooler
Published: 2020-02-14 17:26:05

You may have read this week that on Feb 10, 2020 the United States DoJ charged Chinese military members with hacking into Equifax and stealing consumer PII.

This paper was written 1 week before the US Government announced formal criminal charges. 

AWS offers a few possible solutions to prevent another cyber attack of this scale. 

Link to the document since I am unable to attach non-image files:
https://send.firefox.com/download/1dccfbee428a0f80/#tRA8765ylfKgyaYijLy4nw
Daily Challenge #187 - Most Sales
Tags: challenge
Published: 2020-02-14 17:23:04

---
title: Daily Challenge #187 - Most Sales
published: true
series: Daily Challenge
description: Which product at your store earned the most revenue?
tags: challenge
---
You work in the best consumer electronics company around. Your boss asked you to find out which products generate the most revenue. 

You'll be given lists of `products`, `amounts`, and `prices`. Given these three lists of same length, return the product name(s) with the highest revenue (`amount * price`). If multiple products have the same revenue, order them according to their original positions. 

###Example
products: ["Computer", "Cell Phones", "Vacuum Cleaner"]
amounts: [3, 24, 8]
prices: [199, 299, 399]

return: `Cell Phones`

###Test
products: `["Cell Phones", "Vacuum Cleaner", "Computer", "Autos", "Gold", "Fishing Rods", "Lego", " Speakers"]`
amounts: `[0, 12, 24, 17, 19, 23, 120, 8]`
prices: `[9, 24, 29, 31, 51, 8, 120, 14]`

***
_This [challenge](https://www.codewars.com/kata/5e16ffb7297fe00001114824) comes from JakobPri 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!_
WavBox Llc
Published: 2020-02-14 17:13:39

This application gives users the ability to serf through videos of other users as well as create their own. We wanted to provide users the experience of seeing other people great creativity as well as a microscope into the lives of many. The limits are endless when it comes to what you can post and the sky is the limit. We believe in creativity, we believe in free expression, we believe in the free speech of all humans, and lastly, we believe that the lives of all those who come on our platform are heard. 


Things to consider:

We are not the publishers of any content on our page because we believe that we only provide a platform for all (similar to a cell phone company), and therefore, we are not liable for any content that is on the site. We treasure the value of those who post content to be able to police themselves because we are all adults and responsible for our own actions.
Package alias name using NPM/yarn
Tags: npm, javascript, webdev
Published: 2020-02-14 17:08:51

Have you ever tried to install a package under an alias? you can do this using **NPM** or yarn. Lets try to rename **lodash** package to another name.

with [NPM](https://www.npmjs.com/):
```bat 
npm install yourPackageName@npm:lodash --save
```

with [yarn](https://yarnpkg.com//):
```bat
yarn add yourPackageName@npm:lodash
```


Now you can import your aliased package with 

```javascript
const yourPackageName = require('yourPackageName');
```

Happy hack week :sunglasses:
golang multiple return
Tags: go, beginners
Published: 2020-02-14 16:44:57

Typically a function only returns one variable, but why should that be?

In the <a href="https://golang.org/">Go</a> programming language, <a href="https://golangr.com/methods/">functions</a> can return multiple values. This is unlike C, where a function only returns one value. However there are other languages that support multiple return, like Python.

On syntax we can say, the type of return value is written at the end instead of in the beginning. Where in C you would have

```c
int plus(int a, int b) {
```

In Go the same function would be

```go
func plus(a,b int) (int) {
```

## Multiple return

As I mentioned above, functions in Go can return multiple values.
You can have a function like this:

```go
func swap(x, y string) (string, string) {
	return y, x
}
```

This function then returns two variables of the type <a href="https://golangr.com/strings/">string</a>, but it also takes two parameters of the type string.

You can store the output like this:


```go
a, b := swap("hello", "world")
```

So if you put that in a program, you would have this:

```go
package main

import "fmt"

func swap(x, y string) (string, string) {
	return y, x
}

func main() {
	a, b := swap("hello", "world")
	fmt.Println(a, b)
}
```

That gives you new options when programming. You could have a multiply function that returns the input values and the output.

```go
package main

import "fmt"

func multiply(a,b int) (int,int,int) {
    return a,b,a*b
}

func main() {
    a, b, c := multiply(16,13)
    fmt.Println(a,b,c)
}
```

If you run it you'll see that:

```
➜  ~ go run example.go
16 13 208
```
Custom Angular Material Progress Spinner
Tags: todayilearned, todayisearched, angular
Published: 2020-02-14 16:38:04

Progress Spinner is used to showing as a loader on the website. So here we used the Angular Material component which name is Progress Spinner but,  here we used custom colors.

This Spinner looked like a circle with effects and Also, given in material angular.  In these components, we modify the spinner class to own colors and used parent class to mat-spinner tags. These elements you can use in your any website and also you can modify colors. Here we also used one container class and css3 flexbox properties to make this element in a single row. Also used flex-wrap properties to manage spinner in automatically to move in multiple lines.

Make it yours now by using it, downloading it and please share it. we will design more elements for you.

Read more or Source code:-
https://w3hubs.com/custom-angular-material-progress-spinner/
desirable properties of tests
Tags: testing
Published: 2020-02-14 16:37:25

---
title: desirable properties of tests
published: true
description: 
tags: testing
---

I started watching this series: https://www.youtube.com/watch?v=5LOdKDqdWYU&list=PLlmVY7qtgT_lkbrk9iZNizp978mVzpBKl&index=1


The second part of the series has a great message.

You want your tests to be insensitive to the structure of your code. I picked this up somewhere along the way but strongly with Java and interfaces. You write your tests to your interfaces not the internals of the concrete implementations.

If you are not in Java you still have an interface. Even if you have not explicitly defined it is there.

To quote Rush

>If you choose not to decide You still have made a choice

Another point here is that refactoring should not break tests in this way. You are changing how things work not the interfaces.

A good series of videos if you have time to watch it.
Remote Workers, how do you manage your time throughout the day?
Tags: wfh, remoteworker, developer, discuss
Published: 2020-02-14 16:30:06

As someone who recently began to work from home full time, I find it is a big change compared to working in an office. It comes with a new set of freedoms and responsibility. 

I want to hear from the DEV Community on how you spend your time at home working!
GRAPHQL WITHOUT A DATABASE (GraphQL tutorial/demo)
Tags: graphql, techtalks, webdev, tutorial
Published: 2020-02-14 16:12:43

> This video is a talk from *Byteconf GraphQL 2020*, a free, live-streamed GraphQL conference that aired on January 31st, 2020. [Visit our website](https://www.bytesized.xyz/graphql-2020) to sign up for the Byteconf GraphQL "swag bag", a free downloadable resource with everything you need to get started with GraphQL, as well as info about future Byteconf events!

Your frontend developers are pushing to get started with GraphQL, but you don't have the backend capacity to migrate your existing REST APIs to GraphQL? Or you want to have a GraphQL API next to your existing endpoints that are based on REST, without having to rewrite all your controllers? In this talk I'll show how to wrap existing REST APIs into one single GraphQL endpoint on both the client and server side. This allows you to access the power of GraphQL without having to change any of your existing code or connect to a database.

Thanks to [Roy Derks](https://twitter.com/gethackteam) who presented this talk at [Byteconf GraphQL 2020](https://www.bytesized.xyz/graphql-2020)!

{% youtube xGwsn0kZfLY %}

If you enjoyed the video, give it a thumbs-up, and [subscribe to our channel](https://www.youtube.com/channel/UC046lFvJZhiwSRWsoH8SFjg?sub_confirmation=1) for more web dev content every week. We also have a newsletter where we send out what's new and cool in the web development world, every Tuesday – [join here](https://www.bytesized.xyz/newsletter)!
9 Tips Before Buying A Domain Name
Published: 2020-02-14 16:08:21

Before you purchase a domain name, consider doing some proper investigation. After all, the name of your website is one of the first things that visitors will see. Here are some important tips to keep in mind:

1. Do your research. It’s important to study your niche and to know what the average user wants. Being aware of the most popular keywords and search terms will let you find a domain name that’s best suited to represent your project.

2. Make it catchy and easy to remember. Don’t go for something that is absurdly long or difficult to pronounce. A catchy and short domain name will greatly increase the chances of visitors remembering your website name.

3. Go with .com if possible. Currently, .com is taking a firm stand as the most popular domain name extension. Thus, it’s a good priority when buying a domain name, as most web users will easily recognize it.

4. Check for trademark infringement. To avoid any legal issues, it’s best not to register a domain similar to popular, well-established brands. You can use various online tools to look up trademark information and avoid such situations. 

5. Avoid numbers and hyphens. While numbers and hyphens let you create more domain name variations, they can sometimes do more harm than good. For example, people can mistake the number zero (0) with the letter (o) or the number (2) for a word (two). Hence omitting numbers and hyphens may be a good idea.

6. Look for close alternatives. If you already have a domain name in mind, think of possible mistype variations to make sure all the potential traffic reaches you. A great example would be amzon.com which takes you the main Amazon website, or fb.com which goes directly to Facebook.

7. Research social media platforms. Once you have a rough draft of your domain name, look it up on popular social media platforms like Twitter, YouTube, Instagram or Facebook. Even if you’re not planning to do anything with them at the start, reserving a page for your project will ensure it’s not taken by someone else.

8. Think future-proof. Websites and domains are a long-term investment. Hence revolving the name around the most overhyped thing at this very moment might not be the best approach in the long run. So don’t be afraid to think outside the box! Also, know that all the field is regualted by [ICANN](https://www.icann.org/).

9. Discuss your ideas. If you feel like picking the right name for your website is the hardest choice of your life, perhaps you need some help. Present your ideas to friends, family, colleagues. Who knows, they might give you that golden nugget of advice that you’re looking for.

To learn more, you can check for example this [how to register a domain name](https://www.onlinetoolsexpert.com/how-to-buy-a-domain-name/) guide.