Skip to content

Instantly share code, notes, and snippets.

View nobu's full-sized avatar

Nobuyoshi Nakada nobu

  • Nihon Ruby-no-Kai
  • Kanuma, Tochigi, Japan
  • X @n0kada
View GitHub Profile
#!/usr/local/bin/ruby
require 'benchmark/ips'
require 'base64'
require 'digest'
N=10_000
data = Digest::SHA256.digest("")
Benchmark.ips do |x|
x.report("base64") do
N.times do
body = Class.new do
def initialize; @is_open = true end
def each; yield "hello" end
def close; @is_open = false end
def call
if @is_open
[500, {}, ["close not called"]]
else
[200, {}, self]
end
class Module
# call-seq:
# enumerable name
#
# Lets the method named as +name+ return an enumerator if no block is
# given.
#
# class N
# enumerable def numbers
# yield 1
Process: Emacs [62692]
Path: /Applications/MacPorts/Emacs.app/Contents/MacOS/Emacs
Identifier: org.gnu.Emacs
Version: Version 24.3 (9.0)
Code Type: X86-64 (Native)
Parent Process: launchd [263]
Responsible: Emacs [62692]
User ID: 501
Date/Time: 2014-06-11 14:17:18.923 +0900
#!/usr/bin/ruby
# Usage:
# $ wget http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
# $ ruby CaseFolding.rb CaseFolding.txt > ../enc/unicode/casefold.h
def hex_seq(v)
v.map {|i| "0x%04x" % i}.join(", ")
end
index b26ba72..2e57492 100644
--- common.mk
+++ common.mk
@@ -863,7 +863,7 @@ $(REVISION_H): $(srcdir)/version.h $(srcdir)/ChangeLog $(srcdir)/tool/file2lastr
$(srcdir)/ext/ripper/ripper.c: parse.y
$(ECHO) generating $@
$(Q) $(CHDIR) $(@D) && $(exec) $(MAKE) -f depend $(MFLAGS) \
- Q=$(Q) ECHO=$(ECHO) top_srcdir=../.. srcdir=. RUBY=$(BASERUBY)
+ Q=$(Q) ECHO=$(ECHO) top_srcdir=../.. srcdir=. RUBY="$(BASERUBY)"
diff --git i/hash.c w/hash.c
index 007508a..6f39e47 100644
--- i/hash.c
+++ w/hash.c
@@ -2402,6 +2402,28 @@ rb_hash_flatten(int argc, VALUE *argv, VALUE hash)
return ary;
}
+static int
+hash_comprised_i(VALUE key, VALUE value, VALUE arg)
Process: LimeChat [267]
Path: /Applications/LimeChat.app/Contents/MacOS/LimeChat
Identifier: net.limechat.LimeChat
Version: 2.39 (2.39)
Code Type: X86-64 (Native)
Parent Process: launchd [248]
Responsible: LimeChat [267]
User ID: 501
Date/Time: 2014-04-19 16:16:11.602 +0900
[ 1/81] Test_Symbol::TestType#test_attrset = 0.00 s
1) Failure:
Test_Symbol::TestType#test_attrset [/Users/nobu/src/ruby/trunk/src/test/-ext-/symbol/test_type.rb:104]:
Expected Bug::Symbol.attrset?("[foo]=") to return true.
[21/81] TestStruct::SubStruct#test_inspect = 0.00 s
2) Error:
TestStruct::SubStruct#test_inspect:
NoMethodError: undefined method `@a=' for #<struct :@a=1>
/Users/nobu/src/ruby/trunk/src/test/ruby/test_struct.rb:136:in `test_inspect'
@nobu
nobu / extconf.rb
Created August 14, 2013 07:47
String#scrub and String#scrub! for 2.0.
require 'mkmf'
create_makefile('string/scrub')