1
0
mirror of https://github.com/jbranchaud/til synced 2026-03-05 07:28:46 +00:00

Compare commits

...

5 Commits

Author SHA1 Message Date
Nicholas Wilson
f64c5835ec Merge 5615da920f into e2a8e815e9 2025-01-20 14:12:31 -05:00
jbranchaud
e2a8e815e9 Add Inspect Configuration Of Database Connection as a Rails TIL 2025-01-20 10:06:13 -06:00
jbranchaud
c61ddcb326 Add Temporarily Hide CleanShot X Capture Previews as a Workflow TIL 2025-01-19 13:56:45 -06:00
Bob Conan
5615da920f Update README.md, fix typos 2024-11-15 16:16:31 -06:00
BobConanDev
c60c63f554 Updated README.md, fix typo(s) 2024-11-15 16:42:57 -05:00
3 changed files with 64 additions and 3 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). For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
_1567 TILs and counting..._ _1569 TILs and counting..._
See some of the other learning resources I work on: See some of the other learning resources I work on:
- [Ruby Operator Lookup](https://www.visualmode.dev/ruby-operators) - [Ruby Operator Lookup](https://www.visualmode.dev/ruby-operators)
@@ -195,7 +195,7 @@ See some of the other learning resources I work on:
- [Aliasing An Ansible Host](devops/aliasing-an-ansible-host.md) - [Aliasing An Ansible Host](devops/aliasing-an-ansible-host.md)
- [Allow Cross-Origin Requests To Include Cookies](devops/allow-cross-origin-requests-to-include-cookies.md) - [Allow Cross-Origin Requests To Include Cookies](devops/allow-cross-origin-requests-to-include-cookies.md)
- [Allow HTTPS Through Your UFW Firewall](devops/allow-https-through-your-ufw-firewall.md) - [Allow HTTPS Through Your UFW Firewall](devops/allow-https-through-your-ufw-firewall.md)
- [Check For Cached Site Assocation File For iOS](devops/check-for-cached-site-association-file-for-ios.md) - [Check For Cached Site Association File For iOS](devops/check-for-cached-site-association-file-for-ios.md)
- [Check The Status of All Services](devops/check-the-status-of-all-services.md) - [Check The Status of All Services](devops/check-the-status-of-all-services.md)
- [Check The Syntax Of nginx Files](devops/check-the-syntax-of-nginx-files.md) - [Check The Syntax Of nginx Files](devops/check-the-syntax-of-nginx-files.md)
- [Connect To An RDS PostgreSQL Database](devops/connect-to-an-rds-postgresql-database.md) - [Connect To An RDS PostgreSQL Database](devops/connect-to-an-rds-postgresql-database.md)
@@ -764,7 +764,7 @@ See some of the other learning resources I work on:
- [Check If Clusters Are Upgrade Compatible](postgres/check-if-clusters-are-upgrade-compatible.md) - [Check If Clusters Are Upgrade Compatible](postgres/check-if-clusters-are-upgrade-compatible.md)
- [Check If The Local Server Is Running](postgres/check-if-the-local-server-is-running.md) - [Check If The Local Server Is Running](postgres/check-if-the-local-server-is-running.md)
- [Check If User Role Exists For Database](postgres/check-if-user-role-exists-for-database.md) - [Check If User Role Exists For Database](postgres/check-if-user-role-exists-for-database.md)
- [Check Table For Any Oprhaned Records](postgres/check-table-for-any-orphaned-records.md) - [Check Table For Any Orphaned Records](postgres/check-table-for-any-orphaned-records.md)
- [Checking Inequality](postgres/checking-inequality.md) - [Checking Inequality](postgres/checking-inequality.md)
- [Checking The Type Of A Value](postgres/checking-the-type-of-a-value.md) - [Checking The Type Of A Value](postgres/checking-the-type-of-a-value.md)
- [Clear The Screen In psql](postgres/clear-the-screen-in-psql.md) - [Clear The Screen In psql](postgres/clear-the-screen-in-psql.md)
@@ -1009,6 +1009,7 @@ See some of the other learning resources I work on:
- [Hash Slicing](rails/hash-slicing.md) - [Hash Slicing](rails/hash-slicing.md)
- [Ignore Poltergeist JavaScript Errors](rails/ignore-poltergeist-javascript-errors.md) - [Ignore Poltergeist JavaScript Errors](rails/ignore-poltergeist-javascript-errors.md)
- [Include Devise Helpers In Your Controller Tests](rails/include-devise-helpers-in-your-controller-tests.md) - [Include Devise Helpers In Your Controller Tests](rails/include-devise-helpers-in-your-controller-tests.md)
- [Inspect Configuration Of Database Connection](rails/inspect-configuration-of-database-connection.md)
- [Inspect Previous Changes To ActiveRecord Object](rails/inspect-previous-changes-to-activerecord-object.md) - [Inspect Previous Changes To ActiveRecord Object](rails/inspect-previous-changes-to-activerecord-object.md)
- [Link To The Current Page With Query Params](rails/link-to-the-current-page-with-query-params.md) - [Link To The Current Page With Query Params](rails/link-to-the-current-page-with-query-params.md)
- [List All Installable Rails Versions](rails/list-all-installable-rails-versions.md) - [List All Installable Rails Versions](rails/list-all-installable-rails-versions.md)
@@ -1825,6 +1826,7 @@ See some of the other learning resources I work on:
- [Send A Message To A Discord Channel](workflow/send-a-message-to-a-discord-channel.md) - [Send A Message To A Discord Channel](workflow/send-a-message-to-a-discord-channel.md)
- [Set Recurring Reminders In Slack](workflow/set-recurring-reminders-in-slack.md) - [Set Recurring Reminders In Slack](workflow/set-recurring-reminders-in-slack.md)
- [Show Linting Errors In Zed](workflow/show-linting-errors-in-zed.md) - [Show Linting Errors In Zed](workflow/show-linting-errors-in-zed.md)
- [Temporarily Hide CleanShot X Capture Previews](workflow/temporarily-hide-cleanshot-x-capture-previews.md)
- [Toggle Between Stories In Storybook](workflow/toggle-between-stories-in-storybook.md) - [Toggle Between Stories In Storybook](workflow/toggle-between-stories-in-storybook.md)
- [Update asdf Plugins With Latest Package Versions](workflow/update-asdf-plugins-with-latest-package-versions.md) - [Update asdf Plugins With Latest Package Versions](workflow/update-asdf-plugins-with-latest-package-versions.md)
- [View The PR For The Current GitHub Branch](workflow/view-the-pr-for-the-current-github-branch.md) - [View The PR For The Current GitHub Branch](workflow/view-the-pr-for-the-current-github-branch.md)

View File

@@ -0,0 +1,45 @@
# Inspect Configuration Of Database Connection
There are a lot of factors that can effect the database configuration values.
- What are the settings in each environment in `config/database.yml`?
- Is there any dynamic ERB code in `config/database.yml`?
- Is `DATABASE_URL` set in the current environment?
- Is any other code overriding these settings?
To check the current _configuration hash_ for the database connection at
runtime, we can run the following statement:
```ruby
> ActiveRecord::Base.connection.pool.db_config.configuration_hash
=>
{:adapter=>"postgresql",
:encoding=>"unicode",
:host=>"::1",
:user=>"postgres",
:password=>"postgres",
:pool=>5,
:database=>"still_development",
:port=>9875}
```
In this case, I'm running the statement from the Rails console of my app's
development environment.
I could even access and print these values as part of debugging in a production
environment with a rake task:
```ruby
# In lib/tasks/debug.rake
namespace :debug do
task :db_config => :environment do
puts "==== Database Configuration Debug ===="
puts "DATABASE_URL: #{ENV['DATABASE_URL']}"
puts "Active Record Config: #{ActiveRecord::Base.connection.pool.db_config.configuration_hash}"
puts "Raw ENV dump:"
ENV.sort.each { |k,v| puts "#{k}: #{v}" if k.include?('DB') || k.include?('DATABASE') }
end
end
```
[source](https://api.rubyonrails.org/classes/ActiveRecord/DatabaseConfigurations/HashConfig.html)

View File

@@ -0,0 +1,14 @@
# Temporarily Hide CleanShot X Capture Previews
The _capture previews_ that CleanShot X provides are a useful part of my
workflow. I often capture a screenshot or recording a bit in advance of needing
to add it as, say, an attachment. The preview icons float off to the right of
my screen, generally out of the way. As soon as I need them, I can annotate,
drag-n-drop, etc.
Sometimes, however, they do get in the way. But I'm not ready to dismiss them
and I don't want to save them off to some folder buried in my file system.
To temporarily slide the capture previews down off the screen, I can hit the
shortcut `Ctrl+Opt+Cmd+H`. The arrow at the butto of the screen can be clicked
to unhide them, or I can hit the same shortcut sequence to reveal them.