Skip to content

Instantly share code, notes, and snippets.

View jwg2s's full-sized avatar

John Gerhardt jwg2s

View GitHub Profile
# Find all tables and when they were last vacuumed/analyzed, either manually or automatically
SELECT relname,
last_vacuum,
last_autovacuum,
last_analyze,
last_autoanalyze
FROM pg_stat_all_tables
WHERE schemaname = 'public'
ORDER BY last_vacuum DESC;
@jwg2s
jwg2s / spec.rb
Last active December 18, 2021 14:26
No Focus Trues in Source
it 'should ensure we have no extra focus true exist' do
files = Dir.glob(File.join(Rails.root, 'spec', '**', '*_spec.rb'))
count = 0
files.each do |file|
unless File.readlines(file).grep(/focus['"]?\s*[\:=][>]?\s*true/).empty?
puts "#{file} has focus true!"
count = count + 1
end
end
count.should == 0
require 'benchmark'
def count_factors(number)
factors = (1..number).select { |n| (number % n).zero? }
factors.count
end
def print_doors(n)
i = 0
array = (1..n)