Skip to content

Instantly share code, notes, and snippets.

@nagachika
nagachika / Gemfile
Last active August 29, 2015 14:02
ActiveSupport::Dependencies and const_get(const, false)
source "https://rubygems.org"
#gem "activesupport", "~> 3.2.18"
gem "activesupport", "~> 4.1.1"
p "in bar.rb"
TestRubyOptions#test_kanji = 0.05 s
1) Failure:
TestRubyOptions#test_kanji [/Users/nagachika/opt/ruby-trunk/src/ruby/test/ruby/test_rubyoptions.rb:131]:
<["EUC-JP"]> expected but was
<[]>.
---
<[]> expected but was
<["/Users/nagachika/opt/ruby-trunk/src/ruby/lib/rubygems/specification.rb:710:in `[]': invalid byte sequence in EUC-JP (ArgumentError)",
"\tfrom /Users/nagachika/opt/ruby-trunk/src/ruby/lib/rubygems/specification.rb:710:in `block in each_gemspec'",
"\tfrom /Users/nagachika/opt/ruby-trunk/src/ruby/lib/rubygems/specification.rb:709:in `each'",
@nagachika
nagachika / gist:8018565
Last active December 31, 2015 17:09
diff of generated Makefile between r44256 and r44257
68,69c68,69
< CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I/usr/local/include $(DEFS) ${cppflags} $(INCFLAGS)
< LDFLAGS = $(CFLAGS) -L. -fstack-protector -L/usr/local/lib
---
> CPPFLAGS = -Idummy/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) ${cppflags} $(INCFLAGS)
> LDFLAGS = $(CFLAGS) -L. -fstack-protector
76c76
< DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -L/usr/local/lib $(XLDFLAGS) $(ARCH_FLAG)
---
> DLDFLAGS = $(XLDFLAGS) $(ARCH_FLAG)
@nagachika
nagachika / gist:6549187
Last active December 22, 2015 23:49
reproduce code for Refinements bug.
module M
refine(Fixnum) do
def foo
:foo
end
end
end
using M
p([0].map{|i| i.foo})
function echo_and_exec() {
echo $*
$*
ST=$?
if [ $ST -ne 0 ];
then
echo "エラー: exitstatus: ${ST}"
return 1
fi
}
diff --git a/test/ruby/test_fiber.rb b/test/ruby/test_fiber.rb
index 25a4608..fcf89bf 100644
--- a/test/ruby/test_fiber.rb
+++ b/test/ruby/test_fiber.rb
@@ -52,6 +52,7 @@ class TestFiber < Test::Unit::TestCase
(1..100).map{|ti|
Thread.new{
max.times{|i|
+IO.select([$stdin], nil, nil, 0) # print "" でも可。Thread.pass ではタイムアウト
Fiber.new{
@nagachika
nagachika / svn.rb
Created June 25, 2013 18:01
svn.rb
#!/usr/bin/env ruby
module Svn
class Revision
def initialize(str)
unless /r(\d+) \| (\S+) \| (\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} \S+)/ =~ str
raise "unrecognized svn log message #{str}"
end
@revision = Regexp.last_match(1)
@developer = Regexp.last_match(2)
@nagachika
nagachika / rubykaigi2013_S79_outline.md
Last active December 17, 2015 10:09
RubyKaigi2013 "CRuby Committers Who's Who in 2013 "

CRuby Committers Who's Who in 2013

自己紹介

  • @nagachika
  • CRuby committer
  • Ruby 2.0.0 ブランチメンテナ
  • Ruby 2.0.0-p195 リリースしました
  • ruby-trunk-changes 編者
  • Sound.rb
Ruby 2.0.0-p195 is released. This is the first patchlevel release of 2.0.0.
And there're many bug-fixes and some optimization, and documentation fixes.
# Downloads
ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p195.tar.bz2
SIZE: 10807456 bytes
MD5: 2f54faea6ee1ca500632ec3c0cb59cb6
SHA256: 0be32aef7a7ab6e3708cc1d65cd3e0a99fa801597194bbedd5799c11d652eb5b