Skip to content

Instantly share code, notes, and snippets.

View scalone's full-sized avatar

Thiago Scalone scalone

  • CloudWalk
  • São Paulo / SP
View GitHub Profile
2.0.0-p247 :001 > gets
123456789
=> "123456789\n"
2.0.0-p247 :002 > gets("5")
1
2
3
4
5
=> "1\n2\n3\n4\n5"
module V1Compatibility
def self.flat(klass)
# create alias or change behaviour
class << klass::IO
def getc
puts "method getc old behaviour"
end
alias_method :read_card_old, :read_card
end
if (IDE.settings.is_ruby) {
// EMULATING RUBY CODE
// --- DEVELOPMENT ---
console.log("LAST MRB IN B64", IDE.compiler.last_result.mrb);
// --- DEVELOPMENT ---
b = new Uint8Array(atob(IDE.compiler.last_result.mrb).split("").map(function(c) { return c.charCodeAt(0); }));
webruby.run_source(emulator.code.POS);
webruby.run_source("IO.display(0,0,'lol')");
//webruby.run_bytecode(b);
}
module Kernel
def _load(path)
raise NotImplementedError.new "'require' method depends on File" unless Object.const_defined?(:File)
raise TypeError unless path.class == String
if File.exist?(path) && File.extname(path) == ".mrb"
_load_mrb_file path
elsif File.exist?(path)
_load_rb_str File.open(path).read.to_s, path
else
IO.display 0, 0, "Start"
begin
IO.getc
a = load("./show.mrb")
p "AAAAAAA"
rescue => @e
p @e.inspect
p @e.backtrace
end
int webruby_internal_compile(mrb_state* mrb, const char *file_name, const char *code, int print_level)
{
mrb_value result;
int ret = -1;
int debuginfo = 0;
mrb_irep *irep;
mrbc_context *cxt;
cxt = mrbc_context_new(mrb);
cxt->no_exec = 1;
Got POS emulator.js:923
We already had jQuery ;) emulator.js:939
Got emulator emulator.js:923
Got sockfs emulator.js:923
Got interpreter emulator.js:923
Got webruby emulator.js:923
SOCKFS.mount function VM1002:144
SOCKFS.createSocket function VM1002:144
SOCKFS.getSocket function VM1002:144
SOCKFS.stream_ops object VM1002:144
IO.display 0, 0, "Start"
begin
#IO.getc
a = load("./show.mrb")
p "AAAAAAA"
rescue => @e
p @e.inspect
p @e.backtrace
end
IO.display 0, 0, "Start"
begin
IO.getc
a = load("./show.mrb")
p "AAAAAAA"
rescue => @e
p @e.inspect
p @e.backtrace
end
package main
import (
"fmt"
"bufio"
"net"
"io"
)
func main() {