Skip to content

Instantly share code, notes, and snippets.

obelisk68

Block or report user

Report or block obelisk68

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@obelisk68
obelisk68 / utils.rb
Last active Apr 22, 2016
個人用ユーティリティGem
View utils.rb
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
View ruby_bug.txt
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]
View utilsc.c
#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);
}
View convert.rb
# 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])
View opengl_sample1.rb
require 'bundler/setup'
require 'opengl'
require 'glut'
require './opengl_getbitmap'
include Gl, Glut
def init
glClearColor(0, 0, 0, 1)
end
View opengl_getbitmap.rb
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
View Nyaplot_smaple1.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View IRubyNote_help.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View m_jankenasobi.rb
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
View mruby_build.txt
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
You can’t perform that action at this time.