These are chat archives for opal/opal

18th
Nov 2015
George Plymale II
@ylluminarious
Nov 18 2015 06:23
here's a question of curiosity about requiring in opal if anyone feels like answering: http://stackoverflow.com/questions/33773098/how-and-where-does-the-require-table-variable-get-stored-opalrb
Elia Schito
@elia
Nov 18 2015 09:11
@ylluminarious done, it's great to see people read through the runtime!
George Plymale II
@ylluminarious
Nov 18 2015 14:29
@elia thanks for clearing that up! i went ahead and accepted your answer.
Elia Schito
@elia
Nov 18 2015 14:29
:+1:
Martin Becker
@Thermatix
Nov 18 2015 16:31
can the Opal::Server serve images?
because I'm doing s.append_path 'assets/images/'
and then doing src= "/assets/images/spinner.GIF" for an img tag
but it's just going not found
Elia Schito
@elia
Nov 18 2015 16:32
@Thermatix yes, it's sprockets at its core
Martin Becker
@Thermatix
Nov 18 2015 16:32
so what am I doing wrong?
Elia Schito
@elia
Nov 18 2015 16:33
try with "/assets/spinner.GIF"
if you append assets/images sprockets will search directly into images/
Martin Becker
@Thermatix
Nov 18 2015 16:34
just tried that, and "/images/spinner.GIF" and "spinner.GIF"
and still no dice
Elia Schito
@elia
Nov 18 2015 16:37
try appending 'asset/images' without the slash
Martin Becker
@Thermatix
Nov 18 2015 16:39
but I'm already appending without the slash
Elia Schito
@elia
Nov 18 2015 16:41
try pasting the whole chunk of code, I'm afraid you need to start debugging :)
best chance is to inspect the sprockets env paths
also the upcased "GIF" looks suspicious…
Martin Becker
@Thermatix
Nov 18 2015 16:43
I changed that
but not differance
I think I might just skip the whole spinner thing
here's my code:

opal = Opal::Server.new {|s|
  s.append_path 'assets/javascripts/'
  s.append_path 'assets/images/'
  s.main = 'application'
}
Elia Schito
@elia
Nov 18 2015 16:45
and how you reference js/opal files in your html?
Martin Becker
@Thermatix
Nov 18 2015 16:46
This message was deleted
<<-HTML
<script src="#{prefix}/application.js"></script>
  <script>#{Opal::Processor.load_asset_code(sprockets, 'application')}</script>
HTML
Elia Schito
@elia
Nov 18 2015 16:48
    def append_path path
      @sprockets.append_path path
    end
this the append_path implementation, src="#{prefix}/spinner.gif" should work fine
at this point I'd check for typos if it were my code
CJ Lazell
@cj
Nov 18 2015 20:08
I found something strange with inherited:
will show two puts if you then run the command it will only show one puts which is wrong…. if you then run against opal 9 it will fail completely saying wedge_class is nil
when you run in any version of ruby you’ll get two puts
Elia Schito
@elia
Nov 18 2015 20:09
@cj can you open an issue, looks like something that should be fixed before the release
CJ Lazell
@cj
Nov 18 2015 20:10
@elia sure thing
@elia opal/opal#1196
Elia Schito
@elia
Nov 18 2015 20:15
thanks
CJ Lazell
@cj
Nov 18 2015 20:15
no problem
CJ Lazell
@cj
Nov 18 2015 20:41
It might be a bigger issue than just inherited, take a look at that last example that fails
CJ Lazell
@cj
Nov 18 2015 20:59
ok, it appears to be super
also http://opalrb.org/try appears to be using two different versions of Opal
Elia Schito
@elia
Nov 18 2015 21:01
@cj if you have time please help by reducing the code that causes the issue to the bare minimum and post it directly in the issue
CJ Lazell
@cj
Nov 18 2015 21:02
I’ve been trying to do that :)
Elia Schito
@elia
Nov 18 2015 21:04
Yeah I see that :smile: and appreciate, the more you can do the better, as time permits of course
CJ Lazell
@cj
Nov 18 2015 21:10
@elia holy crap this is random… not sure if its a fail on ruby though
so if wedge_classis nil and you run this via opal wedge_class::Storeyou get this error
'undefined' is not an object (evaluating '(self.$wedge_class()).$$scope.get')
if you run it in ruby, it works just fine
so I tried nil::Store and that works just fine in ruby too
ruby 2.1.4p265
shouldn’t ruby be throwing an error?
Chris Watson
@watzon
Nov 18 2015 21:17
Anyone have a good guide for wrapping a javascript library with Opal? I'd like to try it with https://github.com/allouis/minivents, but I have no idea how to get started
you also might look at some other opal wrappers like opal-phaser, opal-browser, opal-jquery, react.rb, etc.
Chris Watson
@watzon
Nov 18 2015 21:28
Awesome! That's exactly what I'm looking for. I see a lot of potential in this project and want to get involved
George Plymale II
@ylluminarious
Nov 18 2015 21:28
@iDev0urer yeah, definitely agree on that ;)
i've had a lot of good experience with opal for as long as i've used it, and have even forgotten what it's like to write js from time to time thanks to opal :D
Mitch VanDuyn
@catmando
Nov 18 2015 22:03
@iDev0urer also have a look at https://github.com/catprintlabs/opal-aasm not a wrapper but it runs acts-as-state-machine in opal. Also if you want to use react.rb then the gitter.im is pretty active if you have questions.
jusjmkim
@jusjmkim
Nov 18 2015 22:24
I've just started looking at Opal, and I was curious. Which version of ECMAscript does Opal compile Ruby to?
meh.
@meh
Nov 18 2015 22:24
jusjmkim, it should even run on IE 6
Mitch VanDuyn
@catmando
Nov 18 2015 22:57
@/all has anybody noticed that e.backtrace (where e is an Exception) is empty on safari?
Colin Gunn
@balmoral
Nov 18 2015 23:12
@iDev0urer https://github.com/balmoral/opal-highcharts is a pretty straightforward opal wrapping of the Highcharts javascript library. You can see it in action (via Volt) at http://volt-highcharts-app.herokuapp.com.
Martin Becker
@Thermatix
Nov 18 2015 23:33
@catmando I wouldn't know... I mean I use a mac but I switched to chrome straight away...
Elia Schito
@elia
Nov 18 2015 23:34
@catmando been a while since I poked around with backtrace
CJ Lazell
@cj
Nov 18 2015 23:35
@elia thank you for cleaning up my examples. did you see my other message above? should I open a ticket for it?
Mitch VanDuyn
@catmando
Nov 18 2015 23:35
looking at the code, its not clear where .stack gets set, but if its not set, then backtrace returns an empty array, so I am assuming that .stack is not getting set on safari. Not a biggie...
Martin Becker
@Thermatix
Nov 18 2015 23:36
wouldn't that happen on any browser? what's special about safari? Isn't this not the first time there's been a safari specific issue?

SafariIsTheNewIE9

Elia Schito
@elia
Nov 18 2015 23:37
stack traces have no standard IIRC, thus every browser do its own thing
Martin Becker
@Thermatix
Nov 18 2015 23:37
... that was supposed to be hash-tag...
so why does backtracing work every where but safari?
or...
Elia Schito
@elia
Nov 18 2015 23:37
truth is that Chrome is the new IE, since there's already a number of sites that are "Chrome-only"… :P
Martin Becker
@Thermatix
Nov 18 2015 23:38
LOL really?
link me!
CJ Lazell
@cj
Nov 18 2015 23:38
I’ve been saying Chrome is the new IE for awhile! It’s sooo bloated now
Elia Schito
@elia
Nov 18 2015 23:38
google "cool web design" :D
Martin Becker
@Thermatix
Nov 18 2015 23:38
btw, just subscribed to netflix
and then?
ugh bloat was why I ditched firefox
I'm getting the Feeling I'm going to have to do it again...
and opera is just chrome with a mask
Elia Schito
@elia
Nov 18 2015 23:40
since Apple cares about battery stats they put a lot of effort to make it very lightweight
Martin Becker
@Thermatix
Nov 18 2015 23:40
... soooo safari is what I should then switch to?
nvm
I'm going to go and look for a new browser
Elia Schito
@elia
Nov 18 2015 23:41
I use that and TextMate 2, it gives me that hipster-y feeling, you know…
Martin Becker
@Thermatix
Nov 18 2015 23:41
LOL
I use atom
I ditched sublime becuase...
eh don't remember but I did
Elia Schito
@elia
Nov 18 2015 23:41
that's so mainstream :joy_cat:
Martin Becker
@Thermatix
Nov 18 2015 23:41
ha!
CJ Lazell
@cj
Nov 18 2015 23:42
@elia using the example on opalrb.org http://goo.gl/Lp9MQa
Elia Schito
@elia
Nov 18 2015 23:42
nil::User? does it work in MRI?
CJ Lazell
@cj
Nov 18 2015 23:43
yeep
Martin Becker
@Thermatix
Nov 18 2015 23:43
it's this line user = ((nil).$$scope.get('User')).$new("Bob");
line 28
why would you do nil::User?
CJ Lazell
@cj
Nov 18 2015 23:44
I wouldn’t seems like its a bug in ruby
Elia Schito
@elia
Nov 18 2015 23:44
so who's up to adding a $$scope to nil? had enough for tonite (opal/opal@b032404)
CJ Lazell
@cj
Nov 18 2015 23:45
I just ran into it randomly lol :)
Martin Becker
@Thermatix
Nov 18 2015 23:45
nooo I got my own problems to deal with, I need to refine,document and create tests
CJ Lazell
@cj
Nov 18 2015 23:45
that commit message! LOL
Martin Becker
@Thermatix
Nov 18 2015 23:45
any way, afk, got some daredevil to watch then... back to work!
Elia Schito
@elia
Nov 18 2015 23:46
[alias]
  snap = "!sh -c \"git add -A; git commit -u -m '[snapshot] $*'\""
  yolo = "!sh -c 'git add -A; git commit -u -m \"YOLO! $1\"'"
  y = "!sh -c 'git add -A; git commit -u -m \"YOLO! $1\"'"
  mega-yolo = "!sh -c \"git add -A && git commit -u -m 'MEGA-YOLO!1!! $*'\""
from my .gitconfig
CJ Lazell
@cj
Nov 18 2015 23:47
ha, nice :)
elia @elia goes to sleep
CJ Lazell
@cj
Nov 18 2015 23:50
k, opened a ticket opal/opal#1197