This week in #dev (Oct 20, 2023)

thoughtbot
Edited by Matheus Richard

Welcome to another edition of This Week in #dev, a series of posts where we bring some of our most interesting Slack conversations to the public. Let’s get to it!

Text Alignment in Markdown Tables

Neil Carvalho discovered that Markdown tables can support text alignment. By using a leading or trailing colon, you can indicate left, right, or center alignment.

| Country       | Population    |
| ------------- | ------------: |
| China         | 1,371,220,000 |
| India         | 1,296,834,042 |
| United States | 329,256,465   |

The above table will render as:

Country Population
China 1,371,220,000
India 1,296,834,042
United States 329,256,465

Need Country Information? Ruby’s Got You Covered

Matheus Richard recommends the countries gem for obtaining various information about countries. The gem includes details such as the country local name, currency, spoken languages, subdivisions, and timezones.

Repeating Commands in ZSH

Neil also shares how to easily repeat the same command multiple times in zsh.

repeat TIMES { command }

So, for example, if you wanted to run a test 10 times, you could do:

repeat 10 { bin/rspec spec/system/my_spec.rb }

Louis also points out that if you want to save the output to a file, but also watch it in real-time, you can use tee`:

repeat 10 { bin/rspec spec/system/my_spec.rb } | tee somefilename.txt

Thanks

This edition was brought to you by Louis Antonopoulos, Matheus Richard, and Neil Carvalho. Thanks to all contributors! 🎉