I hereby claim:
- I am vittorius on github.
- I am vittoriuz (https://keybase.io/vittoriuz) on keybase.
- I have a public key ASACfV2YrUfvU5LBh9ZX-VGs1_ASxH6C2tdRHJEsZVC7RQo
To claim this, I am signing this object:
class Time | |
TZ_ABBREVIATION_MAP = ActiveSupport::TimeZone.all.each_with_object({}) do |tz, hash| | |
[tz.tzinfo.current_period.start_transition, tz.tzinfo.current_period.end_transition].each do |transition| | |
hash.merge!(transition.offset.abbreviation.to_s => tz.tzinfo.name) if transition.present? | |
end | |
end.merge('UTC' => 'Etc/UTC').freeze | |
class << self | |
def tz_name_for(time_like) | |
TZ_ABBREVIATION_MAP[time_like.zone] |
RSpec.configure do |config| | |
# ... | |
config.prepend( | |
Module.new do | |
%i[get post patch put delete head].each do |method| | |
params_snippet = method.in?(%i[post patch put]) ? "args[:params] = args[:params].to_json" : "" | |
module_eval <<~RUBY, __FILE__, __LINE__ + 1 | |
def #{method}(path, **args) | |
if args.present? && args.values.none? { |v| v.is_a?(Rack::Test::UploadedFile) } |
--format RspecFlatErrorFormatter | |
--color | |
--require spec_helper |
ActiveRecord::Base.connection.tables.reject { |t| %w[schema_migrations ar_internal_metadata].include?(t) }.each { |t| ActiveRecord::Base.connection.execute("TRUNCATE #{t} CASCADE;") } |
class MyFormatter | |
include ActiveSupport::TaggedLogging::Formatter # to get modified call that collects and prints your tags | |
# define any custom logic in your formatter | |
def call(...) | |
end | |
end |
I hereby claim:
To claim this, I am signing this object:
# frozen_string_literal: true | |
require 'rails_helper' | |
# Haskell: result = operation_1 >>= operation_2 >>= operation_3 | |
# Ruby: result = a&.b&.c | |
# JS: result = a?.b?.c | |
describe 'monads' do | |
describe 'Result' do |
# frozen_string_literal: true | |
# The default Ruumba::RakeTask is pretty fragile, so we're going a simpler way | |
namespace :dev do | |
desc 'Run ruumba linter on app/views' | |
# rubocop:disable Rails/RakeEnvironment | |
task :ruumba, :path do |_t, args| | |
sh "bundle exec ruumba -c .ruumba.yml -e --force-exclusion '#{args.path || 'app/views'}'" do |ok| | |
puts 'Ruumba has detected some offenses' unless ok | |
end |
puts ActiveRecord::Base.connection.exec_query("SELECT nspname AS schemaname,relname,reltuples FROM pg_class C LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) WHERE nspname NOT IN ('pg_catalog', 'information_schema') AND relkind='r' ORDER BY reltuples DESC;").rows.map { |row| "#{row.first}\t#{row.second}\t#{row.third}" } |