teleren/devto huggingface dataset:
Static Typing or Typescript
Tags: typescript, javascript
Published: 2021-02-14 02:19:28

This is in response to
{% link https://dev.to/jfbrennan/the-reasons-i-don-t-use-typescript-2fhb %} 

I have mixed feelings about Typescript. To quote Indian Jones, "you call that a type, this is a type."

If this is where people get their opinions of static typing, no wonder they think they should live without types.

On the other hand, trying to quantify root cause of an issue is not trivial. Generally people are not tracking these types of things and it is only a "sense" of the situation. I want to summarize some of my experiences with types and talk to an anecdote.

# Experience

Types

* Help with code reuse
* Help with refactoring
* Help guide programmers to correct usage

This first point is really about the next two; you do not need types to make reusable code. If the programmer misuses your library then it isn't very reusable. If you can't make refactoring changes because others might be using it, isn't very reusable. 

Let's consider the simplist refactor, rename. Your IDE will very well replace all the usage in the code and you'll be confident things are still working the same. But you have a development team, they are working off branches, some work has practically died on other branches. How do we make sure that the rename propagates to the code in these branches? 

With a static typed language, this is a build error. An annoying build error, but preventative nevertheless. 

Build failure can occur from attempts to pass objects without the needed properties. And when using a language with compile time execution, these static guarantees can be quite helpful. (plug for D here)

# Anecdote

Recently a bug was introduced into some backend code when types were introduced (yes static typed language can work with untyped data). What happened was the type defined expected data before passing the information on to the next system. The previous implementation would blindly pass the blob on.

The previous implementation worked perfectly, the introduction of types was caught by my extensive introduction tests. Why am I so happy that we introduced this bug?

The two systems had a mismatch in expectations for what was contained in the "fault tolerant" web. The system using the data had built its expectations off the existing production data. The type was built from the new data source which did not contain such fields. Our conversations lead to communicating our concerns to the upstream 3rd party.

As my tests use a mock of the 3rd party, had the type been built from our expectations, we would not have caught this issue as we would not have had influence from the real 3rd party API. That is on me, but it all panned out that a bug introduced by types identified issues upstream.
Desafio #03 - CSS 30 dias
Tags: codepen
Published: 2021-02-14 02:07:57

Este projeto utiliza HTML, CSS e Javascript puro com a biblioteca de animação Anime JS.

https://lnkd.in/dHYy9uf


#AnimeJS #CSS3 #30daysofcss #30diasdeCSS #30dayscss #desafio

{% codepen https://codepen.io/LuizCorrea-dev/pen/OJbWVzR %}
Desafio #02 - CSS 30 dias
Tags: codepen
Published: 2021-02-14 02:05:44

Este projeto de LOADING, utiliza Tipografia fluida e animação de objeto CSS3, media screen e keyframe.

https://lnkd.in/dnmNatE

#Tipografiafluida #CSS3 #30daysofcss #30diasdeCSS #30dayscss #desafio

{% codepen https://codepen.io/LuizCorrea-dev/pen/abBBaxK %}
Cypress - Trocando cy.route() por cy.intecept()
Tags: javascript, testing, cypress
Published: 2021-02-14 01:56:10

A versão 6.0.0 do Cypress trouxe algumas mudanças, uma delas foi a adição de um novo comando o `cy.intecept()` que vem com a função de substituirdos comandos `cy.server()` e `cy.route()`.

### Conhecendo a Sintaxe


{% jsfiddle https://jsfiddle.net/natanlbispo/x7bhku0L/16/ js %}


### Intecept > Route

Como seu nome já diz, o comando consegue interceptar tanto solicitações e respostas de chamadas realizadas pela API, assim como suporte para requisições de busca, carregamentos de página e carregamentos de recursos.

#### routeMatcher  e routeHandler

Com a atualização do Cypress, alem do novo comando, foram adicionados dois argumentos: `routeMatcher` e `routeHandler`. 

Com o uso do `routeMatcher`, se tornou mais fácil pegar as chamadas da API pois é possível adicionar um minimatch ou RegEx em sua sintaxe, auxiliando assim especificar as chamas por dados do cabeçalho.
{% jsfiddle https://jsfiddle.net/natanlbispo/x7bhku0L/28/ js %}
Já o `routeHandler` oferece a opção de alterar os cabeçalhos das chamadas da API, assim como modificar respostas das solicitações.
{% jsfiddle https://jsfiddle.net/natanlbispo/x7bhku0L/38/ js %}

### Atualizações Cypress

O Cypress vem se aprimorando com o objetivo de se tornar uma ferramenta ainda mais completa. Para mais informações sobrea as funcionalidade a [documentação oficial](https://docs.cypress.io/api/commands/intercept.html#Comparison-to-cy-route) é uma boa dica.
How to add taillwindcss to an existing React project
Tags: tailwindcss, react, tutorial
Published: 2021-02-14 01:53:17


# How to add taillwindcss to an existing React project

Go to directory of your React project and use yarn or **npm** to add **[taillwindcss](https://tailwindcss.com/)** **postcss-cli** **autoprefixer**

Using yarn

```bash
yarn add tailwindcss postcss-cli autoprefixer -D
```

Then type this command in the terminal to create the default configuration

```bash
npx tailwind init tailwind.js --full
```

A **taillwind.js** file is created in the current directory

Tailwind CSS is a highly customizable, low-level CSS framework that gives you all the building blocks you need to build bespoke designs without any annoying opinionated styles you have to fight to override

Create a **postcss.config.js** file

```bash
touch postcss.config.js
```

```jsx
const tailwindcss = require('tailwindcss');
module.exports = {
    plugins: [
        tailwindcss('./tailwind.js'),
        require('autoprefixer')
    ],
};
```

PostCSS is a tool for transforming styles with JS plugins. These plugins can lint your CSS, support variables and mixins, transpile future CSS syntax, inline images, and more.

Create an **assets** directory in the **src** folder

```bash
mkdir ./src/assets
```

Create a file called **taillwind.css** in ./src/assets

```bash
touch ./src/assets/tailwind.css
```

Type in tailwind.css:

```css
@import "tailwindcss/base";

@import "tailwindcss/components";

@import "tailwindcss/utilities";
```

Modify the **package.json** file as follows:

```json
"scripts": {
    "start": "yarn watch:css && react-scripts start",
    "build": "yarn build:css && react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "build:css": "postcss src/assets/tailwind.css -o src/assets/main.css",
    "watch:css": "postcss src/assets/tailwind.css -o src/assets/main.css"
  },
```

A file called **main.css** will be generated each time we start the application

Then import the file **./src/assets/main.css** in the **App.js** file (or the root file of the application)

```jsx
import React from "react";
import ReactDOM from "react-dom";
import './assets/main.css';
import App from "./App";
ReactDOM.render(<App />, document.getElementById("root"));
```
Useful Linux Commands — Users and Processes
Tags: productivity, programming, webdev, linux
Published: 2021-02-13 21:24:49

**Check out my books on Amazon at https://www.amazon.com/John-Au-Yeung/e/B08FT5NT62**

**Subscribe to my email list now at http://jauyeung.net/subscribe/**


Linux is an operating system that many developers will use.

Therefore, it’s a good idea to learn some Linux commands.

In this article, we’ll look at some useful Linux commands we should know.

### sudo

We can run a command as another user with the `sudo` command.

It lets us run commands as root.

For instance, we can run:

```
sudo nano /etc/hosts
```

to open the `/etc/hosts` file with `nano` as root.

We can also run `sudo -i` to start a shell as root.

And we can run as another user with the `-u` flag:

```
sudo -u bob ls /users/bob
```

We run `ls` as `bob` .

### su

The `su` command lets us switch the shell to another user.

For instance, we run:

```
su bob
```

to run the shell as `bob` .

When we’re done, we type `exit` to return to our own shell.

### clear

`clear` lets us clear the screen of the terminal.

ctrl+l is a shortcut to clear the screen.

`clear -x` clears the screen but lets us go back to see previous work by scrolling up.

### who

The `who` command lets us display the users logged into the system.

Each shell opened will be listed.

We can see the terminal used and the time and day the session was started.

The `-aH` flags tell `who` to display more info like idle time and process ID of the terminal.

`who am i` liust the current terminal session’s details.

### whoami

The `whoami` command print the current user name.

### which

`which` shows where the command is stored.

For instance, we run `which ls` to see where `ls` is stored.

### type

The `type` command lets us determine the type of command we’re running.

A command can be one of 4 types:

*   an executable
*   a shell built-in program
*   a shell function
*   an alias

### fg

The `fg` common put a job that’s running in the background into the foreground.

We can get the job ID of jobs with the `job` command.

And we can use the job ID as the argument of `fg` .

So we run:

```
fg 2
```

to put job with ID 2 into the foreground.

### bg

`bg` resumes a job that’s been suspended.

We can get the job ID of jobs with the `job` command.

And we can use the job ID as the argument of `fg` .

So we run:

```
fg 2
```

to resume the job with ID 2.

### jobs

`jobs` lets us list the status of the jobs we started.

### alias

The `alias` command lets us create a shortcut to another command.

For instance, we can run:

```
alias ll='ls -al'
```

to create the alias `ll` to run the `ls -al` command.

### killall

The `killall` command lets us send signals to multiple processes currently running.

Then general syntax is:

```
killall <name>
```

where `name` is the name of the program.

### Conclusion

We can run commands to manage jobs and process with various Linux commands.
Comments are like apologies to the next programmer
Tags: programming
Published: 2021-02-26 17:33:12

---
title: Comments are like apologies to the next programmer
published: true
date: 2021-02-14 00:00:00 UTC
tags: programming
canonical_url: https://jhall.io/archive/2021/02/14/comments-are-like-apologies-to-the-next-programmer/
---

> Comments are like apologies to the next programmer.  
> — Unknown

I saw this quote today in an online forum. I love it!

I have long reeled against comments in code. That’s not to say they’re never useful. It’s just that 95% of code comments are worthless, or even worse.

But if this is true, then what are comments apologizing for?

Hard-to-read code.

```
// Determine the shipping rate
var s = 15;
if ( p >= 100 || q >= 5 ) {
    s = 0;
}

```

A little refactoring can avoid the need to apologize with a comment:

```
const shippingPrice = 15;
const freeShippingPrice = 100;
const freeShippingQuantity = 5;

function calculateShipping(price, quantity) {
    if ( price >= freeShippingPrice || quantity >= freeShippingQuantity ) {
        return 0;
    }
    return shippingPrice;
}

```
Azure Functions University - Durable Functions Introduction & Chaining (TypeScript)
Tags: azure, serverless, programming, typescript
Published: 2022-03-16 20:10:11

---
title: Azure Functions University - Durable Functions Introduction & Chaining (TypeScript)
published: true
date: 2021-02-14 00:00:00 UTC
tags: azure, serverless, programming, typescript
canonical_url: https://blog.marcduiker.nl/2021/02/14/azfuncuni-durablefunctions-lesson-typescript.html
series: Azure Functions University
---

![Durable Functions Lesson 1 TypeScript](https://blog.marcduiker.nl/assets/2022/02/25/AzureFunctionsUniversity_DurableFunctions_Lesson2_typescript.png)

Hi serverless friends, we have a new Azure Functions University lesson for you! In this lesson we will learn how to use Durable Functions in Azure Functions written in TypeScript.

<!--more-->
## Lesson

You can find the lesson on GitHub: [Durable Functions - Introduction & Chaining (TypeScript)](https://github.com/marcduiker/azure-functions-university/tree/main/lessons/typescript/durable-functions/chaining/README.md).

And you can watch the video on YouTube:
{% youtube gE130BITP9g %}

The lesson consists of the following exercises:

| Nr | Exercise |
| --- | --- |
| 0 | Prerequisites |
| 1 | Introduction to Azure Durable Functions |
| 2 | Creating a Function App project for a Durable Function |
| 3 | Implementing a “Real-World” Scenario |
| 4 | Retries - Dealing with Temporal Errors |
| 5 | Circuit Breaker - Dealing with Timeouts |
| 6 | Homework |
Why did you decide to study Software Engineering?
Published: 2021-02-13 23:56:59

**During a period in which I was more preoccupied with melodrama and scribbling angsty song lyrics on my binder than paying attention in class**, social media had just established its grip on society and the allure of having a Myspace was undeniable. With its Top 8, music integration, and the enigmatic Tom, Myspace was fresh, addicting, and eventually became my gateway to writing code. I remember spending endless nights alone in my dark room, basking in the luminescence of my computer screen, dabbling in rudimentary HTML/CSS. Dedicated to customizing my profile, I searched hex color codes and how to remove hardcoded URLs for “Customizable Layouts Here.” More than a decade later, Myspace is no longer part of my life, but the impact it left is integral to my decision in studying software engineering. 

As I got older, I pursued other things and graduated with a degree in English/creative writing, but I never forgot about my amateur HMTL/CSS days. They always remained a fond memory. After graduating I drifted from job to job, never fully committed and unsure of my place within the working world. 

**Fast forward to now**: With the pandemic, I’ve had a lot of time to think - about what I was interested in, what my skills catered to, and where I wanted to be. I squandered a lot of that time feeling lost, but then I remembered my old Myspace days, where I tinkered with code to customize my profile to be the best representation of my teenage self. Nostalgia. 

Finally, it all made sense. With a background in creative writing, I love to write and create/build things, watching it develop and grow. In addition, I’m already familiar with language and syntax, and what is code but another language. As someone creative, learning how to code would be another way to channel and develop my creativity. Lastly, to be entirely honest, software engineering is both viable and lucrative. In these weird, uncertain times, security has become a priory of mine, something I need to feel comfortable. 

However, fear and trepidation held me back. Even today, tech is still homogenous/not very diversified. Furthermore, without a technical background, what would I truly have to offer? But it’s a new year, which also means a new me and a new state of mind I’ve recently adopted is - Just do it, (like Nike). So why study software engineering? *Why not.*
Why blogging is a great way to start a career in software development.
Tags: career, software, ui, student
Published: 2021-02-13 23:41:09

I was recently informed that starting a blog is a great way to start a software development career. With graduation a mere two months away, I am on the hunt for ways to help me stand out from the sea of graduates.

It’s no secret that everyone has attempted to become a blogger at some point or another, many with little success. Many blogs lack success because they lack purpose. Within the career sphere, blogs are a great way to show off the skills and knowledge you’ve learned over the years. Posting regularly shows that you keep up today on new trends and are continuing to learn and explore.
Although blogs aren’t for everyone, there are many other ways to accomplish the same thing. Creating and posting content on other social media platforms like LinkedIn or even your website regularly is just as important as posting on a blog.

In summary, companies what to see your commitment, understanding, and knowledge of technology and the field you are attempting to work in.
Git and GitHub For Newbies.
Tags: codenewbie, github, webdev
Published: 2021-02-13 23:21:55

<em>I'm sure you've come across the terms Git and GitHub and wondered what they are and how they tie into your budding programming journey. Fear not I am here to help. At the end of this post, I'll leave links to two great videos to help you learn how to use Git and GitHub</em>

<h1>What is Git</h1>
Before we define what Git is, I need you to know something. Git and GitHub are not the same things.
Git is a version control system for tracking changes in any set of files. So what is this version control I'm talking about? Well, Version control, is the practice of tracking and managing changes to files, code, etc. There are other version control systems out there like for example, Apache Subversion and Mercurial. So why are we focusing on Git? Well, Git is the most popular and the most used system in the tech industry right now. Let's talk about some common terms you'll see associated with Git and what they mean in regular English. 

1) Repository: Think of this as central storage where everyone goes to store their code. This central storage also helps maintain the file history.
 
2) Trunk: Think of this as the main folder in the repository where developers add all their code to.

3) commit:  Think of this as a process of storing changes from working copy (code you worked on in your computer) to the repository.

4) Branches: Think of this as creating a clone of the Trunk or some other folder. 

5) Checkout: This command lets you move between the various branches you created. 

Though there are a lot of commands/terms these will give you a basic understanding when learning Git.

<h1>What is GitHub</h1>
 GitHub is a provider of Internet hosting for software development and version control using Git.
Think of GitHub as a giant server that lets you keep and keep track of your repositories and branches. GitHub lets you do things like report issues you find concerning an application, it could even serve as a portfolio for you as a web developer. You can use it to host your portfolio online for free and without much of the hassles that usually come with deploying. GitHub has way too many features to go through in this one post. I just wanted to give you a basic idea of what it was and some of its features.

<h1>Learn the basics of Git/GitHub Here</h1> 
The links provided below are from an amazing developer, Youtuber, and Teacher called Colt Steele.

P.S: These videos were made in 2019 so I would want you to know one simple change that has occurred. In the GitHub video, the term <em>"master"</em> is used. GitHub no longer uses <em>"master"</em> but instead uses the word <em>"main"</em>. So anywhere you see "master" just type in "main". Learn Git before GitHub. 

Learn <a href="https://youtu.be/USjZcfj8yxE">Git</a>
Learn <a href="https://youtu.be/nhNq2kIvi9s">GitHub</a>
Write good PHP - string management
Tags: programming, webdev, php
Published: 2021-02-13 23:09:29

Working with strings is common in any language, but it's very easy to make it harder than it needs to be! 

In PHP, it's very easy to work with strings, but it can be easier. 

Let's dissect the below example of a common, but poor usage of strings in PHP:

```php
$firstname = 'John';
$lastname = 'Doe';
$name = 'The user ' . $firstname . ' ' . $lastname . ' joined in ' . date('d/m/y') . '. Their birthday is ' . 32 - date('Y');
```

This will output exactly what you expect, but wooow, that's ugly, isn't it? Inline calculations, multiple sets of concatenation, and it's longer than it needs to be.

Let's see a refactor and explain it:
```php
$first_name = 'John';
$last_name = 'Doe';
$full_name = "{$first_name} {$last_name}";
$join_date = date('d/m/y'); 
$birthday = 32 - date('Y'); 
$name = "The user {$full_name} joined in {$join_date}. Their birthday is {$birthday}";
```

We see more code, but it is much more readable, right? 

What have we done here?
- We've broken the dynamic values down to assigned variables outside of the string.
- We've used interpolation to avoid concatenation. Interpolation means we can avoid the dot concat syntax, and awkward strings and spaces - making the string much much easier to manage.
- Reduced the length of the string as a result of interpolation


Thanks to the above points, our refactor is much easier to read, and a lot easier to understand and edit. 


We have introduced more code, but generally, **readability should come before length**. For beginners, it can be easy to fall into the trap of wanting to write really complicated code, in as few lines as possible - while cool, and very fun, it can easily get out of hand! 


This has been a simple example of string management in PHP, I hope you enjoyed!

In the next part of this series, I'll cover writing logical structures with the happy path.
Nagios Plugins for Linux v28
Tags: nagios, plugins, monitoring, linux
Published: 2021-02-13 23:06:10

A set of Ansi-C opensource [Nagios](http://www.nagios.org/) plugins for monitoring Linux boxes:
 * check_clock
 * check_cpu
 * check_cpufreq
 * check_cswch
 * check_docker
 * check_fc
 * check_ifmountfs
 * check_intr
 * check_iowait
 * check_load
 * check_memory
 * check_multipath
 * check_nbprocs
 * check_network
 * check_paging
 * check_pressure
 * check_podman
 * check_readonlyfs
 * check_swap
 * check_tcpcount
 * check_temperature
 * check_uptime
 * check_users

These plugins have been reported to also work with [Icinga](https://www.icinga.org/) and [Icinga2](https://www.icinga.org/icinga/icinga-2/).

Project home page at [GitHub](https://github.com/madrisan/nagios-plugins-linux).

The full documentation is available online in the GitHub [wiki page](https://github.com/madrisan/nagios-plugins-linux/wiki).