teleren/devto huggingface dataset:
How to use fixtures with Cypress to isolate the frontend tests
Tags: cypress, testing, automtion, e2e
Published: 2021-02-17 00:06:09

## Today in the “Pinches of Cypress” series, learn how to use fixtures in automated frontend tests

Today's post is based on [**yesterday's content**](https://dev.to/walmyrlimaesilv/how-to-intercept-and-mock-the-response-of-an-http-request-with-cypress-4lc5) example (in which you learned how to intercept requests), with a brief change.

That's right, let's go straight to a practical example.

The example application is the same. That is, it allows the creation, reading, updating, and deletion of notes.

After logging into the application, the user is directed to their personal list of notes.

The scenario, however, will be a little different. This time, I want to simulate that when the user already has a certain number of notes, they are rendered in the list.

The test code would look like this.

```js
// cypress/integration/listOfNotes.spec.js

describe('Notes list', () => {
  beforeEach(() => {
    cy.intercept('GET', '**/notes', { fixture: 'notes' })
      .as('getNotes')
    cy.login()
    cy.wait('@getNotes')
  })

  it('renders 6 ".list-group-item"s, being the first one a button to create a new note', () => {
    cy.get('.list-group-item')
      .should('have.length', 6)
      .first()
      .should('contain', 'Create new note')
  })
})
```

And in the `cypress/fixtures/` directory, there would be a file called `notes.json`, which would contain the following content.

```json
[
  { "content": "Sample content 1"},
  { "content": "Sample content 2"},
  { "content": "Sample content 3"},
  { "content": "Sample content 4"},
  { "content": "Sample content 5"}
]
```

**Note:** It is worth remembering that this is the data structure that such a frontend application would normally receive from the backend via API.

That's it.

The test now intercepts a `GET` request to the `'**/notes'` route, and the frontend then renders the contents of the `cypress/fixtures/notes.json` file.

Since in this file we have 5 notes, our assertions (that 6 `'list-group-item'`s are rendered, and that the first item in the list is the button for creating a new note) pass.

See a screenshot of the test run.

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

Are you enjoying the series?

I'm looking forward to hearing your feedback!
___

This post was originally published in Portuguese on the [**Talking About Testing**](https://talkingabouttesting.com/2021/02/16/como-utilizar-fixtures-com-cypress-para-isolar-os-testes-do-frontend/) blog.
___

Would you like to learn about **test automation with Cypress**? Get to know my online courses on [**Udemy**](https://udemy.com/user/walmyr).
Surprising time savers
Tags: productivity
Published: 2021-02-17 11:29:10

---
title: Surprising time savers
published: true
date: 2021-02-17 00:00:00 UTC
tags: productivity
canonical_url: https://jhall.io/archive/2021/02/17/surprising-time-savers/
---

I’ve been writing computer programs since I was 8 years old. That’s more than 80% of my life.

As such, I often dismiss certain tools or techniques as “beneath me”. Excel? That’s silly! I can write a CRUD app! AWS? Pfft! I can run my services on a pool of Raspberry Pis in my attic!

Yesterday I set up [Zapier](https://zapier.com/) for the first time. It’s definitely one of those “beneath” me tools. But dang if it didn’t save me a bunch of time!

Part of my job is writing API integrations, after all. So I know I _could_ solve the same problem myself. I’d probably do it “better”, too, in some sense. But by paying US$19.99 per month, I can save a bunch of time, that I can now spend on something more useful.

Maybe I should learn to use Excel next…
How to change the last commit message in Git?
Tags: git
Published: 2021-02-17 00:00:00

---
  title: How to change the last commit message in Git?
  published: true
  tags: Git
  date: Wed Feb 17 2021 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/change-last-commit-message-git
  cover_image: https://melvingeorge.me/_next/static/images/main-a92df86073a73249f79ad00de3b4767f.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/change-last-commit-message-git)
  
To change the last commit message in git, you can add the `--amend` flag to the `git commit` command along with the new commit message.

```bash
# Change last commit message
git commit -m "New commit message" --amend
```

This will only change the most recent or the last commit message.

To push the new commit to the remote branch or the repository you have to force push the commits using the `--force` flag in the `git push` command, this is because the commit id of the newly changed commit message (or the SHA signatures) will be different. To do that you can do like this,

```bash
# Change last commit message remotely
# by force pushing the commits
git push origin branch-name --force
```

### Caution: Force pushing the commits may make some inconsistencies if the same branch is being used by other users.

### Feel free to share if you found this useful 😃.

---
Don't forget `py.typed` for your typed Python package
Tags: python, mypy, statictyping, pep561
Published: 2021-02-19 16:19:12

---
title: Don't forget `py.typed` for your typed Python package
published: true
date: 2021-02-17 00:00:00 UTC
tags: Python,mypy,statictyping,PEP561
canonical_url: https://blog.whtsky.me/tech/2021/dont-forget-py.typed-for-your-typed-python-package/
---

## Intro

[pixelmatch-py](https://github.com/whtsky/pixelmatch-py), a Python library I maintained for comparing images, received [a Pull Request to add type hints](https://github.com/whtsky/pixelmatch-py/pull/38) about 10 months ago. After merging this PR & releasing a new version, I thought the library's users will magically get their type working.

Until today, I was reading [cryptography's Changelog](https://cryptography.io/en/3.4.4/changelog.html#v3-4-4) and a line got my attention:

> Added a `py.typed` file so that `mypy` will know to use our type annotations.

After reading [PEP-561](https://www.python.org/dev/peps/pep-0561/#packaging-type-information) and [mypy documentation](https://mypy.readthedocs.io/en/stable/installed_packages.html#making-pep-561-compatible-packages) I'm sure that I didn't publish the package right: I should include a `py.typed` file, or the type checker won't use the type hints provided by the package.

## Adding `py.typed`

It's faily simple to include this file: just `touch` a `py.typed` file in your package directory and include it in your distribution.  
I'm using [poetry](https://python-poetry.org/), so I added

```toml
packages = [
  {include = "pixelmatch"},
  {include = "pixelmatch/py.typed"},
]

```

under the `[tool.poetry]` section of `pyproject.toml`.

If you're using `setup.py`, you can add `package_data` to `setup` call:

```python
setup(
    package_data={"pixelmatch": ["py.typed"]},
)

```

Release [a new version for your package](https://github.com/whtsky/pixelmatch-py/commit/9c6297cedd10232ffbe23cc54a4e46e76d1fa13a) then type informations from your packages should works.

## Fin

If you're a Python package maintainer, be sure to include `py.typed` file for your typed package!
How to Support a Creator 
Tags: motivation, development, todayilearned
Published: 2021-02-16 23:54:36

First of all, hello! 

If you are reading this so you are interested in helping your favorite creator. It has multiple ways to do it and I will tell them the ones that I know. 

 
---

### 1st - Support with money 

> It's the most seen way to support someone or something. Normally people need to have money to pay their taxes and bills and to have that they need to work. When working in a normal job they have less time to do that service or product (that content that you love it's sometimes just a hobby to them). **A donation is always welcome.**


### 2nd - Reacting to their posts 

> Giving likes, following, and saving the posts that they make it's really helpful too. **They can see that their content is being seen by someone** (you) and it helps to give them motivation. 


### 3rd - Comment their content 
 
> It's really good for the creators to have someone who comments and talks about their content. **It means that someone is more interested in their stuff and just not give a random-like**. It is a great opportunity to give feedback (the creator appreciates it) and talk with them. 


### 4th - Share their content 

> **You maybe don't have money to support them but you can always share their content with your family or friends.** A strong audience (not necessarily big) is very helpful giving again motivation to the creators.  

---
 
#### Lasts Notes
So, these are some ways to help your creator. These look simple but are really good to give support, feedback, and motivation to them. 

 


**Social Media:**
You can follow me on:
- [Youtube](https://www.youtube.com/c/DavidRicardo97/)
- [Twitter](https://twitter.com/DavidCRicardo/)


**Credits to:**
- Cover Image from: [InTheFlux](https://intheflux.com/how-to-support-bloggers-and-content-creators/)
echoAR featured in the 2021 SXSW Pitch Report
Tags: news, startup, showdev, discuss
Published: 2021-02-16 23:19:39

echoAR was featured in the 2021 SXSW Pitch Report from PitchBook — a financial data and software company. The report analyzes detailed data from the SXSW Pitch event from what’s shaping the VC Ecosystem to venture market activity amid the continuing pandemic and more.


echoAR was among the few comapnies to be selected as a SXSW Pitch finalist in the Augmented & Virtual Reality category in 2020. Chosen from a record-setting 900+ applications, this year’s finalists represent some of the most cutting-edge companies from around the world in the largest group of applications since SXSW Pitch started.


Honored to be recognized among the top cutting-edge companies out there and humbled by SXSW’s recognition of echoAR as a leading company in the AR/VR space.


Get the full report [here] (https://www.sxsw.com/news/2021/the-2021-pitchbook-report-is-here/).


---------
> **echoAR** (http://www.echoAR.xyz; Techstars ’19) is a cloud platform for augmented reality (AR) and virtual reality (VR) that provides tools and server-side infrastructure to help developers & companies quickly build and deploy AR/VR apps and experiences.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ibf4pwfbgagrmht6pedx.png)
Rails - find VS find_by
Tags: ruby, rails
Published: 2021-02-16 23:13:52

# Introduction
In the beginning of my Rails journey, `find_by` became the bane of my existence, and I didn't even know how, why, or what was happening. Everything was perfectly fine when testing out a new account or creating a new object after database migration. I mean, they were the first objects in the database. *Of course* everything would go well. Until it came down to testing gated content/permissions between two users...

# What is `find_by`?
This is probably the first question I should have asked myself. Don't you know what the say about assuming? I did a lot of that, and I paid for it with hours and hours of stubborn frustration. To begin with, `find_by` isn't what you think it is. It returns the first item in the database. Even if you edit an item on a TODO list with an `id` of 27,  `user_id` of 6, and `description` of "Buy Chocolate Milk", using `find_by` in your controller will return the very first item you didn't specifically query for. **That's what `find` is for.** 

# What is `find`?
It's how we retrieve the exact data we queried for, and the data must match the criteria. With `find`, it doesn't loosely choose anything that *might* be related to the condition we pass in. This would have saved me hours of headache if I had given myself the time to understand them. But they have definitely changed the progress I've made in my projects ever since. 

# Ever heard of `where`?
In my searches, I came across this super neat bonus. If you're like me and wondered what the purpose of it is compared to `find` or `find_by`, `where` returns a collection of all items that match a certain criteria. If there are no results, it returns an empty object. Unlike the others which throw an exception error.


# Conclusion
Sometimes, syntax doesn't mean what you think it means. If you make assumptions, you'll get some unexpected behavior. You'll have to do some research, but along the way you might learn about some tools that are a bit cooler and more useful than the one you're using. When in doubt, things go wrong for a good reason and it usually has something to do with what you don't understand about the code you're using. 

Happy Tuesday!
Shoud I learn new stuff right away
Tags: javascript, development, learning, node
Published: 2021-02-16 23:10:32

---
title: Shoud I learn new stuff right away
published: true
description: Is it necessary to learn the new upcoming framework or should I wait?
tags: javascript, development, learning, nodejs
//cover_image: https://direct_url_to_image.jpg
---
In our software world anybody knows to learn something new everyday. But is it so? 

**No**

Of course something new could also mean something new in your current tool-chain or so. Sites tell you to learn new languages NOW. Because why not.  And to improve onself you should do that. But that does not mean to switch to anther framework or libraries.

>Some advice here from me: If you are good in one language, its not that hard to learn a new one. Its hard to get expert in it. But normally you can do a pretty good job. Just learn continuously in your 2 favourite languages you use also in your professional work and it should be fine. No pressure.

Normally a new framework comes out. And there is this one feature that is realy cool. And you think. Wow it must be better as my old framework here. But look closer. New frameworks come with a huge price. Normally they are not delivering the same features and resilience as the old ones. For example. I hear a lot that fastify will replace expressjs or is better. They say its faster and easy to use (express seems hard?). And then I saw this: 'fastify-express' , an package to use Middleware in fastify. To be exactly, to use express middleware.

Many new frameworks have a *Top-Down* model. You get the newest features but at the beginning they don't deliver the same features you love in your old ones.

Now you could say fastify is faster then express. But look at this: 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ariue33wp4rx7z1xl02f.PNG)*source: https://www.techempower.com/benchmarks/*

you see fastify there? The whole point is don't trust benchmarks made by users to sell you the new framework. If you realy need the performance don't use nodejs in the first place.

>To be fair here. React was a big surprise and made the development realy easy. Also does VueJS and many others. But React was used a long time before it was open sourced. And there was not nothing wrong with switching to this.

#### Conclusion
New stuff needs time to grow. You can wait and learn if the framework, lib or whatever is ready to use in the real world and only if you need changes, switch to it. If you're happy with your tools now, wait! If not, change but be patient and don't jump on the hype train.

*You can adapt this to languages and all other stuff in your life.*

*if some body has some translation to real english here, send me a message. ;-)*
Day 310 : Time Moves Slow
Tags: hiphop, code, coding, lifelongdev
Published: 2021-02-16 22:35:58

_liner notes_:
- Professional : Worked on my slides. Updated a tutorial. Had a couple of meetings. Coded on an application. Created a promo video for my upcoming task and posted to social media. Now I'm tired. haha.

- Personal : Last night, I worked on adding some functionality to admin section of my side project. Went through a bunch of tracks for the radio show. Next thing I know, it was pretty late and went to sleep. Some say 'time moves slow', me, nope! haha

![Overhead shot of a beach with ocean waves crashing on a beach lined with palm trees](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xehxjezo3mnkujey70j3.jpg)

Going to hook up the database to my admin section so I can save and pull data. Been thinking about what data I need. I'll also hopefully go through more tracks. Still haven't watched an episode of "Dinosaurs" yet. haha.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube Kdq_eAqQor0 %}
Before you applaud it... Audit
Published: 2021-02-16 22:59:56

Websites can be hard to create and once it's deployed, how do you even get people to see it? That's where [web.dev](https://web.dev/) (a.k.a. Lighthouse) and [WAVE](https://wave.webaim.org/) can come in handy. Both are used to audit websites and give useful ways to improve their accessibility and discoverability.

####Auditing Example
If we enter the dev.to link, as an example, into Lighthouse we can see it comes back with four main results; Performance, Accessibility, Best Practices and SEO. Each result shows the current score and ways of how to improve each. In this case with dev.to, Accessibility and Best Practices came back with the highest scores of 100, while SEO resulted in a great score of 96, and Performance being the lowest at 80.

####Benefits
The auditing sites prove to be the most useful given that they will give feedback on how to improve certain areas of the site. In the case of the dev.to example above, there was one suggestion on how to improve the site's SEO to get to a score of 100 and under the Performance there were multiple ideas that could improve it's score.

If you'd like to see this demo in action or see how each category is beneficial to your website, check out this [video](https://youtu.be/Gte-K_fYAak).

Then try it out yourself on their websites.
[web.dev](https://web.dev/) [WAVE](https://wave.webaim.org/)
Por que usar HTML semântico
Tags: html, webdev
Published: 2021-02-16 22:57:27

Antigamente o papel do [HTML](https://developer.mozilla.org/pt-BR/docs/Web/HTML) era apenas estruturar documentos para a web, com a chegada do [HTML5](https://developer.mozilla.org/pt-BR/docs/Web/HTML/HTML5)  passou também a dar significado aos conteúdos através das tags semânticas.

O HTML semântico torna a estrutura de documentos para a web o mais claro tanto para programadores quanto para navegadores da web, mecanismos de pesquisa, leitores de tela, entre outras engines que processam essa informação.

## **A Importância do HTML Semântico**

Ao usar o HTML semântico, utilizamos os elementos HTML com base em seu significado, não apenas como são apresentados. Elementos como `<div>` e `<span>` não são elementos semânticos, pois não fornecem contexto para o que está dentro dessas tags. 

Se você está pensando em não fazer a estruturação semântica com a desculpa de que o usuário  não vai ver a diferença, aqui vão alguns excelentes motivos que farão você adotar o HTML semântico hoje mesmo.

### **Para o usuário**

Nos dias de hoje, a tecnologia possibilita que usuários deficientes visuais também possam acessar um site e absorver seu conteúdo através de leitores de tela.

O HTML semântico torna as páginas da web acessíveis, isso ocorre porque os leitores de tela e navegadores são capazes de interpretar melhor o código.

Ao invés deste leitor interpretar tudo como um amontoado de DIVs, ele entende toda a hierarquia do conteúdo existente entre cada parte, como cabeçalho, seções, artigos e rodapés, etc.

Então, o entendimento do usuário não visual que acessa o conteúdo do site se torna bastante acessível.

### **Para o SEO**

Os mecanismos de buscas que são responsáveis pelo ranqueamento do seu site também utilizam leitores não visuais para escanear o conteúdo da sua página.

Sem um HTML semântico os robôs não conseguem identificar com precisão a hierarquia do seu conteúdo. Nem mesmo saber qual é o conteúdo principal da sua página.

Então, sem a semântica, ele não consegue identificar a relevância do seu conteúdo lendo um cabeçalho com a mesma importância de um parágrafo.

A estruturação semântica é uma técnica de extrema relevância para os motores de busca e faz toda a diferença entre ter um site bem colocado nas pesquisas ou não.

### **Para o Programador**

Ainda temos o benefício para quem escreve o código, sim, o programador. Seja para escrever ou dar uma manutenção no site, a estruturação semântica torna o código-fonte da página mais fácil de ler, facilitando muito o trabalho desse profissional.

Ao invés de ficar procurando o fechamento das DIVs pela indentação, basta buscar pela tag de cada elemento.

## Conclusão

Agora que você já sabe a importância do que é HTML semântico, você pode começar a aprender mais sobre as tags na [documentação da mozilla](https://developer.mozilla.org/pt-BR/docs/Web/HTML/Element). É muito importante que você adote essa prática. 

Com certeza vai proporcionar mais visitas ao seu site, melhorar o seu ranqueamento junto aos motores de busca e facilitar o entendimento e manutenção no seu próprio código.
Note: Tweaking my tools
Tags: note, ruby, site
Published: 2021-02-20 01:47:03

---
title: Note: Tweaking my tools
published: true
date: 2021-02-16 22:40:03 UTC
tags: note,ruby,site
canonical_url: https://randomgeekery.org/note/2021/02/tweaking-my-tools/
---

Playing a little more with [TTY Toolkit](https://ttytoolkit.org) for the site workflow. I wanted to say I’m tightening focus, but with a `require` list like this for one tool?

```
require 'pastel'
require 'ruby-slugify'
require 'tty-editor'
require 'tty-exit'
require 'tty-logger'
require 'tty-option'
require 'tty-prompt'
require 'tty-screen'
```

"Tightening focus" would be a lie.

Anyways, it seems to function correctly. Huzzah! Now back to work.
Criando uma API SQL para Twitter com Typescript - Parte 0
Published: 2021-02-16 22:34:39

Muitas vezes precisamos cair para poder aprender uma lição, seria ótimo se aprendessemos sem errar não é mesmo? Mas não é bem assim que acontecem as coisas, mas hoje eu aprendi assim e tive a ideia de criar uma API-SQL com Typescript para consumir e retornar dados da API do Twitter.

Hoje eu recebi um email de uma seleção que estava fazendo e nela dizia "sua pontuação não é o suficiente" (na verdade tinha mais informações, mas resumidamente era isso). Eu pequei no teste técnico e em dois pontos:

1. O meu desafio de código não passou em 2 testes de 10;
2. O desafio de SQL eu falhei (SQL sempre foi meu tendão de aquiles, sempre me mantive no básico e uso muito ORM)

Bom, agora que eu sei o que trabalhar de certa forma decidi montar uma API que irá receber comandos SQL e irá receber dados. Com isso eu irei focar mais na meu SQL e também nos meus códigos, além de colocar de bônus o aprendizado de typescript que veio postergando a muito tempo.

Os motivos pelo qual decidi fazer esse projeto envolvem:

1. Aprender Typescript, já que trabalhei com Java e quero ampliar meus conhecimentos do ecossitema Javascript/Node.js;
2. Melhorar meus conhecimentos em SQL, já que terei que traduzir os comandos de maneira que a API oficial do Twitter entenda;
3. Melhorar meus conhecimentos em testes com Node.js;
4. Ser meu primeiro projeto para a comunidade e começar a retribuir o quanto eu já aprendi com muitas pessoas;

Caso você queira acompanhar o projeto, estarei documentado em artigos em portugês aqui no Dev.to. O repositório se encontra aqui [aqui no github](https://github.com/augustoasilva/twit-sql) e por hora está vazio pois acabei de criá-lo enquanto estou criando esse artigo.

Ainda estou montando o projeto e o estruturando, caso queira deixar sua contribuição já pode deixar um comentário aqui ou então pode deixar como uma [issue no github](https://github.com/augustoasilva/twit-sql/issues) que também verei lá.

De já é isso, e até breve com mais atualizações sobre essa empreitada que dei o primeiro passo.

> "Engenharia: onde os nobres semi-hábeis trabalhadores executam a visão daqueles que imaginam e sonham. Olá, Ooompa-Loompas da ciência."
> _Sheldon Cooper_