Skip to content

Instantly share code, notes, and snippets.

View Watson1978's full-sized avatar

Watson Watson1978

View GitHub Profile
class Foo < String
ARG = ' '.freeze
def split(arg)
a = arg.source
if a == ARG
arg = ARG
end
super(arg)
end
end
diff --git a/vm_eval.c b/vm_eval.c
index a8764e2fa4..a278fe3a2e 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -46,6 +46,7 @@ rb_vm_call0(rb_execution_context_t *ec, VALUE recv, ID id, int argc, const VALUE
struct rb_calling_info calling_entry, *calling;
struct rb_call_info ci_entry;
struct rb_call_cache cc_entry;
+ VALUE val;
ruby$target:::method-entry
{
printf("method: %s#%s\n", copyinstr(arg0), copyinstr(arg1));
}
#line 1 "narray/gen/tmpl/lib.c"
/*
Ruby/Cumo::GSL - GSL wrapper for Ruby/Cumo::NArray
created on: 2017-03-11
Copyright (C) 2017 Masahiro Tanaka
Copyright (C) 2018 Naotoshi Seo
*/
def detect_project_root(path)
path = File.dirname(path)
if Dir.glob(File.join(path, ".git")).count > 0
return path
end
return nil if path == "/"
detect_project_root(path)
end
require 'benchmark/ips'
Benchmark.ips do |x|
x.report "Hash" do |loop|
{foo: 42, bar: "hello", baz: "test"}
end
end

セットアップ

$ brew install imagemagick@6
$ gem install nokogiri rmagick

(画像サイズの取得に RMagick を使用していて、それに imagemagick@6 が必要になります。)

/var/folders/fs/gltv6wcd3m70hcgqcp2njt_80000gn/T/ruby-build.20170606225220.2402 ~
/var/folders/fs/gltv6wcd3m70hcgqcp2njt_80000gn/T/ruby-build.20170606225220.2402/ruby-2.4.1 /var/folders/fs/gltv6wcd3m70hcgqcp2njt_80000gn/T/ruby-build.20170606225220.2402 ~
checking for ruby... /Users/watson/.rbenv/shims/ruby
checking build system type... x86_64-apple-darwin17.0.0
checking host system type... x86_64-apple-darwin17.0.0
checking target system type... x86_64-apple-darwin17.0.0
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
$ brew install imagemagick@6
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (caskroom/cask).
No changes to formulae.
==> Downloading https://homebrew.bintray.com/bottles/imagemagick@6-6.9.8-4.sierra.bottle.tar.gz
Already downloaded: /Users/watson/Library/Caches/Homebrew/imagemagick@6-6.9.8-4.sierra.bottle.tar.gz
==> Pouring imagemagick@6-6.9.8-4.sierra.bottle.tar.gz
==> Caveats
cc `llvm-config --cflags` -c sum.c
c++ `llvm-config --cxxflags --ldflags --libs core mcjit native --system-libs` sum.o -o sum