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 main | |
fname = Popup.input("ファイル名を入力して下さい") | |
return unless fname | |
unless File.exist?(fname) and File.file?(fname) | |
puts "ファイルが存在しないか、ディレクトリです" | |
return | |
end | |
file_content = File.open(fname) {|io| io.read} |
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 bget(url, token) | |
if token | |
ret = Browser.get(url, header: { "Authorization" => "token #{token}"}) | |
else | |
ret = Browser.get(url) | |
end | |
JSON::parse(ret) | |
end |
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 main | |
fname = Popup.input("削除するファイル名かフォルダ名") | |
if not File.exist?(fname) | |
puts "ファイルまたはフォルダが存在していません" | |
return | |
elsif File.file?(fname) | |
File.delete(fname) | |
else | |
Dir.rmdir(fname) |
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 main | |
loop do | |
name = choise(class_list, combine: true) | |
clear | |
puts Module.const_get(name).info | |
puts | |
choise(["戻る"]) | |
clear |
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
N = 8 | |
class EightQueen | |
class Step | |
def initialize(x, y) | |
@x, @y = x, y | |
@parent = nil | |
@depth = 0 | |
end | |
attr_accessor :x, :y, :parent, :depth |
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
#include <stdio.h> | |
char *keyboard_linein() { | |
char buf[1000]; | |
fgets(buf, 1000, stdin); | |
printf("%s\n", buf); | |
return buf; | |
} |
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
require 'oekaki' | |
Width, Height = if ARGV.size == 2 | |
ARGV.map(&:to_i) | |
else | |
[1000, 700] | |
end | |
Max_r, Min_r = 40, 10 | |
ColorMax = 65535 |
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
require './miniopengl' | |
require 'parallel' | |
filenames = [] | |
1.upto(5) {|i| filenames << "./polyhedrons_obj/r" + ("%02d" % i) + ".obj"} | |
data = [] | |
filenames.each do |fn| | |
open(fn, "r") do |io| | |
ar = [[], []] |
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
require 'oekaki' | |
Width, Height = 400, 300 | |
CircumcircleR = 0.8 | |
def incircle(a, b, c) | |
l, m, n = (b - a).norm, (c - b).norm, (a - c).norm | |
q = l + m + n | |
po = a * (m / q) + b * (n / q) + c * (l / q) |
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
height, width = gets.split.map(&:to_i) | |
window = [] | |
height.times {window << gets.chomp.chars.map(&:to_i)} | |
num = gets.to_i | |
wgtsize = [] | |
num.times {wgtsize << gets.split.map(&:to_i)} | |
height.times do |h| | |
(width - 1).times {|w| window[h][w + 1] += window[h][w]} | |
end |