Skip to content

Instantly share code, notes, and snippets.

🍡 ☕️ 🍰 ☕️ ☕️ ☕️ ☕️

akira yamada arika

🍡 ☕️ 🍰 ☕️ ☕️ ☕️ ☕️
Block or report user

Report or block arika

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@arika
arika / Dockerfile
Last active Apr 29, 2020
mrubyのLinux/macOS向けクロスビルドのためのDockerfile(素のmrubyをビルドするだけならcurlとlibssl-devはたぶんいらない)
View Dockerfile
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 \
@arika
arika / Rakefile
Created Apr 28, 2020
mrbgemのためのRakefile
View Rakefile
# 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
# frozen-string-literal: true
require "ostruct"
require "open3"
# 小さなコマンドをテストするためのヘルパーモジュール
#
# 内部で他のコマンドを呼び出すのが主となる10〜20行程度の小さなシェルスクリプト
# やRubyなどのスクリプトを主なテスト対象とする。
#
View rubocop-daemon-wrapper.rb
#!/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)
@arika
arika / bm_read_lines.rb
Last active Oct 13, 2019
benchmark read lines and scan lines
View bm_read_lines.rb
# 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
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
# frozen_string_literal: true
require 'yaml'
require 'json'
require 'tempfile'
if ARGV.include?('-h') || ARGV.include?('--help')
<<~HELP.display
Usage: #{$0} [-r extension ...] [-- targets...]
@arika
arika / test_unit_profiling_for_rails.rb
Last active Nov 29, 2018
Test::Unitのtestやsetup/cleanup/teardownのプロファイルをとる(Rails編)
View test_unit_profiling_for_rails.rb
# 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
require 'ostruct'
require 'anbt-sql-formatter/formatter'
module PrettyPrintSql
module ActiveRecord
def ppsql
to_sql.tap {|sql| ::PrettyPrintSql.pp(sql) }
end
end
@arika
arika / .spring.rb
Last active Aug 3, 2018
auto stop spring server
View .spring.rb
module DotSpringRb
MONITOR_INTERVAL = 10*60
SERVER_KEEP_PERIOD = 30*60
module_function
def env
@env ||= Spring::Env.new
end
You can’t perform that action at this time.