Skip to content

Instantly share code, notes, and snippets.

Avatar

John Gerhardt jwg2s

View GitHub Profile
View bloat-analysis.sql
# 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 Dec 27, 2015
No Focus Trues in Source
View spec.rb
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
View doors.rb
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)
You can’t perform that action at this time.