---
title: 'This week in #dev (Aug 18, 2023)'
teaser: 'Caching HTTP responses forever, a fix for when your terminal is acting weird,
  and more!

  '
tags: this week in dev,git,rails,http,terminal,communication
author: thoughtbot
published_on: 2023-08-28
---

Welcome to another edition of [This Week
in #dev](https://thoughtbot.com/blog/tags/this-week-in-dev), a series of posts
where we bring some of our most interesting Slack conversations to the public.

## The Autostash Option in Git Pull

[Mike Burns][mburns] explained the `--autostash` and `--no-autostash` options in
[`git-pull(1)`]. These options allow you to automatically create a temporary stash
entry before the operation begins and apply it after the operation ends.
However, caution should be exercised as conflicts may arise during the final
stash application after a successful merge.

[mburns]: https://thoughtbot.com/blog/authors/mike-burns
[`git-pull(1)`]: https://git-scm.com/docs/git-pull

## Caching HTTP Responses Forever

[Steve Polito][spolito] learned about Rails' [`http_cache_forever`] helper method
for caching HTTP responses indefinitely. He gives an example of using it for a
static page that never changes:

```rb
class HomeController < ApplicationController
  def index
    http_cache_forever(public: true) do
      render
    end
  end
end
```

[spolito]: https://thoughtbot.com/blog/authors/steve-polito
[`http_cache_forever`]: https://api.rubyonrails.org/classes/ActionController/ConditionalGet.html#method-i-http_cache_forever

## Is Your Terminal Acting Weird?

[Sara Jackson][csara] suggested using the `stty sane` command to quickly reset
your terminal settings if it is not registering enters or tabs correctly.
Accidental key presses or other factors may cause this issue.

<aside class="warn">
  <p>
    If you want to avoid ableist language, you can add an alias to your shell like
    <code>alias resettings="stty sane"</code>, added
    <a href="https://thoughtbot.com/blog/authors/louis-antonopoulos">Louis</a>.
  </p>
</aside>

[csara]: https://thoughtbot.com/blog/authors/sara-jackson

## Boost Your Efficiency with Bash Macros

[Summer ☀️] shares a tip about adding text-expansion shortcuts
("macros") in the Bash prompt. For example, create a `~/.inputrc`
file with the contents `"\C-b": "bundle exec "`. After quitting the current
shell session and starting a new one, hitting <kbd>Ctrl+B</kbd> will type
`bundle exec`!

Note that the example above will add the shortcut to many other prompts/REPLs
too, such as IRB, Python, psql etc. For this reason, they recommended
surrounding the macros with a conditional:

```bash
$if Bash
	"\C-b": "bundle exec "
$endif

$if Ruby
	"\C-b": "beep boop"
$endif
```

For more info, check out the [Readline user guide].

[Summer ☀️]: https://thoughtbot.com/blog/authors/summer
[Readline user guide]: https://tiswww.case.edu/php/chet/readline/rluserman.html#Readline-Init-File

## Introducing ASCIIflow: A Visual Tool for Clear Communication

[Aji][aji] introduces [ASCIIflow] as one of their favorite tools. ASCIIflow is a
chart-making tool that can be included in commit messages. Here's an example:

```
     ┌────────────────────────┐
     ▼                        │
┌──────────┐   ┌───────────┐  │  ┌────────────┐
│  Intake  │   │  Payment  │  │  │  Bill      │
├──────────┤   ├───────────┤  │  ├────────────┤
│  id      │   │  payable  │  └──┤  billable  │
└──────────┘   └─────┬─────┘     │  type      │
      ▲              │           └────────────┘
      │              │                 ▲
      └──────────────┴─────────────────┘
               through :payable
```

[aji]: https://thoughtbot.com/blog/authors/aji-slater
[ASCIIflow]: https://asciiflow.com

## Thanks

This edition was brought to you by [Aji][aji], [Mike Burns][mburns], [Sara
Jackson][csara], [Steve Polito][spolito], and [Summer ☀️]. Thanks to
all contributors! 🎉
