View data.txt
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 |
View fizzBuzz.ts
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() | |
} |
View common.rb
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 を生成 |
View date_duration.rb
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
require 'active_support' | |
require 'active_support/core_ext' | |
# | |
# 関数の定義 | |
# | |
def date_duration(base_date, after_date) | |
duration_parts = | |
ActiveSupport::Duration.build(after_date.to_i - base_date.to_i).parts |
View main.rb
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
require File.join(__dir__, 'lib', 'workdays') | |
# eg. 10 1 FRI | |
# => 10月4日 | |
workday = WorkDay.new(*gets.chomp.split) | |
month, day = workday.next_workday | |
puts "#{month}月#{day}日" |
View janken.rb
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 | |
# じゃんけんゲームで出せる手の種類 | |
module Hands | |
HANDS = %i[rock scissors paper].freeze | |
HANDS_LABEL = %w[グー チョキ パー].freeze | |
private_constant :HANDS, :HANDS_LABEL | |
end |
View day_in_month.rb
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
require 'date' | |
def count_day_in_month(date, month:, count: 0) | |
return count unless month.eql?(date.month) | |
count_day_in_month(date.succ, month: month, count: count + 1) | |
end | |
year, month, day = [*gets.chomp.split, 1].map(&:to_i) |
View date_format.rb
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 DateFormat | |
DATE_ORDER = %r{[0-9]{4}/[0-9]{2}/[0-9]{2}}.freeze | |
MONTH = [*(1..12).map { |n| n.to_s.rjust(2, '0') }].freeze | |
DAY = [*(1..31).map { |n| n.to_s.rjust(2, '0') }].freeze | |
class << self | |
def validate(date_string) | |
return 'No' unless date_string.match?(DATE_ORDER) | |
_year, month, day = date_string.split('/') |
View slack_many_muscle.scpt
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
# Slack の入力欄に :muscle: をたくさん打ち込むスクリプト | |
# 3x3 に渡ってたくさんの muscle を自動で打ち込む | |
property channelName : "" | |
on run argv # TIPS: {"arg1", "arg2"...} と複数設定できる | |
if (count of argv) > 0 then | |
set channelName to argv | |
else | |
set channelName to "my-rails" # 未指定の場合、この値を設定 |
NewerOlder