adambeynon changed the topic of #opal to: http://opalrb.org - Ruby runtime and library on top of Javascript | 1.0.0 is near | This channel is logged at http://irclog.whitequark.org/opal
<elia> gravityblast, bula
<gravityblast> bull' means bollate in milanese.
<gravityblast> *bula'*
<gravityblast> best city in the world.
<elia> gravityblast, enjoy your camo, this seems to be IE-day
<gravityblast> internet explorer?
<meh`> elia, all green on IE11 now
<meh`> I just need adambeynon to wake up and push a new opal-rspec gem
<elia> meh`, whoa
<meh`> also all green on Safari 5.1
<elia> meh`, lemme check if I have access
<elia> nope
<meh`> yeah, only he has access
<elia> I tricked him once in giving me access to some stuff…
<elia> gravityblast, yep
<elia> gravityblast, catch up on https://botbot.me/freenode/opal/
GitHub151 has joined #opal
<GitHub151> [opal] meh pushed 1 new commit to master: http://git.io/040eVQ
GitHub151 has left #opal [#opal]
<GitHub151> opal/master 8d72393 meh: Add Native::Object#merge!
<elia> welcome js extend
<gravityblast> too much camomilla, I could fall asleep before finishing thi
gravityblast has quit [Read error: Connection reset by peer]
mneorr_ has joined #opal
<elia> !m meh`
<[o__o]> You're doing good work, meh`!
<elia> good night ;)
<meh`> night
elia has quit [Quit: Computer has gone to sleep.]
mneorr has quit [Ping timeout: 245 seconds]
travis-ci has joined #opal
<travis-ci> [travis-ci] Build details : http://travis-ci.org/opal/opal/builds/17446109
<travis-ci> [travis-ci] opal/opal#1697 (master - 8d72393 : meh): The build was fixed.
travis-ci has left #opal [#opal]
mneorr_ has quit [Remote host closed the connection]
mneorr has joined #opal
mneorr has quit [Ping timeout: 245 seconds]
mneorr has joined #opal
fkchang has quit [Read error: Connection reset by peer]
GitHub11 has joined #opal
<GitHub11> opal/master a901ef4 meh: Use hasOwnProperty.call instead of calling the method...
<GitHub11> [opal] meh pushed 1 new commit to master: http://git.io/Nf4Cww
GitHub11 has left #opal [#opal]
travis-ci has joined #opal
travis-ci has left #opal [#opal]
<travis-ci> [travis-ci] opal/opal#1698 (master - a901ef4 : meh): The build passed.
<travis-ci> [travis-ci] Build details : http://travis-ci.org/opal/opal/builds/17450619
meh` has quit [Ping timeout: 246 seconds]
e_dub has joined #opal
e_dub has quit [Quit: e_dub]
e_dub has joined #opal
ryanstout has quit [Quit: ryanstout]
Liothen has quit [Quit: System of a down……]
ryanstout has joined #opal
ryanstout has quit [Client Quit]
e_dub has quit [Quit: e_dub]
wmnnd has quit [Ping timeout: 240 seconds]
marcandre has quit [Remote host closed the connection]
RoxasShadowRS has joined #opal
e_dub has joined #opal
RoxasShadowRS has quit [Read error: Connection reset by peer]
RoxasShadowRS has joined #opal
ivanoats has quit [Ping timeout: 246 seconds]
ivanoats has joined #opal
ylluminate has joined #opal
dfranciosi has joined #opal
wmnnd has joined #opal
wmnnd has quit [Ping timeout: 248 seconds]
DouweM has quit [Ping timeout: 272 seconds]
wmnnd has joined #opal
wmnnd has quit [Ping timeout: 272 seconds]
elia has joined #opal
wmnnd has joined #opal
wmnnd has quit [Ping timeout: 252 seconds]
<royvandermeij> How do you guys debug with opal?
<royvandermeij> `debugger` seems to do the trick
<royvandermeij> now how to figure out to get event.target in an change event
<elia> ryanstewart, are you using opal-jquery?
<elia> uuuuf, sorry ryanstewart
<elia> royvandermeij,
<royvandermeij> I am
<royvandermeij> trying out opal on a current simple project
<elia> .on(:change) { |event| event.current_target; event.target }
<royvandermeij> it returns <Element:undefined>
<royvandermeij> how strange
<elia> which version of opal / opal-jq?
<royvandermeij> when I do a `debugger` in the block and I ask voor event.target it returns the correct element
<royvandermeij> but not in opal
<royvandermeij> latest gem version in opal-rails
<elia> bundle show opal-jquery
<elia> to see the opal-jq version
<royvandermeij> 0.1.2
<elia> royvandermeij, doing event.target should return nothing, maybe it's event.native.target ?
<royvandermeij> hmm, i'll check
<royvandermeij> what is even weirder is that when I do `debugger` and in console I do e.$current_target() it returns the correct element
<royvandermeij> undefined method 'native' for #<Event:81>
<royvandermeij> is there a jsfiddle like way to show code?
<elia> not sure if opalrb.org/try has opal-jq
<elia> wait
<royvandermeij> oh how sweet :)
<elia> but I fear you can't generate links right now
<elia> royvandermeij, gist, pastebin, etc.
<elia> they're all good
<royvandermeij> ah i see
<royvandermeij> i'll make a gist
<royvandermeij> something like this
<royvandermeij> thats odd
<royvandermeij> e.target.add_class 'something' does work
<royvandermeij> strange, inspect on the e.target gives an undefined element
<royvandermeij> but code does work now
<elia> royvandermeij, the problem seems to be with #to_s of the event
<elia> if you replace #puts with #p correctly inspects the elements
<elia> royvandermeij, can you open an issue for this (minor) bug?
<royvandermeij> you are correct, p outputs correct information
<royvandermeij> it seems to_s isn't defined at all on element
<royvandermeij> inspect is
<royvandermeij> ah
<royvandermeij> Kernel#to_s gets self._id
<royvandermeij> and _id is undefined on Element
<royvandermeij> (i'm telling you all this because i'd like to do a pull request with the issue ;-) )
<royvandermeij> so what would be the desired output on to_s on an element?
<royvandermeij> just the same as inspect?
<elia> royvandermeij, I think the same as inspect makes sense
<elia> lacking anything more meaningful
wmnnd has joined #opal
wmnnd has quit [Ping timeout: 265 seconds]
<royvandermeij> hmm. as soon as I implement to_s the specs fail (commented out my own specs)
<royvandermeij> weird stuff
<royvandermeij> hmm.. the el used in inspect is sometimes Document
<royvandermeij> so tagName is undefined and calling toLowerCase() on undefined will throw an error
<royvandermeij> I have it working now, but it is a bit ugly
<royvandermeij> as in not dry
<royvandermeij> okay... which one is the lesser evil one
wmnnd has joined #opal
<elia> royvandermeij, you're implementing it on Element?
<royvandermeij> yeah
<royvandermeij> as inspect is also defined in Element
wmnnd has quit [Ping timeout: 260 seconds]
GitHub85 has joined #opal
GitHub85 has left #opal [#opal]
<GitHub85> [opal-jquery] roy opened pull request #35: Let Element#to_s behave the same as Element#inspect (master...master) http://git.io/2IevDg
<elia> royvandermeij, commented on the 2nd gist
<royvandermeij> inspect is definitely better
<royvandermeij> altough I dislike alias
<royvandermeij> but why the ...?
<royvandermeij> that also breaks to inspect spec
<royvandermeij> updated the pull request
meh` has joined #opal
<meh`> adambeynon, ping
e_dub has quit [Ping timeout: 272 seconds]
<elia> royvandermeij, curious on why you dislike alias
meh` changed the topic of #opal to: http://opalrb.org - Ruby runtime and library on top of Javascript | 1.0.0 is near | This channel is logged at https://botbot.me/freenode/opal/
wmnnd has joined #opal
<meh`> adambeynon, I SUMMON YOU
<adambeynon> meh`: hello
<meh`> adambeynon, can you push opal-rspec?
<adambeynon> meh`: away from laptop. Currently on my phone :/
<adambeynon> Be back home later though
e_dub has joined #opal
<elia> "adambeynon summoning" lol works every time
<elia> adambeynon, meh`, I think it would be good to have at least two pushers for each gem, to have backup
<meh`> elia, yeah
e_dub has quit [Quit: It's a hard knock life]
dfranciosi has quit [Remote host closed the connection]
<meh`> adambeynon, ping me when you push a new version
dfranciosi has joined #opal
marcandre has joined #opal
<meh`> I have 13 commits to push that I can't push because rspec :<
<elia> meh`, can't you git rspec in the gemfile meanwhile?
<meh`> elia, nope, in the git the rspec.js isn't built
<elia> meh`, I really dislike the prebuilt rspec.js, I remeber to have fixed that (requiring rspec 3 beta as a dep)
<elia> adambeynon removed it for the good (the dep) but maybe the harness is still there…
DouweM has joined #opal
fkchang has joined #opal
elia has quit [Ping timeout: 272 seconds]
ryanstout has joined #opal
Liothen has joined #opal
<royvandermeij> elia: I always find alias hard to read (even though I have been developing in Ruby for 8 years, and have thaught it at a university)
<royvandermeij> with a method definition it's instantly clear what it does
<royvandermeij> in my opinion that is totally worth the cost of 2 extra lines
<royvandermeij> s/thaught/taught
<meh`> royvandermeij, in naïve implementations an alias is different from a method calling another method
<meh`> performance wise
<royvandermeij> ah, I did not know that
<royvandermeij> interesting
<royvandermeij> I did already change the pull request to use alias
<meh`> I think only Rubinius is clever enough to inline those calls
<meh`> a call is a call, you're going deeper in the stack
<meh`> and when you think neither MRI nor JavaScript support TCO, it can become a big deal
<royvandermeij> true but if its marginal then it's a discussion of semantics in stead of performance ;-)
<royvandermeij> what is TCO?
<meh`> tail call optimization
<royvandermeij> aha
<royvandermeij> (still had to look it up hehe)
<royvandermeij> I only look for performance optimalisations when it hurts (so I dont optimise premature), but I understand that when your writing a framework you need it as fast as possible
DrShoggoth has joined #opal
wmnnd has quit [Ping timeout: 245 seconds]
<meh`> well, aliases are idiomic, and they're faster as well, so I don't see any downside in using them
<meh`> while the same isn't valid for methods just deferring to other methods
<meh`> now if only adambeynon came back on his laptop
<fkchang> Hey, so I remember a while before someone was looking for presentations on opal. I finally put my slides and video together in one place for that guy. http://funkworks.blogspot.com/2014/01/opal-new-hope-for-ruby-programmers.html
dfranciosi has quit [Remote host closed the connection]
[o__o] has left #opal [#opal]
DouweM has quit [Ping timeout: 252 seconds]
elia has joined #opal
[o__o] has joined #opal
DouweM has joined #opal
[o__o] has left #opal [#opal]
[o__o] has joined #opal
elia has quit [Quit: Computer has gone to sleep.]
elia has joined #opal
mneorr_ has joined #opal
mneorr has quit [Ping timeout: 245 seconds]
<fkchang> meh`: trying to use Lissio::Collection does this error ring a bell 'Uncaught NameError: uninitialized constant Object::REST'
<meh`> fkchang, are you using an adapter?
<meh`> the actual adapter is called Lissio::Adapter::REST
<meh`> fkchang, do you have opera 12.1 at hand?
<fkchang> meh`: I'm using the rest adapter, or so I think
<fkchang> class Cards < Lissio::Collection
<fkchang> model Card
<fkchang> adapter REST, '/localhost:4567' do
<fkchang> parse do |stories|
<fkchang> # alert stories
<fkchang> end
<fkchang> end
<meh`> yeah, unless you have defined your own REST
<fkchang> end
<meh`> it's just not finding the constant
<fkchang>
<fkchang> meh`: let me see what version of opera I have
<meh`> I'm fighting against a failing spec
<meh`> but can't find anything on Google
<fkchang> meh`: I have opera 12.16
<meh`> should be fine enough
<meh`> fkchang, try this
<meh`> in a console
<meh`> new MouseEvent("click")
<meh`> it should throw NOT_SUPPORTED_ERR
<fkchang> yes, it throws that error
<meh`> ok
<meh`> now here's the catch
<meh`> x = document.createEvent("MouseEvent");
<meh`> y = undefined
<meh`> x.initMouseEvent(true, true, y, 0, 0, 0, 0, 0, y, y, y, y, y, 0, null)
<meh`> this should return undefined
<fkchang> I got WRONG_ARGUMENTS_ERROR
<meh`> ff
<meh`> copied it wrong
<meh`> gimme a sec
<meh`> it's hard to copy by reading on the other screen
rageofmeh has joined #opal
<rageofmeh> x.initMouseEvent("click", true, true, undefined, 0, 0, 0, 0, 0, undefined, undefined, undefined, undefined, 0, null)
<meh`> basically, it's whining about type mismatches
<meh`> the thing is, I want to use the constructor and not the initMouseEvent
<meh`> this is because constructors are supported
<meh`> I'm just failing to find the properties it needs to have checked
<meh`> and I can't find what they are
mneorr_ has quit [Remote host closed the connection]
<meh`> in the specs I use mouse events
<meh`> so I'm getting failures only there
<fkchang> meh`: I think I figured it out, I was copying from the documentation and then gwentoo, I did not see that gwentoo defines REST, and thought it was the same as in the lissio doc, calling Lissio::Adapter::REST gets me pass that
<meh`> fkchang, yeah, defining your own subclass of REST is useful to add default parameters/behavior
<meh`> that is app-wide
mneorr has joined #opal
mneorr has quit [Remote host closed the connection]
mneorr has joined #opal
<fkchang> meh`: should Cards.fetch return a promise?
<meh`> fkchang, yes
wmnnd has joined #opal
<fkchang> ok, then I guess I don't know what to do with that promise
<meh`> Cards.fetch.then {|cards| }
<fkchang> thx, lemme try
<meh`> Cards.fetch.then {|cards| }.rescue {|error| }
<meh`> if the fetching fails
<fkchang> hmm, nothing seems to happen, I run "Models::Cards.fetch.then { |cards| puts cards; alert cards }.rescue{ |error| alert error }" and I don't get alerts of any kind
<meh`> fkchang, did you define the endpoint?
<meh`> when setting the adapter
<meh`> or check the network tab in the inspector
<fkchang> I might've done it wrong
<fkchang> I saw a typo,
<fkchang> can't I just do the following to hit a local sinatra app?
<fkchang> class Cards < Lissio::Collection
<fkchang> model Card
<fkchang> adapter Lissio::Adapter::REST, 'http://localhost:4567'
<meh`> is the endpoint /cards?
<meh`> also no, I don't think that's how the standard REST is configured
<fkchang> no the sinatra endpoint is just / right now, does it have to be cards? I can try that
<meh`> adapter Lissio::Adapter::REST, domain: 'localhost:4567', endpoint: '/'
<fkchang> meh`: improved, now I have the cross domain error
<meh`> you can fix it by changing the behavior in the http block
<meh`> but that doesn't depend on me
<meh`> it's how the browser behaves
<meh`> fkchang, see the headers.clear I do in gwentoo
<meh`> I have to add a cross origin check to avoid adding the default headers
<fkchang> so I have to define my own REST adapter to do that, like in gwentoo?
<meh`> yes, or pass the block to every model/collection you define the adapter at
<meh`> that's why I subclass it
<meh`> so you can add the default domain
<meh`> and other options
<meh`> and DRY it up
<fkchang> meh`: hmm, I did what u did in gwntoo, minus the lang = Gwentto.language bit, and I get undefined call for nil
<fkchang> class REST < Lissio::Adapter::REST
<fkchang> def initialize(model, point = nil, options = {}, &block)
<fkchang> super(model, options) do
<fkchang> base "http://localhost:4567"
<fkchang> endpoint point if point
<fkchang> http do |req|
<fkchang> req.headers.clear
<fkchang> end
<fkchang>
<fkchang> instance_exec(&block) if block
<fkchang> end
<fkchang> end
<fkchang>
<fkchang> end
<fkchang>
<meh`> where do you get undefined call?
<fkchang> looks like to()
<meh`> to?
<fkchang> in Adapter
<fkchang> being called by fetch
<meh`> fkchang, are you running on master?
<fkchang> it's probalby been a few days since I did a bundle update
<fkchang> actually, closer to a week
<meh`> mh, I don't remember if I fixed anything
<meh`> but it's definitely weird
<fkchang> I can try
<fkchang> meh`: pooh, did an update, now app doesn't work. Will look at it later
RoxasShadowRS has quit [Quit: Leaving]