The v query params shows the heading in the response
GET /_cat/indices?v
GET /_cat/indices/profiles*?v
| require 'bundler/inline' | |
| gemfile(true) do | |
| source 'https://rubygems.org' | |
| gem 'sqlite3', '~> 1.4' | |
| gem 'activerecord', '7.1.3.4' | |
| end | |
| require 'sqlite3' |
| -- this groups by 5 to keep the length down | |
| select length(username) as length, | |
| count(*) as count, | |
| repeat('*'::text, (COUNT(length(username))::int / 5) + 1) AS histogram | |
| from users | |
| where username is not null | |
| group by length(username) | |
| order by length; |
| -- List all Foreign Keys | |
| select kcu.table_schema || '.' ||kcu.table_name as foreign_table, | |
| '>-' as rel, | |
| rel_tco.table_schema || '.' || rel_tco.table_name as primary_table, | |
| string_agg(kcu.column_name, ', ') as fk_columns, | |
| kcu.constraint_name | |
| from information_schema.table_constraints tco | |
| join information_schema.key_column_usage kcu | |
| on tco.constraint_schema = kcu.constraint_schema | |
| and tco.constraint_name = kcu.constraint_name |
| class Payment | |
| def process(gateway) | |
| gateway.verify(self) # duck typed. | |
| end | |
| end | |
| class PaymentTest | |
| def test_process | |
| payment = Payment.new | |
| payment.process(MockGatway.new) |
| # config/initialers/generators.rb | |
| # This config will not generate the following: | |
| # - per model view helpers, or stylesheets | |
| # - scaffold.scss | |
| # - jbuilder templates, which I only occasionally use | |
| # - controller tests, which I don't really use. I do system tests instead. | |
| Rails.application.config.generators do |g| |
| # frozen_string_literal: true | |
| module UsesTempfile | |
| def with_tempfile(name: 'temp-zip-file', temp_dir: Rails.root.join('tmp').to_s, binmode: false) | |
| tempfile = Tempfile.new('temp-zip-file', temp_dir) | |
| tempfile.binmode if binmode | |
| yield tempfile | |
| ensure | |
| tempfile.close |