Skip to content

Instantly share code, notes, and snippets.

View taketo1113's full-sized avatar

Taketo Takashima taketo1113

View GitHub Profile
@taketo1113
taketo1113 / README.md
Last active September 21, 2026 15:00
Ruby: Addrinfo and IPAddr IP Address Classification

Ruby: Addrinfo and IPAddr IP Address Classification

This is a comparison of IP address classification behavior between Addrinfo and IPAddr.

The tests are based on the IP address classification tests in IPAddr and verify whether the corresponding Addrinfo methods produce the same results.

Test Cases

The test cases are based on the corresponding tests in the Ruby ipaddr repository.

@taketo1113
taketo1113 / man ping6
Created February 7, 2025 15:06
man ping6 (macOS 15.3 / Darwin Kernel Version 24.3.0)
PING6(8) System Manager's Manual PING6(8)
NAME
ping6 – send ICMPv6 ECHO_REQUEST packets to network hosts
SYNOPSIS
ping6 [-CDdfHmnNoqtvwW] [-a addrtype] [-b bufsiz] [-B boundif] [-c count]
[-G sweepmaxsize[,sweepminsize[,sweepincrsize]]] [-g gateway]
[-G sweep] [-h hoplimit] [-I interface] [-i wait] [-k trafficclass]
[-K netservicetype] [-l preload] [-P policy] [-p pattern]
@taketo1113
taketo1113 / ERROR: Failed to build gem native extension.md
Last active November 2, 2024 13:56
ERROR: Failed to build gem native extension (macOS 14.7 / ruby-build 20240917)

ERROR: Failed to build gem native extension

Environment

  • Mac mini (Apple M1)
  • OS: macOS 14.7
  • ruby: ruby 3.3.4 (2024-07-09 revision be1089c8ec) [arm64-darwin23]
  • ruby-build: ruby-build 20240917 (homebrew)

Error Details: gem install

# Gemfile
@taketo1113
taketo1113 / Benchmark OpenStruct.md
Last active September 7, 2024 07:56
Benchmark OpenStruct (ostruct)

Benchmark OpenStruct (ostruct)

It is benchmarks about OpenStruct.

The ostruct gem warn bellow message with Warning[:performance] = true

OpenStruct use is discouraged for performance reasons

ruby/ostruct#56

Benchmark Env

  • Mac mini (Apple M1)
@taketo1113
taketo1113 / README: Output csv file with Shift JIS.md
Last active November 9, 2021 07:03
Output csv file with Shift JIS using csb gem
@taketo1113
taketo1113 / README: Rails HostAuthorization setting to Allow any hosts.md
Created August 1, 2020 02:18
Rails HostAuthorization setting to Allow any hosts

Rails HostAuthorization setting to Allow any hosts

  • config
Rails.application.config.hosts << /.*/
  • env
    • rails 6.0.3.2
@taketo1113
taketo1113 / README: vue component per form controls.md
Last active March 4, 2020 04:02
vue component per form controls

Design Pattern to create vue component per form controls

Background

Rails MPA + Vue.js

Files

  • Rails View: app/views/views/_form.slim
  • Vue SFC: components/equipment_form/
    • index.js
  • EquipmentFormDeviceId.vue
@taketo1113
taketo1113 / pundit_nested_headless_policies.md
Last active December 21, 2018 08:46
Pundit Nested Headless policies

Pundit Nested Headless policies

# app/policies/hoge/dashboard_policy.rb
class Hoge::DashboardPolicy < Struct.new(:user, :dashboard)
  # ...
end
@taketo1113
taketo1113 / Replace 'be_success' to 'be_successful'.md
Created May 11, 2018 02:13
Fix 'DEPRECATION WARNING: The success? predicate is deprecated and will be removed in Rails 6.0. Please use successful?'
  • Error
DEPRECATION WARNING: The success? predicate is deprecated and will be removed in Rails 6.0. Please use successful?
  • Sample code
  # deprecated
  expect(response).to be_success
 
@taketo1113
taketo1113 / request_macros.rb
Last active March 2, 2018 01:12
Rails Request Spec Sample
# spec/support/request_macros.rb
module RequestMacros
def request_login_user
before(:each) do
@loginuser = FactoryBot.create(:login_user)
post user_session_path, params: { user: { email: @loginuser.email, password: @loginuser.password } }
follow_redirect!
end
end
end