Skip to content

Instantly share code, notes, and snippets.

View jballanc's full-sized avatar

Joshua Ballanco jballanc

View GitHub Profile
def ack(m, n)
if m == 0
n + 1
elsif n == 0
ack(m - 1, 1)
else
ack(m - 1, ack(m, n - 1))
end
end
require 'thread'
require 'timeout'
class ObjectPool
attr_reader :max
attr_accessor :timeout
attr_accessor :create
attr_accessor :objects
attr_accessor :used
class Test
def say
puts "hello, world"
end
end
irb(main):001:0> class A
irb(main):002:1> def test(thing)
irb(main):003:2> puts "#{thing}! from class A!"
irb(main):004:2> end
irb(main):005:1> end
=> nil
irb(main):006:0> class B < A
irb(main):007:1> def test(thing)
irb(main):008:2> super(thing)
irb(main):009:2> puts "...and now from class B too!"
> cat hello.rb
puts "hello, world"
> macrubyc -o hello hello.rb
> file hello
hello: Mach-O 64-bit executable x86_64
> ./hello
hello, world
> otool -L ./hello
./hello:
/Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/libmacruby.dylib (compatibility version 0.5.0, current version 0.5.0)
irb(main):001:0> class String
irb(main):002:1> alias :foo :length
irb(main):003:1> end
=> nil
irb(main):004:0> "".foo
=> 0
irb(main):005:0>
Analysis of sampling macruby (pid 85471) every 1 millisecond
Call graph:
9295 Thread_4922375 DispatchQueue_1: com.apple.main-thread (serial)
9295 OBJC_CLASS_$_NSObject
9295 OBJC_CLASS_$_NSObject
9295 OBJC_CLASS_$_NSObject
9295 OBJC_CLASS_$_NSObject
9295 OBJC_CLASS_$_NSObject
9295 OBJC_CLASS_$_NSObject
9295 OBJC_CLASS_$_NSObject
diff --git a/spec/macruby/core/array_spec.rb b/spec/macruby/core/array_spec.rb
index 9bc6b7c..4dbbf69 100644
--- a/spec/macruby/core/array_spec.rb
+++ b/spec/macruby/core/array_spec.rb
@@ -79,3 +79,49 @@ describe "An NSArray object" do
end
=end
end
+
+describe "Objective-C Array methods" do
def parse_splat
split_splat = params[:splat][0].split('/')
[ split_splat.pop,
split_splat,
ITEM_LEVELS[split_splat.length] ]
end
diff --git a/dispatcher.cpp b/dispatcher.cpp
index 3eca605..612f697 100644
--- a/dispatcher.cpp
+++ b/dispatcher.cpp
@@ -18,7 +18,7 @@
#include <execinfo.h>
#include <dlfcn.h>
-#define ROXOR_VM_DEBUG 0
+#define ROXOR_VM_DEBUG 1