
Mruby – Ruby in your browser - NatW
http://joshnuss.github.io/mruby-web-irb/
======
siong1987
Since this project depends on webruby and webruby uses emscripten, it could
get close to 2x native performance in browser(only firefox nightly) because of
the awesome asm.js support.

I am a big supporter of asm.js after reading John Resig's post on
it(<http://ejohn.org/blog/asmjs-javascript-compile-target/>).

------
gunn
Nice to see! Some things are working very well:

    
    
      >> class Fixnum; def even?; self%2==0; end; end;
      >> (1..100).to_a.select{|i| i.even? }
    

But some basic things are broken:

    
    
      >> n = 5
      => 5
      >> n
      => RuntimeError: arena overflow error

~~~
txrx
local scope is now fixed.

------
choxi
Very cool. We wrote a post about different techniques to getting Ruby in the
browser on our blog: <http://blog.bloc.io/running-ruby-in-your-browser>

Webruby (Mruby.js) was one of the options we considered but ultimately didn't
use.

------
rtpg
I was at a talk on mruby at a recent conference. It's some interesting stuff:
the program size footprint is only something like 40k , and memory usage is
around the same when running. It was initially meant for embedded systems, but
seeing it here is also an interesting use case.

------
edwinyzh
Cool! When I read the title I immediately thought - it must be done via
emscripten, and it turned out that I was right :)

------
MrBra
It'd be nice if someone could show an example of a webpage embedding some ruby
code interacting with some js code/framework or something like html5 canvas.
Just to see how they "communicate".

~~~
orta
They did: <https://gist.github.com/xxuejie/5023857>

------
seivan
I remember you could also get it into iOS. Perfect if you wanted to script
some stuff in Ruby. I'm currently using JS for that, but Ruby should do as
well.

~~~
jzzocc
In fact, I've made an mruby REPL for iOS: <https://github.com/jzzocc/mirb-iOS>

------
coderhs
Multiplying two large Fixnum, gives a float value.

~~~
cheald
Javascript doesn't have integer types.

------
adrianlmm
This makes it crash

1000000.times{|i| puts "hello #{i}"}

------
txrx
couple of tips:

jquery's $() is aliased to j() in ruby. Try:

j('body').css background: 'pink'

window is alias to w(). E.g.:

w.alert('hello from ruby')

puts w.prompt('saywhat?')

