3 ms·
Mruby – Ruby in your browser
- rtpg 13y agoI 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.
- siong1987 13y agoSince 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/ http://ejohn.org/blog/asmjs-javascript-compile-target/).
- choxi 13y agoVery 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 http://blog.bloc.io/running-ruby-in-your-browser Webruby (Mruby.js) was one of the options we considered but ultimately didn't use.
- edwinyzh 13y agoCool! When I read the title I immediately thought - it must be done via emscripten, and it turned out that I was right :)
- gunn 13y agoNice 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 13y agolocal scope is now fixed.
- MrBra 13y agoIt'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 13y agoThey did: https://gist.github.com/xxuejie/5023857 https://gist.github.com/xxuejie/5023857
- seivan 13y agoI 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 13y agoIn fact, I've made an mruby REPL for iOS: https://github.com/jzzocc/mirb-iOS https://github.com/jzzocc/mirb-iOS
- coderhs 13y agoMultiplying two large Fixnum, gives a float value.
- cheald 13y agoJavascript doesn't have integer types.
- adrianlmm 13y agoThis makes it crash 1000000.times{|i| puts "hello #{i}"}
- txrx 13y agocouple 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?')