Skip to content

Instantly share code, notes, and snippets.

View takaokouji's full-sized avatar

Kouji Takao takaokouji

View GitHub Profile
(load "time-stamp")
(defun insert-time-stamp ()
(interactive)
(insert (time-stamp-string)))
(defun my-insert-time ()
(interactive)
(insert (format-time-string "%Y-%m-%d %H:%M:%S")))
(global-set-key "\C-c\C-t" 'my-insert-time)
@takaokouji
takaokouji / support-compiling-only-one.patch
Created November 13, 2009 15:11
The patch for MacRuby. $ /usr/bin/rake extensions EXTS=readline
diff --git a/rakelib/builder.rake b/rakelib/builder.rake
index 79e3e41..e3f2ecb 100644
--- a/rakelib/builder.rake
+++ b/rakelib/builder.rake
@@ -328,7 +328,8 @@ INSTRUBY_ARGS = "#{SCRIPT_ARGS} --data-mode=0644 --prog-mode=0755 --installed-li
EXTENSIONS = ['ripper', 'digest', 'etc', 'readline', 'libyaml', 'fcntl', 'socket', 'zlib', 'bigdecimal', 'openssl'].sort
def perform_extensions_target(target)
- EXTENSIONS.map { |x| File.join('ext', x) }.each do |ext_dir|
+ target_extensions = (ENV['EXTS'] && ENV['EXTS'].split or EXTENSIONS)
@takaokouji
takaokouji / rb_define_method-for-macruby.patch
Created November 12, 2009 22:58
This is the patch for MacRuby that is implemented rb_define_method. But not support to call method with blocks.
diff --git a/class.c b/class.c
index ed7ccaf..e4bdceb 100644
--- a/class.c
+++ b/class.c
@@ -1003,7 +1003,7 @@ name_to_sel(const char *name, const int arity)
return sel_registerName(name);
}
-static void
+static rb_vm_method_node_t *
q_default = Dispatch::Queue.concurrent
q_sum = Dispatch::Queue.new("com.example.sum")
sum = 0
q_default.apply(10) do |i|
puts("i: #{i}")
sleep(1)
x = i + 1
q_sum.dispatch(false, &lambda {
puts("x: #{x}")