teleren/devto huggingface dataset:
How to Use the Web Console Helpers Commands in Firefox Developer Edition
Tags: webdev, javascript, tutorial, frontend
Published: 2021-02-12 19:06:39

I recently discovered special web console commands in Firefox Developer Edition. If you are not using Firefox Developer edition I highly recommend using it because of all the useful tools.

These are the top ones from the [Mozilla docs](https://developer.mozilla.org/en-US/docs/Tools/Web_Console/Helpers).

## Dollar sign selectors
I previously wrote an article about [using dollar sign variable](https://dev.to/jadenconcord/use-this-vanilla-js-shortcut-with-function-2d7j) to make a shortcut to the <code>document.querySelector</code>. Now, this command is built into the JS console. Obviously, you need to declare the $ if you want to use it in your app. 
If you do that, you need to put <code>.bind(document);</code> after the <code>document.querySelector</code> like,
~~~js
let $ = document.querySelector.bind(document);
~~~

## $0
<code>$0</code> selects the element currently selected by the inspector tool.
## copy()
It copies the input text to clipboard. Extremely useful when generating text in the console.
## inspect($(query))
Select an element to view in the Inspector tab. Allows keyboard only navigation of the nodes.


More tools [here](https://developer.mozilla.org/en-US/docs/Tools/Web_Console/Helpers)
How to use Netlify CMS on Vercel
Tags: vercel, netlify, github
Published: 2021-02-12 18:58:27

Hi everyone, today I want to introduce you to a serverless service to use [Netlify CMS](https://www.netlifycms.org/) for sites hosted on [Vercel](https://vercel.com).

What you need to do is modify your `config.yml` file:

```yaml
backend:
  name: [github | gitlab]
  repo: adrian-ub/adrian-ub # Path to your Github/Gitlab repository
  branch: main # Branch to update
  base_url: https://netlify-cms.adrianub.vercel.app
```

You can visit: https://netlify-cms.adrianub.vercel.app

{% github adrian-ub/netlify-cms-vercel %}
TIL: A (maybe) unexpected usage of the -count flag in Go tests
Tags: todayilearned, go, test, count
Published: 2021-02-12 18:32:49

---
title: TIL: A (maybe) unexpected usage of the -count flag in Go tests
published: true
description: A (maybe) unexpected usage of the -count flag in Go tests
tags: todayilearned, go, test, count
//cover_image: https://direct_url_to_image.jpg
---
Normally when you add the `-count $N` flag to the `go test` command the result is that any tests and/or benchmarks that would be run are run __$N__ times as we can see in the following run.

```shell
go test -v -run 1 -bench 1 -count 3
=== RUN   Test1Sort
--- PASS: Test1Sort (0.00s)
=== RUN   Test1Sort
--- PASS: Test1Sort (0.00s)
=== RUN   Test1Sort
--- PASS: Test1Sort (0.00s)
goos: linux
goarch: amd64
Benchmark1Sort
Benchmark1Sort-12          10370            113657 ns/op
Benchmark1Sort-12          10488            114596 ns/op
Benchmark1Sort-12           8942            115987 ns/op
PASS
ok      _/home/mcaci/code/github.com/mcaci/dev-art/bench        5.422s
```

Just a side note, the _1_ put as argument of `-run` and `-bench` are __regular expressions__ to identify respectively which tests and which benchmarks to run; for more informations on benchmarks, you can read this [article](https://dev.to/mcaci/introduction-to-benchmarks-in-go-3cii).

Getting back to the situation described in the title, let's look at this situation where we have a test run that is cached after the first time it is run.

```shell
$ go test -run 1 .
ok      _/home/mcaci/code/github.com/mcaci/dev-art/bench        0.017s
$ go test -run 1 .
ok      _/home/mcaci/code/github.com/mcaci/dev-art/bench        (cached)
$ go test -run 1 .
ok      _/home/mcaci/code/github.com/mcaci/dev-art/bench        (cached)
```

Tests results are cached when they are run in _package list mode_ as long as there are no differences in the package code. This is done in order to avoid repeating tests that are already passing and for which no change has been done.

However, what if we didn't want to use the cache but repeat the tests anyway?

Here is where the flag `-count` comes to our aid.

```shell
$ go test -timeout 1s -run ^Test1Sort$ . -count=1
ok      _/home/mcaci/code/github.com/mcaci/dev-art/bench        0.019s
$ go test -timeout 1s -run ^Test1Sort$ . -count=1
ok      _/home/mcaci/code/github.com/mcaci/dev-art/bench        0.015s
$ go test -timeout 1s -run ^Test1Sort$ . -count=1
ok      _/home/mcaci/code/github.com/mcaci/dev-art/bench        0.014s
```

As indicated in the documentation that can be found by running `go help testflag`:

> To disable test caching, use any test flag or argument other than the cacheable flags. The __idiomatic way__ to disable test caching explicitly is to use __-count=1__.

And so this was the unexpected usage of the `-count` flag in `go test`, a hidden gem in the go documentation. To read more about this and testing in go in general both `go help test` and `go help testflag` are great resources to look at.

Hope this was helpful, thanks a lot for your time reading it!
3 Best Non-Code-Related Books For Developers!
Tags: books, productivity
Published: 2021-02-12 18:56:52

<span>Photo by <a href="https://unsplash.com/@element5digital?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Element5 Digital</a> on <a href="https://unsplash.com/s/photos/4096x4096-books?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></span>

In this post, I will tell you the 5 best Books That Changed My Life!

**Note: These books have changed my life but it doesn't particularly mean that they could change your life too, you have to implement the tactics written in the book to get results!**

"All readers are not leaders, but all leader are readers" ~ Harry S. Truma

1. Getting To YES By Roger Fisher & [William Ury](https://www.williamury.com/)
![Getting To YES Image](https://dev-to-uploads.s3.amazonaws.com/i/einw1qryof6teiy43beb.jpg)
<br>
This book will help you with negotiating and getting a client, conversation, argument, or anything else to YES!

2. Influence - The Psychology Of Persuasion by [Robert Cialdini](https://twitter.com/RobertCialdini)
![Influence - The Psychology Of Persuasion Image](https://dev-to-uploads.s3.amazonaws.com/i/5lm73wpxh65bu7gl4mqt.png)
<be>
This book is gonna give you the answer to the "Whys", we have in our mind and tell us how to grow and influence businesses and startups

3. The 4-Hour Workweek by [Tim Ferriss](https://tim.blog/)
![The 4-Hour Workweek Image](https://dev-to-uploads.s3.amazonaws.com/i/f5fpjqr573lsqlusm06k.jpg)
<br>
This book will help you optimize your day and save your productive hours and it would also teach you not to check your email or social media every 15 minutes and it will also help you create a TODO List so that you can manage your business/clients.

There are a lot more books, so please feel free to share a book down below in the discussion box below.

Don't Forget To Follow Me On [Twitter](https://twitter.com/GarvitMotwani)
Video: How To Build a Random Quotes Twitter Bot With Google Sheets, Parabola, and Zapier No-Code Tools
Tags: nocode, tutorial, video
Published: 2021-02-16 18:02:48

---
title: Video: How To Build a Random Quotes Twitter Bot With Google Sheets, Parabola, and Zapier No-Code Tools
published: true
date: 2021-02-12 18:56:29 UTC
tags: NoCode,Tutorial,Video
canonical_url: https://maxkatz.org/2021/02/12/video-how-to-build-a-random-quotes-twitter-bot-with-google-sheets-parabola-and-zapier-no-code-tools/
---

This video shows how to build a random quotes Twitter bot with Google Sheets, Parabola, and Zapier No-Code tools.

- The video is based on this [How To Build a Twitter Bot With Google Sheets, Parabola, and Zapier No-Code Tools](https://dev.to/maxkatz/how-to-build-a-twitter-bot-with-google-sheets-parabola-and-zapier-no-code-tools-146b) blog post
- The [original video](https://www.youtube.com/watch?v=Ft1Kusw0Ado&t=0s) shows how to build a Twitter bot but without random quotes

{% youtube 2WejA13Vzyg %}

Check out my other [no-code videos](https://www.youtube.com/watch?v=2WejA13Vzyg&list=PLSAWywyhniCOpvlFSfUWVNAbclc2-1Kne).
Accessibility Audit on Amazon
Tags: a11y, webdev, wave
Published: 2021-02-12 18:28:13

Something that is taken into huge consideration when designing websites is how accessibility plays into it. Especially for larger corporations like Amazon having an accessible webpage for many different demographics is essential to their business.

**How did Amazon do?**
I first ran a LightHouse Report using a webtool called web.dev.
It came up with these metrics:
Performance: 44
Accessibility: 88
Best Practices: 86
SEO: 92
(Max 100)

As you can see the latter 3 categories scored fairly well. The performance category, however, did not fare so well. When I analyzed some of the details that the report had generated this is what I found.
- Large amounts of unused JavaScript
- Time to Interactive was at 7.7seconds (meaning that's how long you had to wait to interact with the webpage)
- Images improperly formatted.

All of these things were found in the performance category. You might be asking, weren't we talking about accessibility not performance? Yes, but no.

By reading in between the lines of this report, you can make the assumption that when your performance takes such a large hit it will trickle over into your accessibility inevitably. Accessibility covers not only physical capabilities but also network capabilities as well. In the case of people with slower internet connection this webpage would be a horrible experience to browse.

Secondly I also ran a WAVE Audit. This kind of audit gets more into the nitty gritty details of accessibility and what you can do to fix the issues in your design. For example I found that ARIA menus were broken on the webpage. For people browsing the web that navigate via keyboard controls instead of a mouse, this would severely impact their experience. For example a user with tremors in their hands would use keyboard navigation instead of mouse for ease of access, but with a broken menu that would cause issues.


Video: https://youtu.be/pdrFRWhtK2Y
Channel: https://www.youtube.com/channel/UCDRkz-mU0NWAZTgN9kVc0Ag
Having trouble with gdal on Anaconda? Try this!
Tags: python, datascience
Published: 2021-02-12 18:22:12

If you are interested in this article I assume you recently tried to use **gdal** with anaconda for one project or another and have run into a problem. So the quick solution for your problem is...

**Create a new virtual environment and install gdal in that environment!!**

After encountering countless problems with python with different projects, the golden rule I've learned is: **always create a virtual environment for your project!**

If you are still reading this it means you would like a detailed explanation (or maybe for some reason you like me rambling about gdal of all things!). 

So one of my friends was working on a data science project and was running into a lot of issues and asked me to take a look at his project to see if I could get it to run.

The error he was encountering was: **DLL load failed: The specified procedure could not be found**

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

So the solution here is to create a new virtual environment in anaconda using conda in the terminal (if on windows you can use the anaconda-prompt terminal). Open the folder where you want to create the project and then follow these steps:

First update conda if necessary using:

```bash
conda update conda
```
Then we can proceed to creating a virtualenv (short for virtual environment) using:

```bash
conda create -n yourenvname
```

Now activate your virtualenv using:

```bash
conda activate yourenvname
```

Now just execute the following statement and it will install all dependencies as well as make any changes required

```bash
conda install gdal
```

I was using jupyter notebooks so I will open that (this should work fine with spyder as well):

```bash
anaconda-navigator
```
Open jupyter-notebook (the virtualenv will be selected by default)

In the first cell execute 

```bash
from osgeo import gdal
```
The cell will execute without errors!

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

Cheers!!!

![](https://media.giphy.com/media/xUKrrEnN9I5lnrcSMv/giphy.gif)
<figcaption>Gif via Giphy</figcaption>
Another method to access AKS Linux Nodes
Published: 2021-02-12 18:17:49


# Deploy a demonset  with privileged containers to access each node
```
cat <<EOF > sshNode.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: privileged
spec:
  selector:
    matchLabels:
      name: privileged-container
  template:
    metadata:
      labels:
        name: privileged-container
    spec:
      containers:
      - name: busybox
        image: busybox
        resources:
          limits:
            cpu: 200m
            memory: 100Mi
          requests:
            cpu: 100m
            memory: 50Mi
        stdin: true
        securityContext:
          privileged: true
        volumeMounts:
        - name: host-root-volume
          mountPath: /host
          readOnly: false
      volumes:
      - name: host-root-volume
        hostPath:
          path: /
      hostNetwork: true
      hostPID: true
      restartPolicy: Always
EOF
```
![image](https://dev-to-uploads.s3.amazonaws.com/i/acy0kvf9697un8xw3ac5.png)
 
Bellow, I list the nodes and the pods, I see that I have 3 nodes and 3 privileged pods each one related to one specific node.
I exec into one created pod and I enter directly on the node from there I access the kubelet logs.
Exit the node by entering this command: exit

``` 
kubectl get nodes -owide
kubectl get pods -owide                                            
kubectl exec -it privileged-dr5mf chroot /host 
```
Leet code challenge — Number of Steps to Reduce a Number to Zero
Tags: leetcode, programming, java
Published: 2021-02-12 18:10:37

#Using recursion(not efficient)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/b4y1htxjymzpczoaiehm.png)

#Using while loop
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/51aijqh0qxmlrnw769sb.png)
Error: Returned error: insufficient funds for gas * price + value at Object.ErrorResponse
Published: 2021-02-12 18:01:25

I am using web3 version 1.3.3 and tried to call the contract method using send() but it is showing an error above( Error: Returned error: insufficient funds for gas * price + value at Object.ErrorResponse )

const ERC20ListInst = await this.contract;
const res = await ERC20ListInst.methods.tokenToWei(addr, this.web3.utils.toHex(amount)).send({
   from: this.web3.eth.defaultAccount,
   gas: 100000
});

I have enough eth on the account and can't sure why this is happening. Is there anyone has faced this one before?
Maximizing Productivity During Small Blocks Of Time
Tags: productivity, career
Published: 2021-02-12 17:44:42

---
title: Maximizing Productivity During Small Blocks Of Time
published: true
description: As a maker with a manager's schedule, I need to figure out how to make meaningful progress in small blocks of time. I've got a few rules to help me.
tags: productivity, career
series: Maximizing Productivity During Small Blocks Of Time
canonical_url: https://www.stevenhicks.me/blog/2021/02/maximizing-productivity/
//cover_image: https://direct_url_to_image.jpg
---

One of my primary self-improvement projects is to use my time more effectively, especially the small blocks in between meetings. I'm not a manager, but I have more of a [manager's schedule than a maker's schedule](http://www.paulgraham.com/makersschedule.html). I willingly accept more meetings than most developers. I like the interaction, I like to get others unstuck, and I like to participate in cross-team conversations. The result: most of the empty time on my calendar is in blocks of an hour or less.

It's hard to do deep work in an hour or less. If I make full use of the hour, sure, I'll probably feel good about my progress...but that assumes I can get into the deep work promptly and that I don't get distracted. In reality, what looked on my calendar like a good hour often ends up feeling like 15 minutes of meaningful progress. If I'm lucky. 

Thankfully, I have a lot of good role models to emulate at [Artsy](https://twitter.com/artsyopensource). Some of my most admirable coworkers accomplish meaningful work in the same size blocks of time that I would have previously dismissed as too small for meaningful work. They might not know it, but I've been watching and taking notes.

Over the next couple weeks, I'll share the rules I've developed for myself to work more effectively with my small blocks of time. I don't always follow them, but the days I do are the days I feel most successful, productive, and effective.
'BEM' do CSS - Boas Práticas
Tags: css, codequality, vscode, webdev
Published: 2021-02-12 17:37:35

###O que é BEM?
É uma metodologia de escrita de classes no CSS que ajuda na criação de componentes reutilizáveis e boas práticas no desenvolvimento front-end.

___

###É fácil!
Apenas uma convenção de nomes.

###É modular!
Código independente e reutilizável.

###É flexível!
Use da maneira que preferir.

###É internacional!
Entenda rapidamente o CSS do mundo todo.
___

###'B' vem de Bloco (block)
###'E' vem de Elemento (element)
###'M' vem de Modificador (modifier)

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

**Blocos >** São entidades autônomas que são significativas por si só. Exemplos: Menu, Rodapé, Cabeçalho, Newsletter, etc.

**Elementos >** São partes de um bloco (elementos filhos, netos, etc), Exemplos: Items de um Menu, texto Copyright de um Rodapé, Logo de um Cabeçalho, Formulário de um Newsletter, etc.

**Modificadores >** Uma variante de um bloco ou elemento padrão. Exemplos: um Botão Verde (padrão é branco), um Item de Menu com Link Desabilitado (o padrão é habilitado), etc.
___

### Nomeando classes conforme o 'BEM’:

**Para os blocos** não há diferenças dos nomes que hoje você já escolhe no CSS (exemplo: **"bloco"**), ou seja:
- Se temos uma divisória para a newsletter podemos nomeá-la como "newsletter";
- Se temos um menu de navegação, podemos nomeá-lo como "menu" e assim por diante.

**Para o(s) elemento(s)** de um bloco usamos por convenção 'BEM' o nome do bloco seguido de 2 _underlines_ e o nome do elemento (exemplo: **"bloco__elemento"**), ou seja:
- Se temos um bloco de _menu_ com vários elementos que são links de navegação, podemos nomeá-los como "menu__links";
- Se temos um bloco de sessão _newsletter_ com um elemento formulário de cadastro, podemos nomeá-lo como "newsletter__formulario" e assim por diante.

**Para o(s) modificador(es)** de um elemento usamos por convenção 'BEM' o nome do elemento seguido de 2 _hífens_ e o nome do modificador (exemplo: **"bloco__elemento--modificador"**), ou seja:
- Se temos um botão de formulário que já possui uma formatação padrão, mas queremos que ele seja verde, podemos nomeá-lo como "formulario__bttn--red";
- Se temos um menu de links, mas um deles está desabilitado, podemos nomeá-lo como "menu__links--disabled" e assim por diante.

___

###‘BEM’ na prática:

Observe a página abaixo:

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

Para os blocos (em verde), elementos (em azul) e modificadores (em vermelho) os nomes práticos seriam:

<img src="https://dev-to-uploads.s3.amazonaws.com/i/9uycc91uibrpuzv9r0gf.png" width="306" height="413">

## **Parabéns!!!**
Fico muito feliz que chegou até o final dessa publicação.
Espero que você tenha aprendido muito!

## **Quer aprender mais?**
Te convido a ver a Live sobre 'BEM - Boas Práticas em CSS' que fiz lá no meu canal da Twitch. O link da live é esse: https://www.twitch.tv/videos/906196998?t=0h2m48s

Segue também a apresentação que foi preparada.
Um grande abraço!

{% slideshare M53Y9XEMB92xj6 %}
Hello DEV community! I just joined the Forem team
Tags: forem, career, meta
Published: 2021-02-12 17:24:22

Hiya DEV peeps, I'm Ella and I'm a dev.to lurker. As a tech-positive non-developer, I've been enjoying the richness of this community and how supportive and collaborative y'all are. It's such a rush to write my first post here, announcing that I've joined the fantastic team behind DEV and Forem as a Community Associate. 

#What does this mean?
I am beyond excited to be joining @michaeltharrington and @itscasey to support everyone on [dev.to](https://dev.to/), [community.codenewbie.org](https://community.codenewbie.org/), and the Forem ecosystem. We're here to help, so don't hesitate to reach out to us at yo@dev.to any time!

Despite my first forays into coding 20+ years ago, curiosity took me down a different path so my career background is in face-to-face communities, wellness, and the ubiquitous service industry. My goal is to bring empathy and compassion from these fields into my role here, and serve this community and all the Forems with heart, soul, and a healthy dose of humility.

#Why Forem?
As a former youth worker and community educator, I have a deep stake in a healthier internet. DEV is a model for inclusive online communities that encourage and build people up, share knowledge and insights that narrow the education gap, and elevate everyone's access to learning and growth opportunities. It's incredible that the wider world now gets a chance to build online spaces in its image. 

I gotta hand it to you all, because the community here is what makes all of this possible. **Thank you, DEV members, for contributing to making this place great!**

#By the by
I'm into dancing, callisthenics, growing plants (indoors and outdoors), knitting, and playing too much League of Legends. If any of this resonates, feel free to connect!
What was your win this week?
Tags: discuss, weeklyretro
Published: 2021-02-12 17:14:02

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

Happy Friday!


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

All wins count — big or small 🎉

Examples of 'wins' include:

- Starting a new project
- Landing a new job
- Enjoying the sun/snow/rain (I'm from Portland, Oregon; enjoying the rain is actually something we do here 😆) ... or whatever else might spark joy ❤️ 

---

Celebrate those wins!

![Not a cat](https://media.giphy.com/media/yTzwdWHe1VxQt4sfiD/giphy.gif)
_Sounds just like something a cat pretending to be a lawyer would say..._ 🤔