CGI.escapeHTML('< > &') #=> < > &
CGI.escape('< > &') #=> %3C+%3E+%26
URI.encode('< > &') #=> %3C%20%3E%20&
CGI.escapeHTML('https://example.com/') #=> https://example.com/
CGI.escape('https://example.com/') #=> https%3A%2F%2Fexample.com%2F
URI.encode('https://example.com/') #=> https://example.com/
CGI.escapeHTML('結') #=> 結
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
# 毎日『m段上ってn段下がる』を繰り返したら、 | |
# x日目にd段目に初めて着いた。 | |
# xをd,m,nで表せ。文字はすべて正の整数で、m>nとする。#数学の問題 | |
# https://twitter.com/hyuki/status/1134018952416321536 | |
# current段目から「m段上ってn段下がる」ときに通過する | |
# 「段目」を引数にブロックをyieldして | |
# 最終的な段目を戻り値に | |
def daily(current,m,n) | |
m.times do |
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
# 毎日『m段上ってn段下がる』を繰り返したら、 | |
# x日目にd段目に初めて着いた。 | |
# xをd,m,nで表せ。文字はすべて正の整数で、m>nとする。#数学の問題 | |
# https://twitter.com/hyuki/status/1134018952416321536 | |
# current段目から「m段上ってn段下がる」ときに通過する | |
# 「段目」を引数にブロックをyieldして | |
# 最終的な段目を戻り値に | |
def daily(current,m,n) | |
m.times do |
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
# For setting color for my prompt. | |
# https://qiita.com/PruneMazui/items/8a023347772620025ad6 | |
# https://gist.github.com/hyuki/3eef0b67e30f2839c1dd556e9f10c9c1 | |
# https://snap.textfile.org/20190706230113/ | |
PROMPT = %Q(export COLOR='%d';) + %q(PS1="[\[\e[38;5;${COLOR}m\]\u@HOSTNAME\[\e[0m\] \w] \\$ ") | |
256.times do |n| | |
s = sprintf(PROMPT, n) | |
printf("\e[38;5;%dm%s\e[m\n", n, s) | |
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="ja"> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
<meta charset="utf-8"> | |
<title>一行メモ</title> | |
<style> | |
input { | |
width: 50%; | |
height: 2em; |
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
h = Hash.new(0) | |
9.times do |y| | |
9.times do |x| | |
n = (x + 1) * (y + 1) | |
h[n] += 1 | |
printf("%3d", n) | |
end | |
puts | |
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
float th = 0.0; | |
float R = 100; | |
float r = 10; | |
void setup(){ | |
size(300, 300); | |
background(0); | |
noStroke(); | |
} |
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
float theta = 0.0; | |
void setup(){ | |
size(600, 600); | |
background(0); | |
noStroke(); | |
} | |
void draw() { | |
clear(); |
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
int N = 1; | |
void setup(){ | |
size(600, 600); | |
background(0); | |
noStroke(); | |
} | |
void draw() { | |
clear(); |