teleren/devto huggingface dataset:
MINHA ROTINA COMO DEV ENGINEER
Published: 2021-09-02 17:58:36

# My Routine As DevEngineer :mortar_board:

> In this repository I register my collections of technological platform for study, which in my day-to-day, have a lot to do with my skills, and which I try to improve.<br>

:warning: The list below does not have an order of preference, I only mention which platforms I follow in my professional and personal development.

>> ## First, I start my scheduling script.

- Personal Sketchbook
- [Starting my setup - Ubuntu](https://ubuntu.com/)
- [Sublime](https://www.sublimetext.com/)
- [OneNote](https://www.microsoft.com/en-us/microsoft-365/onenote/digital-note-taking-app)
- [Notion](https://www.notion.so/)
- [Reminders-Apple](https://support.apple.com/en-us/HT205890)
- [Calendar-Google](https://www.google.com/calendar/)

>> ## Second, focus on my specific skills.

- [Balta](https://balta.io/)
- [Desenvolvedor.io](https://developer.io/)
- [Docs.Microsoft](https://docs.microsoft.com/en-us/dotnet/csharp/)
- [DotNet-Tutorials](https://csharp.net-tutorials.com/)
- [Gago.io](https://gago.io/)
- [LearnDapper](https://www.learndapper.com/)
- [Luis Dev](https://www.luisdev.com.br/)
- [Macoratti](http://www.macoratti.net/Default.aspx)
- [Sharpcorner](https://www.c-sharpcorner.com/)

>> ## Thirdly, I seek to add to my specialties.

- [Alura](https://www.alura.com.br/)
- [Cod3r](https://www.cod3r.com.br/)
- [DataScienceAcademy](https://www.datascienceacademy.com.br/)
- [DigitaL Innovation One](https://digitalinnovation.one/)
- [Microsoft Docs](https://docs.microsoft.com/pt-pt/)
- [Freecodecamp Forum](https://forum.freecodecamp.org/)
- [Linkedin Learning](https://www.linkedin.com/learning/)
- [PluralSight](https://www.pluralsight.com/)
- [Rocketseat](https://rocketseat.com.br/)
- [School Of Net](https://www.schoolofnet.com/)
- [Softblue](https://www.softblue.com.br/#pop-up-java-lego)
- [Udemy](https://www.udemy.com/)

>> ## And last, not least, after starting my day at work.

- [Sound That Feeds - You Tube](https://www.youtube.com/watch?v=ful0qGqtSgQ)
- [Cafe Music BGM channel - You Tube](https://www.youtube.com/c/cafemusicbgmchannel)
- [Blues & Jazz - You Tube](https://www.youtube.com/watch?v=5vub-_NWj2o)
- [The Global Voice - You Tube](https://www.youtube.com/channel/UCJYtYkiGldqX6Ne938j-k2g)
Express Validator - Do simple if checks to decide what to validate
Tags: node, validation
Published: 2021-09-02 17:47:30

**TLDR:** Use a custom validator and extract the core validation rules direct from validator.js

I personally really dislike Express Validator, and have moved onto use alternatives like Joi and Yup. However, often you inherit code that you have to maintain. 

Express Validator doesnt make it very clear how to  do anything complex. All I wanted to do was check a postcode was valid if a flag was set. E,g,
```
    {
    	"specialFlag": false,
    	"postcode": "AB1 1AA"
    }
```

If special flag was true, we didn't need to check the postcode was a valid one - if it was false, we needed to check. Sounds simple? 

The solution is to write a custom validator that you embed as a middleware like this: e.g.
```
    app.post(
	    [
		    body.custom(custValFunc),
	    ],
	    async (req, res....
    )
```

The custom validator just needed to look like this: 
```
    const custValFunc: CustomValidator = (input: bodyVar): boolean => {
	    if (!input.specialFlag) {
		    #check if postcode was valid here 
		    throw new Error('Postcode isnt valid, but specialFlag isnt set');
	    }
	    return true;
    }
```

Seemed easy enough - however I didn't want to write my own validator for post codes, because express validator ships with its own as a middleware - but we cant use those middlewares in the custom validator function! Heres where the pain was - it took me ages to work out how to expose the underlying function.

Turns out express validator just uses validator.js - which will already be installed as a dependancy. We can use the isPostalCode function independantly. So the following code works: 
```
    import { isPostalCode } from 'validator';
    
    const custValFunc: CustomValidator = (input: bodyVar): boolean => {
        if (!input.specialFlag) {
        
    	    if (isPostalCode(input.postcode, 'GB') === false) {  
	    	    throw new Error('Postcode isnt valid, but specialFlag isnt set');
	    	}
        }
        return true;
    }
```

This solution works, because if specialFlag is infact set, we skip the post code validation. However if it isn't set - we validate again the proper checks, and can throw a nice error. 

You should be able to add your own complex checks and validation rules a bit easier than trying to use the inbuilt express validator functions that don't seem to work in the way you would expect.
Do you love programming?
Tags: discuss, healthydebate
Published: 2021-09-02 17:47:25

---
title: Do you love programming?
published: true
description: I just want to ask you personally, do you love programming? Or is it more of just a job. 
tags: discuss, healthydebate
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/orneui1sf602k2orxu1w.jpeg
---
*cover image by Chrys Omori [CC BY 2.0](https://creativecommons.org/licenses/by/2.0)*


I've talked before about [how passion shouldn't be a job requirement](https://dev.to/run-x/why-do-companies-ask-for-passion-46dp). Now I just want to ask you personally, do you love programming? Or is it more of just a job?

I love programming on my own projects. My toys, my own interesting things, that's super fun.

I don't particularly care for programming when it's pumping out features as part of a corporate shop. 

What about you?
MoSCoW: The Best Code Review Technique You're Not Using
Tags: career, codereview, webdev, javascript
Published: 2021-09-02 17:28:51

We've all been there. You've got comments on your code from a reviewer and it feels like you might as well rewrite everything from scratch. It's demoralising and feels like a waste of time, especially since you know it works and fulfils the requirements of the task. 

Situations like this can lead to you cherry picking your reviewers, having endless back and forths about a `forEach` vs a `for`, and generally feeling a bit fed up with the whole process.

Well, let me introduce you to a system that lets the reviewer express their thoughts in a manner that indicates exactly how important each comment is and how much attention you need to pay to it. 

MoSCoW, taken from the world of project management is the name given to a list of requirements laid out as:

- Musts
- Shoulds
- Coulds
- Woulds

I won't dwell on what they mean exactly in the world they originate from because it's not relevant and the system is so self explanatory you've probably already worked out where I'm going.

## M/S/C/W

Each comment should begin with `M:`, `S:`, `C` or `W:` and then the comment. 

- **Must**: this has to be changed to be approved. These are errors that either go against the coding standards of the team or are clearly just incorrect and will lead to a bug. These can't be ignored.
- **Should**: these are things that would be an obvious and clear improvement. You have to give a reason to ignore this and the code reviewer has to agree. A third party can be brought in if needs be.
- **Could**: these are for niceties that the reviewer thinks would improve the codebase in some way but are probably going above and beyond what the task requires. If they have an idea for a slightly better function name or they want to leave a comment but aren't all that bothered if you take the advice then this is the prefix to use. These can be ignored without a reason given.
- **Would**: these are reserved for the "I wouldn't have done it this way" comments that require lots of rework but are 100% personal preference. These rarely get used because a would is really just the reviewer being given space to express their thoughts. An ideal usage of this is to educate a junior member of the team and perhaps follow up with a conversation around it post review.

In the example above about a for loop I would say:

`S: Use forEach here to avoid off by one errors and aid understanding of loop conditions`

or similar.

## Summary

Introduce this at your next team meeting, get a clear understanding of your musts and a rough idea of some shoulds and you will see how liberating this is for everyone involved in the code review process.

Want more like this? Sign up to my mailing list at [Career Switch To Coding](https://careerswitchtocoding.com/) and get a free chapter from my book.
How to show alert box javascript?
Tags: javascript, html, wordpress
Published: 2021-09-02 17:16:54

Hi guys, Today we will see how to show alert box using javascript.

To show alert box, we use javascript default function "alert()".

```javascript
<script>
var msg = "Hey, you are a developer!";
alert(msg);
</script>
```
In this way, we can show alert box using javascript.

Thanks for taking your valuable time for reading my post, if you have any queries , please leave a comment and will respond. If you find this post useful, please share it. 

Read: <a href="https://wordpress.org/plugins/increase-upload-limit/" target="_blank">How to Increase upload limit upto 1000GB in Wordpress using Increase Upload Limit Plugin for LIFETIME Free of Cost?</a>

Social Profile : <a href="https://www.linkedin.com/in/pavan-kumar-sadhu-47693818b/">LinkedIn</a>

Have a Nice Day!
Controlled Components
Published: 2021-09-02 17:16:24

A controlled component is a component that renders form elements and controls them by keeping the form data in the component's state.

A controlled form is a form that gets its input values from the state. 

Let's take a look at what that looks like:

First, we need to create a component that has an initial state. In this case, I use an empty string as my initial colorInput state:
![component state](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/71s0fzqmpr8nb407pkdz.png)

Then, we  render the form to the page to make sure that everything is connected properly (don't forget to import it to your main container and add to to the render lifecycle) :
![render](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1j7udcr1p09vdghiamtv.png)

Next, we need to handle the change of state, so we will implement a handleColorInput function for our in-line onChange event, and tell the style to change the color of the text from the state:

So here is the whole code:
![whole code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/51n66xe9hbpshjst09pr.png)

and this is what that code returns:
![input form](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gcsgxj0nhvo7cmwr7c6r.png) ![input form](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fel6gjkez2lo4fd1njdh.png) ![input form](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ldzhyybooxvuxhvzpja3.png) ![input form](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5sdqc6j72bg7s2tijg35.png)
What advise will I give to someone in his  twenties
Tags: productivity, career, planning, development
Published: 2021-09-02 17:12:38

 1. Start a side hustle- a blog, a podcast, a youtube channel or anything else. You would learn so much about business, marketing, customer psychology, content creation that no class can teach you. Get your hands dirty with action. And who knows, you might even be able to make some money (though don’t focus on the money part, this is about learning).
2. Social media is made addictive to extract the most time out of you. Do you think Mark Zuckerberg’s children scroll Facebook all day? Spoiler alert- THEY DON’T (Google it). When you scroll social media, content creators get paid, advertisers get paid, smartphone companies get paid, your internet provider gets paid, and the social media company gets paid. Everyone gets paid EXCEPT you. Keep this mind and don’t waste time on social media.
3. Develop new skills for the internet age. College won’t teach you much. Learn coding, graphic design, writing, finance, communication, and other skills to get prepared for placements. Your college will just hand you a piece of paper (degree) at the end and it won’t mean sh*t.
4. Don’t play it safe. If you wanna be a DJ, a wedding planner, a yoga instructor- GO FOR IT! If you succeed, great! If don’t, you would rest easy knowing you tried. Regret is poison and it will eat you inside for life.
5. Play outside sports. It will keep you happy and young!
6. Reading is the best stress reliever. Even better than music (science says!).
7. Cultivate friendships. Don’t be too arrogant to stay in touch with your school friends. They are probably the last bunch of true friends you will ever have in life.
8. Authenticity is cool. Originality is cool. Being yourself is cool. If you act cool to make friends or impress people, you will attract the wrong crowd which will backfire later in life.
9. Confidence is loving yourself and accepting your shortcomings. Know about your weaknesses, joke about them, and then work on improving them secretly.
10. Have a lot of hobbies. Even if you spend time watching Netflix, watch different types and genres of content. If you like reading, read different genres. This will improve your ability to think broadly and give you a unique perspective.
11. Masturbation and Porn will kill your energy and drive. Stop doing it immediately. Instead, use that extra energy and go for a run or exercise in the gym. Your 30s will thank you for it.
12. Plan your day/week in advance. This will help you mindfully spend every hour of every day and you will procrastinate a lot less.
13.  Lastly, most “grown ups” are simply kids with bad attitude. Most don’t know what they are doing. Don’t get intimidated by their “experience”.

If you like my work, please consider
[![Buy me a coffee](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jm11knj7d8zwcvo150q2.png)](https://www.buymeacoffee.com/cglikpo)
so that I can bring more projects, more articles for you

If you want to learn more about Web Development, feel free to [follow me on Youtube!](https://www.youtube.com/c/ChristopherGlikpo)
Guide to creating an effective Test Automation Strategy
Tags: testing, beginners, tutorial
Published: 2021-09-02 17:05:21

Test Automation is increasingly being introduced to companies to solve issues and reduce the time to market for products. However, for test automation efforts to not be ad hoc and to get the return on investment that test automation brings, the team should work together to create a Test Automation Strategy.

A test automation strategy defines the tools and frameworks used to get reusable, automated scripts, as well as how to create those scripts and maintain them. It is most effective when it is understood by your entire team as they are going to be the ones to implement it. Test automation can provide valuable returns on investment, such as faster time to market, more reliable, faster tests. However, it takes a lot of time and effort and you don't want to dive into writing automated scripts without first having a test automation strategy.

Your strategy should define how you're going to go about doing automation, who is going to be writing it, when are you going to be running it and what environments you're going to use. It fully defines the what, why, when, how and where of your test automation initiative. Let’s break down the what, why, when, how and where that will be in your test automation strategy.

Read full article here: https://juliapottinger.com/guide-to-creating-an-effective-test-automation-strategy/

Or watch the video tutorial
{% youtube 9b_I_k09t9c %}
Sprinkle Sharing
Published: 2021-09-12 11:11:41

---
title: Sprinkle Sharing
published: yes
date: 2021-09-02 16:41:00 UTC
tags: 
canonical_url: https://denizaksimsek.com/2021/sprinkle-sharing/
---

<aside>
<p><em>This post is directly from my notes, with no edits.</em></p>
</aside>

When people talk about code sharing between server and client, the usual suspects are Node.js and sharing model classes. However, there’s often good reason to duplicate these.

A far more interesting type of code sharing to me is eliminating this duplication:

When you are writing a server-driven web app with “sprinkles” of JS, you want to have interactive components, but also deliver usable HTML to non-JS-enabled <sup><a href="https://denizaksimsek.com/2021/sprinkle-sharing/#fn1" id="fnref1">[1]</a></sup> clients. This means you are essentially writing a component with the first render and subsequent updates are written in different languages – HTML then JS. How to make this nicer? (Existing answers follow)

## Alpine and similar

Write both in one language: “HTML with JS inline in special attributes”.

## React and similar

Write both in one language: “JS optionally with JSX”. Hard to set up sprinkle style, but wasn’t this how it was originally created to be used?

* * *
<section>
<ol>
<li id="fn1">
<p>“Non-JS-enabled” includes not only browsers where the user turned off JS, but also times when the JS didn’t load, or errored due to use of unsupported modern features. <a href="https://denizaksimsek.com/2021/sprinkle-sharing/#fnref1">↩︎</a></p>
</li>
</ol>
</section>
Laravel Boilerplate for SaaS Application 
Tags: laravel, saas, vue, opensource
Published: 2021-09-02 16:31:43

I have search for open source SaaS Application boilerplate for developer and found two interesting Open source project which will save your lots of time.


1. https://craterapp.com/
Complete Invoicing Solution
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cyo7q29z8mayzx6byu1n.png)

Crater is an open-source web & mobile app that helps you track expenses, payments & create professional invoices & estimates.

Web Application is made using Laravel & VueJS while the Mobile Apps are built using React Native.

Crater Provides Mobile application as well. 



2. https://devdojo.com/wave
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i6tiwy49jugi2nls08xe.png)

Wave is the ultimate Software as a Service Starter Kit packed with awesome features like authentication, subscriptions, invoices, announcements, user profiles, and so much more!
Golang: derive fingerprint from ssl cert file
Tags: go, ssl
Published: 2021-09-02 16:16:10

## Problem

You want to get your website SSL (pem format) certificate's fingerprint with Golang

## Solution

If you want to generate the `sha1` fingerprint for your pem file (for example, `fullchain.cer`), with command line, you can do something like this:
```bash
$ openssl x509 -noout -fingerprint -sha1 -inform pem -in fullchain.cer
```

If you want to do the same in Golang, Go already has these built-in libraries you can use:

```go
package main

import (
	"bytes"
	"crypto/sha1"
	"crypto/x509"
	"encoding/pem"
	"fmt"
	"io/ioutil"
)

func main() {
	// read file content
	pemContent, err := ioutil.ReadFile("./fullchain.cer")
	if err != nil {
		panic(err)
	}

	block, _ := pem.Decode(pemContent)
	if block == nil {
		panic("Failed to parse pem file")
	}

	// pass cert bytes
	cert, err := x509.ParseCertificate(block.Bytes)
	if err != nil {
		panic(err)
	}

	// generate fingerprint with sha1
	// you can also use md5, sha256, etc.
	fingerprint := sha1.Sum(cert.Raw)

	var buf bytes.Buffer
	for i, f := range fingerprint {
		if i > 0 {
			fmt.Fprintf(&buf, ":")
		}
		fmt.Fprintf(&buf, "%02X", f)
	}
	fmt.Printf("Fingerprint: %s\n", buf.String())
}
```


## Reference
* https://golang.org/src/crypto/x509/example_test.go
* https://blog.abhi.host/blog/2020/02/01/Get-certificate-fingerprint-in-golang/
What is the logical operators in PHP.
Tags: php, tutorial, beginners
Published: 2021-09-02 16:15:06


We can evaluate and combine multiple comparisons with logical operators. For example, we make a comparison of whether a variable is greater than 0 or less than 100 thanks to logical operators.

Let's show the logical operators in a table:

| Operator |   Name   | Usage    | Explanation                                                                                                     |
|:--------:|:--------:|----------|-----------------------------------------------------------------------------------------------------------------|
|     !    | Negative | !$a      |                      Returns true if the value of $a is negative, or the other way around.                      |
|    &&    |    And   | $a && $b |       If the value of $a and $b is positive, TRUE returns positive, if either is negative, returns FALSE.       |
|    &#124;&#124;    |    Or    | $a &#124;&#124; $b | Returns positive if the value of $a or the value of $b is positive. It is enough that one or both are positive. |

In an example of these, we said at the beginning; Let's compare the value of a variable "if it is greater than 0 and less than 100". The condition we apply for this is as follows: `$a > 0 && $a < 100` This means if the variable `$a` is greater than 0 and less than 100. If the number in `$a` is between 0 and 100, the result of this condition will be positive.

Follow my blog for more [baransel.dev](https://baransel.dev/).
Closest thing to structs / dataclasses / records in typescript with default values
Tags: typescript, tutorial
Published: 2021-09-02 15:48:41

(You may have also googled for

- react typescript default props,
- typescript default values for interface, or
- typescript default destructured args.)

Data-only classes are easy to understand; you can add 'methods' (functions taking them) to them when you import them; there is no worries of using `this` wrong and it's usually easier to figure out if they are modified (partly because you can make a function argument `const` a bit more easily than with `this`); you know that they have a fixed set of attributes; methods and data are easily distinguishable. There's a reason structs fundamental in golang and something like structs has been added or always existed in python, swift, scala, etc.

So how do we do it in typescript? One mediocre option is to use regular classes and restrain yourself to avoid methods. I won't go into detail on that or other mediocre options that require repeating yourself three times. Below is a pretty good option, and now my go-to for structs in typescript.

**Use a function to make your struct and Required<> for the exported type.**

```typescript
interface PartialCar {
    model: string
    owner: [string, string]
    year?: number
    make?: string
    staysNull?: string | null
}
export type Car = Required<PartialCar>
export function newCar(args: PartialCar): Car {
    return {
        year: 1999,
        make: "toyota",
        staysNull: null,
        ...args,
    }
}
export function print(c: Car): void {
    console.log(`${c.owner}'s gorgeous ${c.year} ${c.model} from ${c.make}`)
}
function example(a: number, b: number, c: Car): number {
    const c = newCar(pc)
    return a + b + c.year
}
function caller() {
    return example(5, 10, newCar({ model: 'ford', owner: ['bob', 'bill'] }))
}
```

Ezpz. This also shows you how to do default/optional destructured parameters with thorough type hinting.

**Edit:** I realized a react example might be useful:

```tsx
unction Car(props: {
    model: string
    owner: [string, string]
    year?: number
    make?: string
}): JSX.Element {
    const P = {
        year: 1999,
        make: "toyota",
        ...props
    }
    const length = P.make.length // passes strict null checks!
    return <div>
        {P.owner[0]} {P.owner[1]}{"'s"} {P.make} {P.model} goes vroom with {length} letters.
    </div>
}```

Using this in the codebase of splashcall rn.