This file contains 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
5 10 | |
8 2 24 40 25 42 26 | |
59 48 13 21 13 56 2 | |
5 59 7 57 5 25 24 | |
99 28 6 32 5 23 2 | |
62 24 19 11 19 7 21 | |
2 1 3 2 | |
2 1 3 2 | |
5 1 3 1 | |
5 3 1 2 |
This file contains 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
# frozen_string_literal: true | |
# | |
# ブラックショールズ方程式を用いたオプションの価格計算 | |
# | |
# 標準正規分布の累積分布関数を計算する関数 | |
def cumulative_normal_distribution(x) | |
(1.0 + Math.erf(x / Math.sqrt(2.0))) / 2.0 | |
end |
This file contains 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 Employee | |
attr_reader :record_id, :employee_number, :name | |
def initialize(record_id, employee_number, name) | |
@record_id = record_id.to_i | |
@employee_number = employee_number.to_i | |
@name = name.to_s | |
end | |
end |
This file contains 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 Employee | |
attr_accessor :number, :name | |
attr_reader :id | |
def initialize(id:, number:, name:) | |
@id = id.to_i | |
@number = number.to_i | |
@name = name.to_s | |
end | |
end |
This file contains 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 Employee | |
attr_reader :number, :name | |
def initialize(number, name) | |
@number = number.to_i | |
@name = name.to_s | |
end | |
end |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<!-- NOTE: JavaScript 側で、自動再生を有効化するには、一度 Play ボタンをクリックする必要がある --> | |
<div> |
This file contains 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
# Hash を用いて FizzBuzz 問題を解くクラス | |
# 15, 5, 3 の余りを Hash の key として登録しておき、FizzBuzz の解を得る | |
class FizzBuzz | |
attr_reader :hash | |
def initialize | |
# INFO: Hash instance method Hash#default_proc | |
# https://docs.ruby-lang.org/ja/latest/method/Hash/i/default_proc.html | |
hash = | |
Hash.new do |hash, key| |
This file contains 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
20143 20149 | |
20162 20175 | |
20162 20164 | |
20165 20166 | |
20169 201611 | |
20172 20175 | |
20181 20192 | |
20194 20195 | |
20203 20208 | |
202011 20222 |
This file contains 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
interface Number { | |
isFizzBuzz(): boolean | |
isFizz(): boolean | |
isBuzz(): boolean | |
} | |
Number.prototype.isFizzBuzz = function(): boolean { | |
return this.isFizz() && this.isBuzz() | |
} |
This file contains 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
# 全体の処理 | |
# | |
# スコアを得るまでの流れ: | |
# | |
# View 側: | |
# 1. reCAPTCHA を設置する (JS 処理) | |
# 2. ログインフォームの submit に合わせて g-recaptcha-response にデータを乗せる | |
# | |
# Rails 側: | |
# 1. client を生成 |
NewerOlder