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
# coding: utf-8 | |
(1..100).each do |n| | |
puts case | |
when n % 15 == 0 | |
'FizzBuzz' | |
when n % 3 == 0 | |
'Fizz' | |
when n % 5 == 0 | |
'Buzz' | |
else |
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
import scala.annotation.tailrec | |
object BF { | |
class Parser(val str: String) { | |
val cmap = Map( | |
">" -> 'pinc, | |
"<" -> 'pdec, | |
"+" -> 'inc, | |
"-" -> 'dec, |
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
# coding: utf-8 | |
module Geolocation | |
def distance_to(lat, lon, mode = nil) | |
return unless (lat && lon) | |
return unless (self.respond_to?(:latitude) && self.respond_to?(:longitude)) | |
earth_distance(self.latitude, self.longitude, lat, lon, mode) | |
end | |
def distance_between(point, mode = nil) |
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
# encoding: utf-8 | |
require 'mail' | |
MAIL_ENCODING = 'ISO-2022-JP' | |
MYADDR = "hogehoge" | |
def send_message | |
mes = "mini来た!!" | |
m = Mail.new |
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
# coding: utf-8 | |
def read_data(count) | |
c = count.to_i | |
return if c < 0 | |
ret = [] | |
count.times do | |
s = gets | |
next unless s | |
ret << s.to_i | |
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
https://paiza.jp/poh/ando | |
glasses | |
https://paiza.jp/poh/ando/share/f872136d | |
santa | |
https://paiza.jp/poh/ando/share/b8c73b8b | |
swimwear | |
https://paiza.jp/poh/ando/share/841f1803 |
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
https://paiza.jp/poh/hatsukoi/ |
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
https://paiza.jp/moshijo |
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
defmodule BF do | |
@cmap %{ | |
">" => :pinc, | |
"<" => :pdec, | |
"+" => :inc, | |
"-" => :dec, | |
"." => :out, | |
"," => :inp, | |
"[" => :jmp, | |
"]" => :ret |
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
# https://paiza.jp/logic_summoner/challenges/logics_skill_4005 | |
def mark(board, table, w, max, color, base, ind) | |
return if table[ind] | |
return unless color == board[ind] | |
r = ind % w | |
table[ind] = base | |
mark(board, table, w, max, color, base, ind - 1) if r > 0 # left | |
mark(board, table, w, max, color, base, ind + 1) if r < w - 1 # right | |
mark(board, table, w, max, color, base, ind - w) if ind >= w # up |