Skip to content

Instantly share code, notes, and snippets.

View JunichiIto's full-sized avatar

Junichi Ito JunichiIto

View GitHub Profile
@JunichiIto
JunichiIto / desc.md
Last active March 26, 2023 23:31
How to show images in fly.io
@JunichiIto
JunichiIto / How-To:-Upgrade-to-Devise-4.9.0-[Hotwire-Turbo-integration]-jp.md
Last active March 29, 2023 05:48
【日本語訳】How To: Upgrade to Devise 4.9.0 [Hotwire Turbo integration]
@JunichiIto
JunichiIto / how-to-fix-rails-7-0-warning.md
Created December 29, 2021 09:10
Rails 7.0 - How to fix "DEPRECATION WARNING: image/jpg is not a valid content type"

Rails 7.0 - How to fix "DEPRECATION WARNING: image/jpg is not a valid content type"

Problem

I got the following message when I updated my app to Rails 7.0.

DEPRECATION WARNING: image/jpg is not a valid content type, it should not be used when creating a blob, and support for it will be removed in Rails 7.1. If you want to keep supporting this content type past Rails 7.1, add it to `config.active_storage.variable_content_types`. Dismiss this warning by setting `config.active_storage.silence_invalid_content_types_warning = true`. (called from public_send at /Users/jnito/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/factory_bot-6.2.0/lib/factory_bot/attribute_assigner.rb:16)
@JunichiIto
JunichiIto / tenji_maker_test.rb
Last active December 19, 2021 22:55
点字メーカープログラムのテスト・辛口バージョン
# frozen_string_literal: true
require 'minitest/autorun'
require_relative '../lib/tenji_maker'
class TenjiMakerTest < Minitest::Test
def setup
@tenji_maker = TenjiMaker.new
end
@JunichiIto
JunichiIto / vending-machine-suica-problem.md
Last active September 6, 2021 16:49
Suica版自動販売機問題の問題文です。

Suica版自動販売機問題

下記の課題を改変したプログラミング問題です。

TDD Boot Camp(TDDBC) - TDDBC大阪3.0/課題

ステップ0 Suicaのチャージ

  • Suicaには100円以上の任意の金額をチャージできる
  • Suicaは現在のチャージ残高を取得できる。
  • 注意:実際のSuicaはチャージ可能な金額の単位が決まっているが、仕様が複雑になるので、ここでは任意の金額をチャージできることにする
@JunichiIto
JunichiIto / opinion.md
Created May 15, 2020 23:18
Summary: Volunteer former prosecutors' opinion on the extension of the retirement age of the Chief Prosecutor of Tokyo High Prosecutors

Summary: Volunteer former prosecutors' opinion on the extension of the retirement age of the Chief Prosecutor of Tokyo High Prosecutors

I have tried to summarize the opinion posted on the following page from a personal perspective.

[Full text of opinion paper] The Prime Minister is reminiscent of Louis XIV in "I am the State": Asahi Shimbun Digital

NOTE: This document is automatically translated from the Japanese version through DeepL translator.

1. Kurokawa's extension of retirement age (which is still ongoing) has no legal basis

@JunichiIto
JunichiIto / ikensho.md
Last active May 15, 2020 23:20
要約:東京高検検事長の定年延長についての元検察官有志による意見書

要約:東京高検検事長の定年延長についての元検察官有志による意見書

下記のページに掲載されていた意見書を個人的な観点で要約してみました。

【意見書全文】首相は「朕は国家」のルイ14世を彷彿:朝日新聞デジタル

自動翻訳で作成した英語版もあります。/ English version is here:
Summary: Volunteer former prosecutors' opinion on the extension of the retirement age of the Chief Prosecutor of Tokyo High Prosecutors

1. 黒川氏の定年延長(現在も継続中)は法的根拠がない

こちらのツイートの疑問点について、僕なりに回答してみます。

例えばですけど、

resource :basket, only: [:show, :update, :destroy]

このとき、resourceには:がなくて、onlyには:がある。 これって、Rubyなんでしょうか?

Traceback (most recent call last):
8: from ./sample.rb:49:in `<main>'
7: from ./sample.rb:50:in `<class:Book>'
6: from /Users/jnito/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.0/lib/active_record/associations.rb:1511:in `has_one'
5: from /Users/jnito/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.0/lib/active_record/associations/builder/association.rb:30:in `build'
4: from /Users/jnito/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.0/lib/active_record/associations/builder/association.rb:40:in `create_reflection'
3: from /Users/jnito/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.0/lib/active_record/associations/builder/association.rb:67:in `validate_options'
2: from /Users/jnito/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.0/lib/active_support/core_ext/hash/keys.rb:50:in `assert_valid_keys'
1: from /Users/jnito/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.0/lib/active_support/core_ext/hash/ke
@JunichiIto
JunichiIto / gist:3f5a414601a4245be0f82400899bf0e2
Last active February 5, 2020 00:16 — forked from machida/html_practice.html
HTMLの練習(このレシピにマークアップをしてみましょう)
<p>
カレーのレシピ
誰でもできる、美味しいカレーの作り方です。旦那も息子もこのカレーが大好物。
ポイントは玉ねぎと人参はミキサーで細かくしてしまうところ。逆にコクのある美味しいカレーになります。
レシピの作者
山田サチ子さん