Skip to content

Instantly share code, notes, and snippets.

View takaokouji's full-sized avatar

Kouji Takao takaokouji

View GitHub Profile
@takaokouji
takaokouji / .globalrc
Created April 23, 2011 07:27
global using rtags
#
# Copyright (c) 1998, 1999, 2000, 2001, 2002, 2003
# Tama Communications Corporation
#
# This file is part of GNU GLOBAL.
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
diff --git a/compiler.cpp b/compiler.cpp
index f5ccc8a..e996c91 100644
--- a/compiler.cpp
+++ b/compiler.cpp
@@ -76,7 +76,8 @@ RoxorCompiler *RoxorCompiler::shared = NULL;
__save_state(NODE *, ensure_node);\
__save_state(bool, block_declaration);\
__save_state(AllocaInst *, dispatch_argv);\
- __save_state(uint64_t, outer_mask);
+ __save_state(uint64_t, outer_mask);\
@takaokouji
takaokouji / prototype.rb
Created April 7, 2011 14:43
sanitize_regexp_string for "<pattern>{..}*" in Ruby
require 'test/unit'
def sanitize_regexp_string(chars)
lbrace_chars = "{"
rbrace_asterisk_chars = "}*"
backslash_chars = "\\"
res = chars.dup
res_diff = 0
@takaokouji
takaokouji / test_include.rb
Created March 16, 2011 12:40
Could not find the constant in class_eval.
module A
B = 10
def f
class_eval { B }
end
end
class K
extend A
f
@takaokouji
takaokouji / gist:770531
Created January 8, 2011 03:58
Ruby study for Matsue(Japan) junior high school before afternoon.
----- main.rb
require 'dxruby'
require './player'
player = Player.new
Window.loop do
break if Input.keyPush?(K_ESCAPE)
player.move
@takaokouji
takaokouji / add-xcode-templates.patch
Created January 8, 2011 02:33
MacRuby class templates for Xcode 3
diff --git a/misc/xcode-templates/File Templates/MacRuby/Ruby File.pbfiletemplate/TemplateInfo.plist b/misc/xcode-templates/File Templates/MacRuby/Ruby File.pbfiletemplate/TemplateInfo.plist
new file mode 100644
index 0000000..7ad506c
--- /dev/null
+++ b/misc/xcode-templates/File Templates/MacRuby/Ruby File.pbfiletemplate/TemplateInfo.plist
@@ -0,0 +1,4 @@
+{
+ MainTemplateFile = "file.rb";
+ Description = "An empty Ruby file.";
+}
class String
def -(val)
if TIME_RE =~ self && TIME_RE =~ val
if self.length == 8 || val.length == 8
with_sec = true
end
require "time"
d = Time.parse(self) - Time.parse(val)
sec = d % 60
min = (d / 60) % 60
cymric$ /usr/bin/rake
(in /Users/kouji/work/MacRuby/MacRuby-git)
/usr/bin/ruby tool/compile_prelude.rb prelude.rb miniprelude.c.new
./miniruby -I. -I./lib bin/rubyc --internal --arch i386 --arch x86_64 -C "rbconfig.rb" -o "./rbconfig.rbo"
unknown: [BUG] Segmentation fault
MacRuby version 0.6 (ruby 1.9.0) [universal-darwin9.0, x86_64]
diff --git a/signal.c b/signal.c
index 12b25f1..4d891b5 100644
--- a/signal.c
+++ b/signal.c
@@ -20,8 +20,10 @@
#include "vm.h"
#include <signal.h>
#include <stdio.h>
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
#include <dispatch/dispatch.h>
diff --git a/array.c b/array.c
index 7cf2d4a..3f70acc 100644
--- a/array.c
+++ b/array.c
@@ -50,7 +50,7 @@ rary_reserve(VALUE ary, size_t newlen)
for (size_t i = 0; i < rary->len; i++) {
GC_WB(&new_elements[i], rary->elements[i]);
}
- GC_WB(&ary->elements, new_elements);
+ GC_WB(&rary->elements, new_elements);