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
| const ouraBaseUrl = 'https://api.ouraring.com/v1/' | |
| const ouraAccessToken = 'xxxx' | |
| const slackProfileUrl = 'https://slack.com/api/users.profile.set' | |
| const slackAccessToken = 'xxxx' | |
| const slackHooksUrl = 'xxxx' | |
| function main() { | |
| const readinessScore = getReadinessScore() |
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
| def reverse_besearch_threshold(array) | |
| head = 0 | |
| tail = array.length - 1 | |
| while head <= tail | |
| center = (head + tail) / 2 | |
| success = yield(center, array[center]) | |
| if success |
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
| def reduce_array_by_binary_search(numbers, bytesize) | |
| head = 0 | |
| tail = numbers.length - 1 | |
| length = numbers.length - 1 | |
| while head <= tail | |
| center = (head + tail) / 2 | |
| if numbers[center..length].to_s.bytesize <= bytesize | |
| tail = center - 1 | |
| else |
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
| def binary_search(numbers,value) | |
| head = 0 | |
| tail = numbers.length - 1 | |
| while head <= tail do | |
| center = (head + tail) / 2 | |
| if numbers[center] == value | |
| return numbers[center] | |
| elsif numbers[center] < value | |
| head = center + 1 | |
| else |
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
| # frozen_string_literal: true | |
| namespace :rake_task_template do | |
| desc 'desciption' | |
| task :run, %w[dryrun] => :environment do |_task, args| | |
| logger = Logger.new(STDOUT) | |
| dryrun = args[:dryrun] != 'false' | |
| logger.info "#{Time.zone.now} (dryrunモード=#{dryrun}" |
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 Bicycle | |
| attr_reader :size, :parts | |
| def initialize(args={}) | |
| @size = args[:size] | |
| @parts = args[:parts] | |
| end | |
| def spares | |
| parts.spares |
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
| const products = { | |
| gold: { | |
| name: '金', | |
| price: 100 | |
| }, | |
| silver: { | |
| name: '銀', | |
| price: 50 | |
| }, | |
| copper: { |
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 Bicycle | |
| attr_reader :size, :chain, :tire_size | |
| def initialize(args={}) | |
| @size = args[:size] | |
| @chain = args[:chain] || default_chain | |
| @tire_size = args[:tire_size] || default_tire_size | |
| post_initialize(args) | |
| end | |