Skip to content

Instantly share code, notes, and snippets.

View ise's full-sized avatar
📚

Masaaki Takeuchi ise

📚
View GitHub Profile
@ise
ise / hoge.md
Last active February 1, 2025 11:24
realforce rc1 karabiner elements settings

realforce rc1 日本語配列

  • product_id: 794
  • vendor_id: 2131
キー key_code 表記
スペースキー左横 japanese_pc_nfer PCキーボードの無変換キー
スペースキー右横 japanese_pc_xfer PCキーボードの変換キー
@ise
ise / params_test.rb
Created March 15, 2021 08:04
rails params
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Activate the gem you are reporting the issue against.
@ise
ise / clinic_name.rb
Last active February 4, 2020 06:33
ダミー医療機関の名称を生成する
# 医科
name = [Gimei.last.kanji, Gimei.last.hiragana, Gimei.last.katakana].sample + %w(内科 眼科 整形外科 皮膚科 クリニック 病院).sample
name + ["", "クリニック"].sample unless name.end_with?("クリニック", "病院")
# 歯科
name = [Gimei.last.kanji, Gimei.last.hiragana, Gimei.last.katakana].sample + %w(歯科 矯正歯科 歯科医院 歯科クリニック デンタルクリニック デンタルケアクリニック).sample
# 調剤
# いまいち
name = [Gimei.first.hiragana, Gimei.first.katakana, Gimei.town.kanji, Gimei.town.hiragana, Gimei.town.katakana].sample + "薬局"
@ise
ise / mongoid_updated_at.rb
Last active May 23, 2019 10:00
mongoid has_and_belongs_to_many updated_at
class A
include Mongoid::Document
include Mongoid::Timestamps
field :hoge, type: String
has_and_belongs_to_many :bs
end
class B
include Mongoid::Document
#!/bin/bash
JMARECEIPT_ENV="/etc/jma-receipt/jma-receipt.env"
if [ ! -f ${JMARECEIPT_ENV} ]; then
echo "${JMARECEIPT_ENV} does not found."
exit 1
fi
. $JMARECEIPT_ENV
#--------------------------------------------------------------------------
@ise
ise / mem.rb
Last active August 16, 2018 12:53
mongoid embeds_many
class A
include Mongoid::Document
embeds_many :items
end
class Item
include Mongoid::Document
embedded_in :a
field :text, type: String
end
@ise
ise / ab.rb
Last active July 20, 2018 02:37
mongoid callbacks with relation
class A
include Mongoid::Document
field :hoge, type: String
belongs_to :b
before_validation do
p 'before_validation'
end
@ise
ise / a.rb
Created July 17, 2018 09:25
mongoid callbacks
class A
include Mongoid::Document
field :hoge, type: String
before_validation do
p 'before_validation'
end
before_validation on: :create do
p 'before_validation on create'
@ise
ise / elasticsearch_kuromoji_analyzer
Created January 16, 2015 01:31
Elasticsearchのkuromoji_analyzer設定サンプル
PUT /test-index/
{
"settings": {
"index":{
"analysis": {
"filter": {
"pos_filter": {
"type": "kuromoji_part_of_speech",
"stoptags": [
"助詞-格助詞-一般",
@ise
ise / elasticsearch_test
Created June 17, 2014 15:09
elasticsearchのmapping設定方法の検証
#
# 0.90.3でmapping定義
#
$ elasticsearch -v
Version: 0.90.3, ...
# jsonのpropertiesの親のkeyをhogeにしてみる
$ cat article.json
{
hoge : {