teleren/devto huggingface dataset:
Closure in JS and why you should bother.
Tags: javascript, webdev
Published: 2021-07-15 21:08:41

## Overview
If you're in middle of learning JavaScript or you already completed various online tutorials, you may have came across closures and did not bother much after learning about it. Interestingly you can easily find tons of blogs on this platform explaining closures in depth, but why you should bother reading them? This blog attempts to answer that.
This blog is an attempt to make you curious and give you a feel why closures are considered one of the pillars in JavaScript.

## How tutorials do it?
If you're watching one of the tutorials or you've enrolled in a boot camp that briefs JavaScript, they might have touched the concept of closure and there's a high chance you've came across a code like this.

```js
const string = "hello closure";
function print() {
  console.log(string);
}
```
Which outputs:
```
hello closure
```
And a lazy conclusion comes out of this example is that the function insides can get the variable from its parent scope and marking the end of story for closures.

## Does it really end there?
This part of the blog is a bit sloppy, so bear with me a little.
I don't remember the itihās (history of events) and what was I doing, I wanted to create a function that only ran once no matter how many times you call it but I didn't want it to use a global variable that keeps tracks of the execution count. So I came up with a higher order function, it looked like this:

```js
function closure() {
  let counter = 0;
  function onlyExecutesOnce() {
    if(counter == 1) {
      return;
    }
    counter += 1;
    console.log(counter);
  }

  return onlyExecutesOnce;
}


/* testing the function */
const myFunction = closure();
myFunction();
myFunction();
myFunction();
```
Output:
```
1
```
At first glance I didn't not bother much and to my eyes it looked plain and simple.

## So What's the Conclusion?
So, after thinking about my code a question dropped in my mind.
**Why is it that `myFunction()` is sharing the same surrounding environment as `onlyExecutesOnce()`?**
This question puzzled me as I wasn't able to get to a straight forward explanation for this behavior. After reading about it I came to know that whenever you pass a function definition it also takes its surrounding information with it.
And that's what closures are, the function is not only getting the variables from its surrounding it is also ***attaching itself*** with the information from its surrounding of where it was declared. In this case `onlyExecutesOnce()` is also attached with information of its surrounding which is being passed to `myFunction()`.
So closures, my fellow readers opens a lots of doors for doing crazy and cool stuff in JavaScript.
Jasmine Marbles now supports RxJS 6/7 with jest-circus
Tags: angular, ngrx, rxjs, testing
Published: 2021-07-15 21:08:35

Photo by <a href="https://unsplash.com/@sharonmccutcheon?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Sharon McCutcheon</a> on <a href="https://unsplash.com/s/photos/marbles?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
  
Jasmine marbles is a set of RxJS marble testing helpers for writing tests with [Jasmine](https://jasmine.github.io/) or [Jest](https://jestjs.io/).

Jest version 27 was recently released, which introduces a completely new [default test runner](https://jestjs.io/blog/2021/05/25/jest-27#flipping-defaults) named `jest-circus`. The previous `jest-jasmine2` test runner contained many jasmine-specific APIs that are not in jest-circus.

With the release of version jasmine-marbles `0.8.3`, both test runners are supported with RxJS 6.x. RxJS 7.x is supported in versions `0.9.0` and later, but the majority of users are on RxJS 6.x, which is what the latest major releases of [Angular](https://angular.io), [Nx](https://nx.dev), [NgRx](https://ngrx.io), and many other libraries use.

To install the latest version:

```sh
npm install jasmine-marbles@latest --save-dev
```

or 

```sh
yarn install jasmine-marbles@latest --dev
```

If you need to revert back to the previous test runner, set the `testRunner` in your `jest.config.js` to `jest-jasmine2`.

To learn more about testing RxJS using marble diagrams in general, check out the [marble testing](https://rxjs.dev/guide/testing/marble-testing) guide in the RxJS docs.

If you've found jasmine-marbles useful :heart:, please consider [sponsoring me](https://github.com/sponsors/brandonroberts) on GitHub as a monthly or one-time sponsor. 

You can also follow me on [Twitter](https://twitter.com/brandontroberts), subscribe on [YouTube](https://youtube.com/brandonrobertsdev?sub_confirmation=1), and join me for live streams on [Twitch](https://twitch.tv/brandontroberts).
[Tutorial] Como criar um Formulário no Google Docs - parte 2
Tags: tutorial, braziliandevs
Published: 2021-07-15 20:43:52

👉🏽 Esse é um artigo tutorial desenvolvido para guiar as pessoas que tenham interesse de utilizar algumas das ferramentas do suíte de aplicativos Google, em especial o uso do form/formulário Google. 

Nesse artigo iremos aprender como fazer a avaliação por meio do Google formulário. Assim, para iniciar, precisamos logar em uma conta do gmail, siga as instruções do [primeiro artigo](https://dev.to/pamellabiotec/tutorial-como-criar-um-formulario-no-google-docs-parte-1-2lgf). 

Em seguida, vamos na parte superior clicar na engrenagem, menu Configurações, depois acessar a guia **Teste**. 

![Configurações](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/09blcpka9f2e3cq15gly.png)
Menu Configurações

Na sequência, aciona **criar teste**. Segue definindo as **opções de teste**: 

* Liberação da nota; Imediatamente após o envio; ou, posteriormente, depois da revisão manual;

* As pessoas que responderem podem ver:  Perguntas erradas; respostas corretas; valores.

![Teste](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wlhezawxgbpmbsrz8ocz.png)
Guia Teste

Por fim, clicar em salvar.

Agora, teremos mais opções quando criar alguma pergunta. Na parte inferior, teremos o campo **resposta correta**. 

![Resposta correta](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fczg71t5mioi7p9boru8.png)
Botão de Resposta Correta

Ao acionar esse campo, poderemos definir o valor em pontos. É importante destacar, que esse valor é número inteiro, ou seja, não aceita decimal. 

Na sequência podemos adicionar feedback para resposta correta e uma para resposta errada. Em seguida, clica em concluir para salvar as alterações.

Outro recurso também interessante é acionado no menu configurações, na guia apresentação, teremos um campo para deixar uma mensagem de confirmação que será exibida ao participante quando enviar o formulário.

![Mensagem de confirmação](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1bfrc7xdeabwwh4569pl.png)
Mensagem de confirmação

Outro detalhe importante, é saber permitir ou recursar as respostas. ao acessa a guia resposta na parte superior do formulário, veremos o botão **Não está aceitando respostas**. Ainda podemos deixar uma mensagem aos participantes.

![Mensagem aos participantes](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nw1yqer84yjw3vz0a34n.png)
Permissão de recebimento de resposta

## Recurso extra

Adiciona vídeo, na barra lateral à direita, tem opção adiciona vídeo do youtube como pode ser vista nessa imagem abaixo:

![Youtube](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2rmnyymtthdhvleybdpm.png)
Adição de vídeo do youtube

## Considerações Finais

Podemos ver nesse breve tutorial como criar um teste utilizando o Google Formulário.


## Referências
 1.https://pt.wikipedia.org/wiki/Google_Docs

2.https://pt.wikibooks.org/wiki/Constru%C3%A7%C3%A3o_coletiva/Criando_e_Compartilhando_um_formul%C3%A1rio_no_Google_Docs
🔐 The Working Principles of #2FA (2-Factor Authentication) Hardware
Tags: authentication, security
Published: 2021-07-15 20:39:44

#### 📜 Why hardware-based Two-Factor #Authentication makes the user much more #secure over other multi-factor alternatives.

### <br>
When I wrote about how software 2FA is a step-up from SMS 2FA, I also mentioned how there’s one attack vector that software 2FA is still vulnerable to phishing. It’s the **user** who must verify they are entering the passcode into the legitimate website, and bad actors exploit that.

Phishing is a hard problem to solve because the bad actor exploits human behavior that has been ingrained in all of us for the last couple hundred thousand years and will probably continue to be for a long time in the future.

Everybody is prone to fall for phishing campaigns, even security-conscious people, because these attacks are never head-on, explicit attacks, but sneaky ones and when you aren’t expecting them.

And if we look at types of attacks over the years, there is a clear trend: the number of websites containing malware has been declining, while the number of phishing websites skyrocketed in the last few years. You can see that in the chart below:

![01_bleeping_computer](https://images.ctfassets.net/23aumh6u8s0i/5Z7X9Z3Dm07lEvbjtubPO1/6c57ba7fc4b4458c6a995463e6a39ee6/01_bleeping_computer.jpg)
<p align="center">Source: <a href="https://www.bleepingcomputer.com/news/security/google-chrome-uses-safe-browsing-to-improve-phishing-protection/">Bleeping Computer</a> via <a href="https://transparencyreport.google.com/safe-browsing/overview">Google Transparency Report</a> (archive)</p>

<p align="left"></p>
Attackers are becoming more **proactive** and trying to **force errors**. With more devices connected to the Internet, these attacks become more profitable (we’ve seen a [surge during the last few years](https://www.f5.com/company/news/features/phishing-attacks-soar-220--during-covid-19-peak-as-cybercriminal)), and now more companies are starting to pay attention to phishing attacks.

Taking the human element out of security is not an easy task, but that is what Universal 2nd Factor, or U2F, tries to do — it’s an open protocol for second-factor hardware keys that doesn’t rely on the user to make sure he’s on the right website; there is a built-in mechanism on the key itself to verify that.


[Read more...](https://auth0.com/blog/the-working-principles-of-2fa-2-factor-authentication-hardware/?utm_source=content_synd&utm_medium=sc&utm_campaign=authentication)
Root out the odd operation with Operations Breakdown
Tags: monitoring, performance, devops
Published: 2021-07-15 20:28:47

Transactions are sent when your service receives a request and sends a response, like an API call or a page load. Within each transaction is a series of operations. We built [Operations Breakdown](https://docs.sentry.io/product/sentry-basics/tracing/event-detail/#operations-breakdown) to help you, the developer, quickly see how much time was spent in each operation within a transaction. Why? Simple, so you can address the operations with the longest duration and likely causing annoying performance issues for your customer.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0yolxdmbwg29o4otwkyh.png)

Each color denotes the type of operation, such as http, db, resource and browser. It also allows you to visualize change over time for each operation type and find transactions with unusual distributions of operations that could point to an underlying problem.

Fun fact: We use Sentry to monitor Sentry, shocker. We started using Operations Breakdown when it was early in development. Seeing that some transactions spent much more time in the database than other similar transactions surfaced a previously unknown n+1 issue. Checkout the [PR](https://github.com/getsentry/sentry/pull/25144) for the fix.

In the example below, most [transactions](https://docs.sentry.io/product/sentry-basics/tracing/event-detail/) have a pattern that shows a mix of different operations, and one that is entirely composed of http operations, marked in yellow. That event is worth investigating some more...

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

You can dive deeper into an individual event and see the details of a particular span.

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

## When Transactions go Awry

Another way you can use Operations Breakdown is to track the distribution of operations over time to see if the distribution changes dramatically. If an irregularity develops, this could indicate a slow database query that could be caused by a growing database. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6k68fjqe9p1ngv2foywn.png)

Whether it’s timeouts, slow loading pages, or errors causing performance problems, with [Operations Breakdown](https://docs.sentry.io/product/sentry-basics/tracing/event-detail/#operations-breakdown) you see which operations have the greatest impact on your performance so your team can make improvements that drive the biggest gains.

Try Sentry for [free](https://sentry.io/orgredirect/try-business/) today or contact us at [sales@sentry.io](mailto:sales@sentry.io) to get started.
Read environment variables in Clojure
Tags: clojure, beginners
Published: 2021-07-15 20:13:50

Do you want to load some [configuration](https://12factor.net/config) [values](https://docs.github.com/en/actions/reference/environment-variables) [from](https://docs.docker.com/compose/environment-variables/) [the](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/) [environment](https://en.wikipedia.org/wiki/Environment_variable) in [Clojure](https://clojure.org/)?

Great news! Clojure makes this easy!

```clojure
(System/getenv "SHELL")
;=> /usr/local/bin/zsh
```

There are [many](https://github.com/juxt/aero) [other](https://github.com/tolitius/cprop/) [ways](https://github.com/dunaj-project/crispin) [to](https://github.com/weavejester/environ) [configure](https://github.com/jarohen/nomad) [your](https://github.com/grammarly/omniconf) [Clojure](https://github.com/exoscale/yummy) [application](https://github.com/Otann/wrench), and some of us have our **[favorites](https://github.com/outpace/config)**, but environment variables often factor in.

Give it a shot and see what you can learn!
I am looking for beta readers for my new book on software development
Tags: book, documentation, testing, leadership
Published: 2021-07-15 19:55:10

---
title: I am looking for beta readers for my new book on software development
published: true
description: 
tags: book,documentation,testing,leadership
---

I am writing a new book on software development [Efficient Developer](https://stribny.gumroad.com/l/efficientdeveloper). The book is focused on junior and mid-level developers that want to get more into thinking like seniors and development leads.

The chapters are on topics like:

- Product Specification
- Software Development Processes
- Development Environment
- Code Management
- Debugging, Monitoring, Profiling
- Documentation
- Testing
- Software Estimation

As I want to make a good book, I need feedback. I offer the book for free as a thank you to anyone who gives a good read to a few chapters and gives me feedback.

If you want to be part of this, just fill out [this form](https://forms.gle/CrXZoXBM4XEXrwFb6) or drop me an email to `petr@stribny.name` and I will get back to you shortly :)
Fluent Forms Review - Geniales WordPress Formular Plugin
Tags: wordpress, formular, wordpressplugins
Published: 2021-07-29 15:13:06

---
title: Fluent Forms Review - Geniales WordPress Formular Plugin
published: true
date: 2021-07-15 19:33:31 UTC
tags: WordPress,formular,WordPressPlugins
canonical_url: https://bloggerpilot.com/fluent-forms/
---

![Fluent Forms Review](https://bloggerpilot.com/wp-content/uploads/2021/06/fluent-forms.png)

Fluent Forms ist der neue Star der Web-Formulare. Formulare sind...

[Fluent Forms Review](https://bloggerpilot.com/fluent-forms/)

Das Fluent Forms Plugin ist eines der beliebtesten Formular Plugins auf WordPress.org. Ursprünglich wurde es entwickelt, um WordPress-Bloggern und Webmastern dabei zu helfen, Kontaktformulare in ihre Seite einzubauen, aber es hat sich in den letzten Jahren zu viel mehr als das entwickelt. Es ist ein wesentlicher Bestandteil der gesamten Blogging-Plattform geworden und viele Agenturen nutzen es für ihre Kunden-Websites.
I got featured for my work with Tailwind CSS
Tags: javascript, opensource, tailwindcss, node
Published: 2021-07-15 19:26:12

I am thrilled to share that my [open-source](https://github.com/msaaddev/new-tailwind-app) work got featured in [Cooperpress's](https://cooperpress.com/) Node Weekly newsletter. Cooperpress newsletter is one of the most reputable, followed newsletters in the developer community with almost half a million subscribers. You can read the newsletter [here](https://nodeweekly.com/issues/397).

I subscribed to Cooperpress a year ago. I remember at the time I thought what would one has to do in order to get featured in such newsletters. Hence, you can imagine my excitement when I got to know that it finally happened.

The funny part is someone who I don't know reached out to me on Facebook to let me know that hey you got featured.

![node weekly featured](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u8dc2g16o8xqffeqf6im.png)

## But why?

A month ago, I started dabbling with Tailwind and I totally loved it. But I hated the steps I had to go through in order to get started with it across different web apps. At the time, I thought I should just create a template repository with Next.js and React.js Tailwind integrated boilerplate.

The next day I thought why not just create a tool that can get me started with Tailwind and Next.js and React.js with a single command. And eventually, I started working on [new-tailwind-app](https://github.com/msaaddev/new-tailwind-app). One thing led to another and I expanded it to support almost all the frameworks that are in the documentation of Tailwind CSS.

## Next steps

I am planning to integrate many different frameworks with the [new-tailwind-app](https://github.com/msaaddev/new-tailwind-app) and also to included TypeScript support in the upcoming weeks. I am also planning to shape it in a way to make it a one-stop tool for developers which they can use to easily get started with Tailwind across many web frameworks.

I also wrote a piece about why here on dev.to explaining why I built this tool. You can read it [here](https://dev.to/msaaddev/tailwind-css-user-read-this-488n).

Cheerios 🤞🏻
Head First Design Pattern: 5 of 10
Published: 2021-07-15 19:20:59

I just learnt my fifth design from the Head First Design Pattern book. Today, I learnt about the Command pattern.

According to Head First Design Patterns, the Command pattern is a pattern that encapsulate a request as an object, thereby letting you parameterise other object with different requests, queue and also undo requests.

The command pattern works by decoupling by the object making the request(invoker) and the object that knows how to perform the request. It does this by encapsulating actions into command objects. The command object houses the receiver(which essentially the object performing the action) and it's actions. 

The first step is implementing is defining a command interface. This interface defines an method called execute. 
The second is creating command objects that implement the command interface. 
The third is is creating the invoker class, `SmartHomeApp`. `SmartHomeApp` has no knowledge of the actions being performed anytime `OnButtonTapped` and `offButtonTapped`.

The code below is an example of the command pattern. 
```kotlin
interface Command {
    fun execute(): Unit
}

class TurnOnLightsCommand : Command {
    override fun execute() {
        print("Light turned on")
    }
}

class TurnOffLightsCommand : Command {
    override fun execute() {
        print("Light turned off")
    }
}

class TurnOnTVCommand : Command {
    override fun execute() {
        print("TV turned on")
    }
}

class TurnOffTVCommand : Command {
    override fun execute() {
        print("TV turned off")
    }
}

interface Command {
    fun execute(): Unit
}

class TurnOnLightsCommand : Command {
    override fun execute() {
        println("Light turned on")
    }
}

class TurnOffLightsCommand : Command {
    override fun execute() {
        println("Light turned off")
    }
}

class TurnOnTVCommand : Command {
    override fun execute() {
        println("TV turned on")
    }
}

class TurnOffTVCommand : Command {
    override fun execute() {
        println("TV turned off")
    }
}


class SmartHomeApp {
    private val onCommands = mutableListOf<Command>()
    private val offCommands = mutableListOf<Command>()

    fun setCommand(slot: Int, onCommand: Command, offCommand: Command) {
        onCommands.add(slot, onCommand)
        offCommands.add(slot, offCommand)
    }

    fun onButtonTapped(slot: Int) {
        onCommands[slot].execute()
    }

    fun offButtonTapped(slot: Int) {
        offCommands[slot].execute()
    }
}

fun main() {
    val smartHomeApp = SmartHomeApp()

    smartHomeApp.setCommand(0, TurnOnLightsCommand(), TurnOffLightsCommand())
    smartHomeApp.setCommand(1, TurnOnTVCommand(), TurnOffTVCommand())

    smartHomeApp.onButtonTapped(0)
    smartHomeApp.onButtonTapped(1)

}
```
The command pattern can be used to implement really cool functionalities like undo, redo actions, performing a sequence of commands(Macros). It also allows you to queue and delay the execution of an action after request was made. With the command pattern you can also implement complex logging and state restoration logic.
Becoming Blockchain developer 
Tags: blockchain, ethereum, hardhat
Published: 2021-07-15 18:54:23

Working as full stack developer minding my own business.
My boss gets a call from a potential client...
promises him Vitalik Buterin on drugs, 
walk up to me: 
Mark, you have a month and a half to become blockchain developer.

I'm taking you with me on my blockchain journey and I'm not even kidding that really happened. 
In September I'm starting to work on Ether project alongside my two colleagues.

So my idea how to adopt a whole new ecosystem in short period of time:

First thing first I'll research all relevant technologies
and I'll try to figure out what problems they are trying to solve.

After that, I'll probably fly over these tutorials and materials.

Ethereum and Solidity: The Complete Developer's Guide
https://www.1377x.to/torrent/4727319/Udemy-Ethereum-and-Solidity-The-Complete-Developer-s-Guide/

Interesting YouTube channel
https://www.youtube.com/c/naderdabit/videos

Interactive game/tutorial
https://cryptozombies.io/

And ofc Docs
https://ethereum.org/en/
https://docs.soliditylang.org/en/v0.8.6/index.html

That's for starters, If you have any suggestions feel free to contact me or write some constructive comments.

I'll be posting regularly, so come on board and let this adventure begin.
The Limits of Automation w/ Judy Johnson
Tags: automation, security, devops, engineering
Published: 2021-07-15 18:53:31

Automation is key when it comes to scaling your engineering efforts, but can you automate yourself out of a job? 

On this week’s episode of [Dev Interrupted](https://devinterrupted.com/podcast/automation-limitations/) we bring in Judy Johnson, a software engineer, to answer questions about what should and should not be automated, and how to convince your business to take on the upfront cost of an automation initiative.

#**Listen to the full episode**
{% spotify spotify:episode:5BVaEdZ3Cqrjd7nsyLL64p %}

#**Episode Highlights include:**
* What shouldn’t you automate?
* Can you automate yourself out of a job?
* How has automation evolved over recent decades?
* Can you automate security?

#**Join the Dev Interrupted Discord Server**
With over 1200 members, the Dev Interrupted Discord Community is the best place for Engineering Leaders to engage in daily conversation. No sales people allowed. [Join the community >>](https://discord.gg/devinterrupted)
![Join the Dev Interrupted Discord Community!](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/19j3dzgz4r4kzav3w6z8.png)