Skip to content

Instantly share code, notes, and snippets.

@yahonda
yahonda / ruby31onrails.md
Last active April 9, 2024 20:46
Ruby 3.1 on Rails

Ruby 3.1 on Rails

Actions required to use Ruby 3.1.0 with Rails

Rails 7.0.Z

  • Rails 7.0.1 is compatible with Ruby 3.1.0.
  • Rails 7.0.1 addes net-smtp, net-imap and net-pop gems as Action Mailbox and Action Mailer dependency, you do not need to add them explicitly in your application Gemfile anymore.
  • thor 1.2.1 has been released. You will not see DidYouMean::SPELL_CHECKERS.merge deprecate warnings anymore.

Rails 6.1.Z

  • Use Rails 6.1.5 to support database.yml with aliases and secrets.yml with aliases.
@kakutani
kakutani / ruby-jp-for-rubyistist.md
Last active September 28, 2022 02:04
Rubyist-istのためのruby-jpチャンネルガイド

Rubyist-istのためのruby-jpチャンネルガイド

ruby-jpには大量にチャンネルがあります。 rubyist-istの観点から少し整理してみました。

Rubyistの集まりに関するチャンネル

  • [#regional_rb][0]: 地域のRubyist同士の集まり(ミートアップ)に関する話題が中心
  • [#rubykaigi][1]: RubyKaigiの話題
  • [#rubyworld-conference][2]: 毎年11月に松江で開催されるRubyWorld Conferenceの話題

https://zverok.space/blog/2022-03-03-WAR.html 翻訳

ハリコフのRubyistからRubyコミュニティへのお願い

2022年3月3日

やぁ、僕はVictor Shepelev。ウクライナのハリコフに住んでいて、TwitterGitHubでは@zverokというIDで活動している。

僕がRubyを書き始めたのは2003年からで、いくつかのライブラリやRuby Changelogのメンテナだ。国際的なカンファレンスや/r/rubyなんかで君たちと会ったことがあるかも知れない。今年、僕はRubyコミッターに申請して、嬉しいことに承認された。僕が取り組んでいるのは(いくつかの小さな機能追加と共に)Rubyドキュメントの改善だ。僕のRubyに関する作業の一覧はここで確認できる

@willnet
willnet / should_have_length_validations.rb
Last active May 13, 2022 02:42
string型もしくはtext型なのに最大長のバリデーションをかけていないものを出力するスクリプト
ActiveRecord::Base.descendants.reject(&:abstract_class?).each do |model|
string_or_text_columns = model.columns.select { |column| column.type == :string || column.type == :text }
columns_with_maximum_length_validation = model.validators.select {|v| v.is_a? ActiveRecord::Validations::LengthValidator }.select {|v| v.options[:maximum] || v.options[:within] }.map(&:attributes).flatten.uniq
string_or_text_columns.each do |column|
if columns_with_maximum_length_validation.include?(column.name.to_sym)
puts "#{model.name}##{column.name} is OK"
else
puts "#{model.name}##{column.name} is NG"
end
end
@makoto
makoto / gist:4018340
Created November 5, 2012 17:05 — forked from seki/gist:4010665
dRubyConf draft

dRubyConf 2012 参戦日記

こんにちは。「RubyConf参加支援企画プログラム」に採択していただき、デンバーまで行ってきた井上といいます。

今回は私がアメリカのカンファレンスで発表するまでの道のりと、dRubyの作者である関将俊さん(以下「咳」さん)と一緒に聞いてきた他のトークの概要を紹介していきたいと思います。

ちなみに私たちはdRubyに関連するような並列、並行プログラミングやデータベースのトークを中心に参加したので、このカンファレンスは「dRubyConference」という視点で見ていきます。

応募するまでの道のり

@mattscilipoti
mattscilipoti / log_slow_queries.rb
Created February 20, 2011 05:10
Rails3: Log slow queries.
# see: http://weblog.therealadam.com/2011/02/12/simple-ruby-pleasures/comment-page-1/#comment-315
class QueryTracer < ActiveSupport::LogSubscriber
ACCEPT = %r{^(app|config|lib)}.freeze
FRAMES = 5
THRESHOLD = 300 # In ms
def sql(event)
return unless event.duration > THRESHOLD
@udzura
udzura / kuniaki.rb.md
Last active December 27, 2015 01:49
kuniaki.rb 漫談原稿

paperboy&co. に入社して10日が経ったが俺はもう限界かもしれない(仮)

こんにちは

  • @udzura
  • ちょっと前までエーミングでC#を書いてました

igaigaさん

@jugyo
jugyo / to_factory_girl.rb
Created November 7, 2012 05:54
ActiveRecord extension to print FactoryGirl definition!
class ActiveRecord::Base
# Usage:
#
# > puts User.first.to_factory_girl
# FactoryGirl.define do
# factory :user do
# ...
# end
# end
# # Usage: FactoryGirl.create(:user, ...)
@jugyo
jugyo / locale.rake
Created February 23, 2011 06:57
print translations
namespace :locale do
desc "print translations"
task :translations => :environment do
printer = lambda { |hash_or_string, keys = []|
case hash_or_string
when String
puts "#{keys.join('.')} => #{hash_or_string.inspect}"
when Hash
hash_or_string.keys.sort.each do |key|
value = hash_or_string[key]
gem 'rails3-generators'
gem 'mongoid', '>= 2.0.0.beta'
gem 'bson_ext'
gem 'haml'
gem 'hirb', :group => :development
gem 'what_methods', :group => :development
gem 'rspec-rails', '>= 2.0.0.beta', :group => :test
gem 'rr', :group => :test