Skip to content

Instantly share code, notes, and snippets.

@obelisk68
obelisk68 / utils.rb
Last active April 22, 2016 18:56
個人用ユーティリティGem
require 'utils/version'
require 'open-uri'
require 'fastimage'
module Utils
#Pythonの配列のsliceと同等のメソッド
#stepは省略可。leftとrightは省略する代わりにnil
module Pyrb
def pickup(left, right, step=nil)
klass = self.class
C:¥Users¥**¥Documents¥code¥Ruby>ruby convert.rb
無効なパラメーターです - b.bmp
converted
convert.rb: [BUG] Segmentation fault
ruby 2.2.2p95 (2015-04-13 revision 50295) [i386-mingw32]
-- Control frame information -----------------------------------------------
c:0001 p:0000 s:0002 E:00042c TOP [FINISH]
#include "utilsc.h"
#include "math.h"
long gcd(long x, long y) {
long tmp;
if (x < y) {tmp = x; x = y; y = tmp;}
if (!y) return x;
return gcd(y, x % y);
}
# encoding: Shift_JIS
# for Windows
require 'green_shoes'
Sf = %w(png PNG jpg jpeg JPG JPEG gif GIF bmp BMP)
class String
def imgfile?
return false unless m = /\.(.+)$/.match(self)
return m[1] if Sf.include?(m[1])
require 'bundler/setup'
require 'opengl'
require 'glut'
require './opengl_getbitmap'
include Gl, Glut
def init
glClearColor(0, 0, 0, 1)
end
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
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.
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
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