This file contains hidden or 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
| import {BehaviorSubject} from 'rxjs/BehaviorSubject'; | |
| import {Observable} from 'rxjs/Observable'; | |
| export type Action<T> = (current: Readonly<T>) => Partial<T>; | |
| export class Store<T> { | |
| private _data: BehaviorSubject<Readonly<T>>; | |
| public data$: Observable<Readonly<T>>; |
This file contains hidden or 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
| class Logger | |
| def initialize(program, name, rotation = "daily") | |
| @program = program | |
| @log = ::Logger.new("#{Rails.root}/log/#{path}.log", rotation) | |
| @log.formatter = ::Logger::Formatter.new | |
| end | |
| def debug(msg) | |
| @log.debug(@program) { msg } |
This file contains hidden or 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
| # coding: utf-8 | |
| require "moji" | |
| # 事前に Moji.normalize しておくこと。 | |
| # before_validation で変換すればよい。 | |
| # 以下、例。 | |
| # | |
| # before_validation do | |
| # self.name_kana = Moji.normalize_zen_han(name_kana) if name_kana.present? |