View groonga_rails_log.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# frozen_string_literal: true | |
require 'rroonga' | |
require_relative 'select_rails_log' if $0 == __FILE__ | |
class GroongaIndex | |
REFERENCE_COLUMNS = { | |
http_status: 'HttpStatuses', | |
http_method: 'HttpMethods', |
View Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:buster | |
ENV OSX_CROSS_PATH=/osxcross | |
COPY --from=dockercore/golang-cross:1.13.10 "${OSX_CROSS_PATH}/." "${OSX_CROSS_PATH}/" | |
ARG DEBIAN_FRONTEND=noninteractive | |
RUN apt-get update -qq && apt-get install -y -q --no-install-recommends \ | |
bison \ | |
clang \ | |
curl \ |
View Rakefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen-string-literal: true | |
vendor_dir = "#{__dir__}/vendor" | |
ENV['MRUBY_ROOT'] = "#{vendor_dir}/mruby" | |
ENV['MRUBY_CONFIG'] = "#{__dir__}/build_config.rb" | |
namespace :mruby do | |
if ENV['LOAD_MRUBY_RAKEFILE'] | |
load "#{ENV['MRUBY_ROOT']}/Rakefile" | |
else |
View run_command_with_external_command_stubs.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require 'ostruct' | |
require 'open3' | |
require 'shellwords' | |
# 小さなコマンドをテストするためのヘルパーモジュール | |
# | |
# 内部で他のコマンドを呼び出すのが主となる10〜20行程度の小さなシェルスクリプト | |
# やRubyなどのスクリプトを主なテスト対象とする。 |
View rubocop-daemon-wrapper.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# rubocop-daemon-wrapper.rb | |
require 'rubygems' | |
if $0 == __FILE__ | |
bin_dir = Gem::Specification.find_by_name('rubocop-daemon')&.bin_dir | |
abort 'rubocop-daemon.gem not found' unless bin_dir | |
ENV['RUBYOPT'] = "-r #{File.expand_path(__FILE__).sub(/\.rb\z/, '')}" | |
exec(File.join(bin_dir, '../bin/rubocop-daemon-wrapper'), *ARGV) |
View bm_read_lines.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require "benchmark" | |
require "strscan" | |
def open_file(filename = "development.log") | |
File.open(filename, "r") do |io| | |
yield io | |
end | |
end |
View auto_correct.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "yaml" | |
require "json" | |
require "tempfile" | |
module RuboCopAutoCollrect | |
class << self | |
def run_all!(targets, *cop_names, commit_log_format:, fixup_commit_log_format:) | |
plan(targets, *cop_names).each do |cop_name| | |
run!(targets, cop_name, commit_log_format: commit_log_format) | |
end |
View start_rubocop.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require 'yaml' | |
require 'json' | |
require 'tempfile' | |
if ARGV.include?('-h') || ARGV.include?('--help') | |
<<~HELP.display | |
Usage: #{$0} [-r extension ...] [-- targets...] |
View test_unit_profiling_for_rails.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test/test_helper.rbに書く | |
module TestProfiling | |
module TestCase | |
def run(result) | |
data = { | |
name: method_name, | |
owner_name: self.class.name, | |
source_location: method(method_name).source_location, | |
passed: passed?, |
View pretty_print_sql.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ostruct' | |
require 'anbt-sql-formatter/formatter' | |
module PrettyPrintSql | |
module ActiveRecord | |
def ppsql | |
to_sql.tap {|sql| ::PrettyPrintSql.pp(sql) } | |
end | |
end |
NewerOlder