1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-17 05:58:01 +00:00

Compare commits

...

2 Commits

Author SHA1 Message Date
jbranchaud
a61a22f707 Add Configure Different Host And Container Ports as a Docker TIL 2024-02-24 12:44:23 -06:00
jbranchaud
fe8d06b94a Add Pop Open The Quick Fix Window as a VS Code TIL 2024-02-24 11:29:24 -06:00
3 changed files with 62 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
_1374 TILs and counting..._
_1376 TILs and counting..._
---
@@ -24,6 +24,7 @@ _1374 TILs and counting..._
* [CSS](#css)
* [Deno](#deno)
* [Devops](#devops)
* [Docker](#docker)
* [Elixir](#elixir)
* [Gatsby](#gatsby)
* [Git](#git)
@@ -184,6 +185,10 @@ _1374 TILs and counting..._
- [SSL Certificates Can Cover Multiple Domains](devops/ssl-certificates-can-cover-multiple-domains.md)
- [Wipe A Heroku Postgres Database](devops/wipe-a-heroku-postgres-database.md)
### Docker
- [Configure Different Host And Container Ports](docker/configure-different-host-and-container-ports.md)
### Elixir
- [All Values For A Key In A Keyword List](elixir/all-values-for-a-key-in-a-keyword-list.md)
@@ -1576,6 +1581,7 @@ _1374 TILs and counting..._
- [Advance Through Search Results](vscode/advance-through-search-results.md)
- [Enable Breadcrumbs For Version 1.26 Release](vscode/enable-breadcrumbs-for-version-126-release.md)
- [Open An Integrated Terminal Window](vscode/open-an-integrated-terminal-window.md)
- [Pop Open The Quick Fix Window](vscode/pop-open-the-quick-fix-window.md)
- [Step Through Project-Wide Search Results](vscode/step-through-project-wide-search-results.md)
- [Toggle Between Terminals](vscode/toggle-between-terminals.md)

View File

@@ -0,0 +1,34 @@
# Configure Different Host And Container Ports
A `docker-compose.yml` file that sets up something like a PostgreSQL service
will proxy a port from your host machine to a port on the docker container.
A basic PostgreSQL service will look like this tying `5432` to `5432` under the
`ports` section.
```yaml
version: "3.7"
services:
postgres:
image: postgres:latest
restart: always
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=postgres
ports:
- "5432:5432"
volumes:
- ./postgres-data:/var/lib/postgresql/data
```
Requests like queries from a `psql` instance that we send to `localhost:5432`
will be proxied to `docker-container:5432`.
Since those numbers are the same on both sides, it's not necessarily clear
which is which. The left is the _host_ and the right is the _container_ --
`[host-port]:[container-port]`.
If you need to use a port other than 5432 on your host machine (e.g. maybe
you're running multiple Postgres servers at once), then you can just change the
port number on the left side. How about `9876:5432`.

View File

@@ -0,0 +1,21 @@
# Pop Open The Quick Fix Window
Often when I see a red squiggly in VS Code, it is because I'm missing an import
for entity in my code. I have a couple options.
1. I could scroll to the top of the file and manually add the import to my list
of imports.
2. I can mouse over the offending function to see the error, carefully mouse
over to _Quick Fix_ link, and get at the quick fix list that way.
There is a better third way.
Once my cursor (not the just the mouse pointer) is on the offending item, I can
hit `Cmd+.`. That directly pops open the Quick Fix window with focus on the
first item in that window. I can navigate to the fix I want and hit enter.
Another thing to keep in mind. As you're typing out an un-imported entity, if
VS Code knows about it, it will show it as an auto-complete option with the
package it comes from. If you tab-out the one you want, not only will it fill
in the rest of the entity name, but it will also auto-add the import at the top
of your file.