Skip to content

Instantly share code, notes, and snippets.

# coding: cp932
require 'win32/registry'
VAL_NAMES = %w|
LayerDriver\ JPN
OverrideKeyboardIdentifier
OverrideKeyboardSubtype
OverrideKeyboardType
|
function swichFunc(x, cond) {
for (var i = 0; i < cond.length; i++) {
if (cond[i].cond(x)) {
return cond[i].proc(x);
}
}
}
function swichAction(x, cond, continuous) {
for (var i = 0; i < cond.length; i++) {
if (cond[i].cond(x)) {
@arton
arton / gist:674271
Created November 12, 2010 16:08
EOM?
echo
EOM = CFLAGS = -MD -Zi -W2 -wd4996 -O2sy- -Zm600
ECHO は <ON> です。
echo
EOM = XCFLAGS = -DRUBY_EXPORT -I. -I.ext/include/i386-mswin32_100 -I./include
-I. -I./missing
ECHO は <ON> です。
echo
EOM = CPPFLAGS =
ECHO は <ON> です。
C:\Users\arton\Documents\ruby\src\ruby-trunk>nmake -n
Microsoft(R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
for %I in ( " CFLAGS = -MD -Zi -W2 -wd4996 -O2sy- -Zm600" " XCFLAGS
= -DRUBY_EXPORT -I. -I.ext/include/i386-mswin32_100 -I./include -I. -I./missing
" " CPPFLAGS = " " DLDFLAGS = -incremental:no -debug -opt:ref -opt:
icf -dll" " SOLIBS = " ) do @echo.%~I
NMAKE : fatal error U1073: '\' のビルド方法が指定されていません。
opt_sc.inc: $(srcdir)/insns.def {$(VPATH)}vm_opts.h \
$(srcdir)/defs/opt_operand.def $(srcdir)/defs/opt_insn_unif.def \
$(srcdir)/tool/instruction.rb $(srcdir)/tool/insns2vm.rb
@$(RM) $(PROGRAM)
$(BASERUBY) -Ks $(srcdir)/tool/insns2vm.rb $(INSNS2VMOPT) opt_sc.inc
optinsn.inc: $(srcdir)/insns.def {$(VPATH)}vm_opts.h \
$(srcdir)/defs/opt_operand.def $(srcdir)/defs/opt_insn_unif.def \
$(srcdir)/tool/instruction.rb $(srcdir)/tool/insns2vm.rb
@$(RM) $(PROGRAM)
金, 11 19 2010 21:56:39 ../rubytrunk/include/ruby\missing.h
金, 11 19 2010 21:56:39 ../rubytrunk/include/ruby\win32.h
金, 11 19 2010 22:18:38 variable.obj
金, 11 19 2010 21:59:08 ../rubytrunk\compile.c
金, 11 19 2010 21:59:08 ../rubytrunk\iseq.h
金, 11 19 2010 21:56:39 ../rubytrunk/include/ruby\ruby.h
金, 11 19 2010 22:17:44 .ext/include/i386-mswin32_100/ruby\con
ig.h
金, 11 19 2010 21:56:39 ../rubytrunk/include/ruby\defines.h
金, 11 19 2010 21:56:39 ../rubytrunk/include/ruby\intern.h
@arton
arton / test_process.patch
Created March 3, 2011 12:04
assign free fds for exec test
--- test_process.rb~ Mon Feb 28 21:20:03 2011
+++ test_process.rb Thu Mar 03 08:42:34 2011
@@ -360,6 +360,11 @@ class TestProcess < Test::Unit::TestCase
ECHO = lambda {|arg| [RUBY, '-e', "puts #{arg.dump}; STDOUT.flush"] }
SORT = [RUBY, '-e', "puts ARGF.readlines.sort"]
CAT = [RUBY, '-e', "IO.copy_stream STDIN, STDOUT"]
+
+ def reserve_fd(n)
+ fds = n.times.to_a.map {|fn| File.open("#{rand}#{fn}", "w")}
+ fds.map {|f| fd = f.to_i; f.close; File.delete(f.path); fd}
81) Failure:
test_cgi(TestWEBrickCGI) [C:/Users/arton/Documents/ruby/src/rubytrunk/test/webri
ck/test_cgi.rb:33]:
webrick log start:
[2011-03-19 14:24:47] INFO WEBrick 1.3.1
[2011-03-19 14:24:47] INFO ruby 1.9.3 (2011-03-19) [i386-mswin32_100]
[2011-03-19 14:24:47] INFO WEBrick::HTTPServer#start: pid=9120 port=59857
[2011-03-19 14:24:47] ERROR CGIHandler: C:/Users/arton/Documents/ruby/src/ruby
trunk/test/webrick/webrick.cgi:
C:/Users/arton/Documents/ruby/src/rubytrunk/lib/webrick/httpservlet/cgi_runner
--- hash.c~ Tue Mar 08 23:06:17 2011
+++ hash.c Sat Mar 19 17:24:57 2011
@@ -2194,6 +2194,20 @@ envix(const char *nam)
}
#endif
+#if defined(_WIN32)
+static int
+getenvsize(char* p)
+{
@arton
arton / gist:1102677
Created July 24, 2011 14:34
disp_referrer.rb patch
arton@nomad:~/public_html/diary/misc/plugin$ diff -pu disp_referrer.rb.old disp_referrer.rb
--- disp_referrer.rb.old 2011-07-24 23:23:42.000000000 +0900
+++ disp_referrer.rb 2011-07-24 23:28:55.000000000 +0900
@@ -1015,25 +1015,28 @@ class DispRef2Refs
end
result << '<ul>'
@refs[cat_key].each do |a|
- if a[2].size == 1 then
- result << %Q[<li><a rel="nofollow" href="#{DispRef2String::escapeHTML( a[2][0][1].url )}">#{DispRef2String::escapeHTML( a[2][0][1].title )}</a> &times;#{a[0]}</li>\n]
- elsif not a[2][0][1].title_ignored then