Skip to content

Instantly share code, notes, and snippets.

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
@obelisk68
obelisk68 / class_reference.rb
Created May 2, 2017 11:17
Created by RubyPico at Tue May 02 20:17:08 2017
def main
loop do
name = choise(class_list, combine: true)
clear
puts Module.const_get(name).info
puts
choise(["戻る"])
clear
@obelisk68
obelisk68 / f_delete.rb
Created May 2, 2017 08:52
Created by RubyPico at Tue May 02 17:52:20 2017
def main
fname = Popup.input("削除するファイル名かフォルダ名")
if not File.exist?(fname)
puts "ファイルまたはフォルダが存在していません"
return
elsif File.file?(fname)
File.delete(fname)
else
Dir.rmdir(fname)
@obelisk68
obelisk68 / github_rubypico_update.rb
Last active May 2, 2017 08:22
Created by RubyPico at Tue May 02 17:21:13 2017
def bget(url, token)
if token
ret = Browser.get(url, header: { "Authorization" => "token #{token}"})
else
ret = Browser.get(url)
end
JSON::parse(ret)
end
@obelisk68
obelisk68 / upload_to_gist.rb
Last active May 2, 2017 08:00
Created by RubyPico at Tue May 02 16:59:50 2017
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}
tomoki@tomoki-VJF152 ~ $ cd Documents/mruby/mruby
tomoki@tomoki-VJF152 ~/Documents/mruby/mruby $ make
ruby ./minirake
(in /home/tomoki/Documents/mruby/mruby)
CC src/init.c -> build/host/src/init.o
CC src/dump.c -> build/host/src/dump.o
CC src/vm.c -> build/host/src/vm.o
CC src/crc.c -> build/host/src/crc.o
CC src/compar.c -> build/host/src/compar.o
CC src/etc.c -> build/host/src/etc.o
module JankenAsobi
def play
player1 = Cp.new
player2 = Man.new
judge = Judge.new(player1, player2)
5.times {|i| judge.game(i + 1)}
judge.winner
end
module_function :play
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
require 'bundler/setup'
require 'opengl'
require 'glut'
include Gl, Glut
class BitMap
def initialize(width, height, dpi = 96)
@width = width
@height = height
@line_size = width * 3 + (4 - (width * 3) % 4) % 4