Camelia, the Perl 6 bug

IRC log for #mojo, 2013-07-28

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:00 btyler joined #mojo
00:05 btyler joined #mojo
01:43 jnbek^dt joined #mojo
02:58 KindOne joined #mojo
03:22 asarch joined #mojo
03:24 basic6 joined #mojo
03:28 preflex_ joined #mojo
04:38 mattastrophe joined #mojo
04:50 mattastrophe joined #mojo
06:27 Britzel joined #mojo
06:28 sh4 joined #mojo
06:29 Mike-PerlRecruiter_ joined #mojo
06:31 ChinaXing joined #mojo
06:39 iankent joined #mojo
06:41 trone joined #mojo
06:52 Vandal joined #mojo
07:21 espent joined #mojo
07:24 d4rkie joined #mojo
07:49 marcusie joined #mojo
08:20 rem_lex| joined #mojo
08:32 laouji joined #mojo
08:36 wk joined #mojo
08:51 jzawodn joined #mojo
09:11 sh4 joined #mojo
09:14 sh4|2 joined #mojo
09:16 sh4|2 joined #mojo
09:23 basiliscos joined #mojo
10:00 bjoernfan Do you guys know of any tool I could use to manage layout of photos? Like cropping, placement and stuff. Basically a JS frontend for HTML editing, I guess.
10:14 jamesw well wouldn't you do most of that with css?
10:23 bjoernfan The result would be HTML+CSS, sure, but the interface to crop and do the layout would have to be in HTML+CSS+JS.
10:26 jamesw not seen a builder that targets images so specifically, no
10:30 bjoernfan Seen any other that might do the job, to maybe base something off of?
10:33 jamesw well there's LayoutIt or Maqetta maybe
10:34 delias joined #mojo
10:37 delias joined #mojo
10:38 bjoernfan Thanks, I'll check 'em out!
10:39 psimanx1 joined #mojo
10:39 psimanx1 joined #mojo
10:41 delias joined #mojo
10:44 ver joined #mojo
10:56 wk joined #mojo
11:31 sh4 joined #mojo
12:12 Moataz-E joined #mojo
12:13 sri hmmm
12:13 * sri wonders if Mojo::DOM::attrs should be deprecated in favor of Mojo::DOM::attr
12:14 sri $dom->find('a')->pluck(attr => 'href') looks better than $dom->find('a')->pluck(attrs => 'href')
12:15 sri the name was originally chosen when Mojo::DOM was still hash based and had attributes, but now it's array based and can't have attributes
12:15 sri so ::attr inherited from Mojo::Base serves no purpose there
12:17 * sri pokes marcus, tempire, jberger and crab
12:20 memowe Sounds good.
12:26 marcus sri: +1
12:32 sri \o/
12:33 good_news_everyone joined #mojo
12:33 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/dzD5sg
12:33 good_news_everyone mojo/master 1bf35c3 Sebastian Riedel: deprecated Mojo::DOM::attrs in favor of Mojo::DOM::attr
12:33 good_news_everyone left #mojo
12:49 good_news_everyone joined #mojo
12:49 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/HBc-CQ
12:49 good_news_everyone mojo/master 399e68c Sebastian Riedel: better fork-safety description
12:49 good_news_everyone left #mojo
12:52 good_news_everyone joined #mojo
12:52 good_news_everyone [mojo] kraih tagged v4.20 at 60a20e7: http://git.io/kc_ZlA
12:52 good_news_everyone left #mojo
12:55 Moataz-E joined #mojo
12:58 crab sri: +1 too
12:58 sri \o/
13:07 * sri heads off to run his usual 5km
13:13 chansen joined #mojo
13:23 jberger sri: fine by me
13:25 jberger +1
13:37 sri \o/
13:53 KindTwo joined #mojo
13:59 gryphon joined #mojo
14:16 asarch joined #mojo
14:44 d4rkie joined #mojo
14:45 zivester joined #mojo
15:01 sri hmmm
15:01 crab +1
15:01 sri hahahahahaha
15:01 sri \o/
15:01 crab :-)
15:02 * sri wonders if Mojo::Collection::compact would be a good idea, it could remove all falsy values
15:02 sri (stolen from underscore.js)
15:04 sri my @hrefs = $dom->find('*')->pluck(attr => 'href')->compact->each;
15:07 * sri currently uses ->grep(sub {defined})
15:09 sri ruby also has a compact method
15:09 sri so i suppose it was originally stolen from there
15:10 sri ruby version only removes nil though, which is equal to undef
15:11 sri that would work for me too
15:11 sri sub compact { shift->grep(sub {defined}) }
15:12 marcus sub-compact publishing
15:25 bowtie_ joined #mojo
15:29 basiliscos joined #mojo
15:53 btyler joined #mojo
16:14 jberger sri: that sounds very useful
16:16 basiliscos joined #mojo
16:16 jberger also, subclassing Mojo::Base AND exporting another function was a tricky thing :-)
16:18 Britzel joined #mojo
16:23 sri jberger: the defined or falsy check version?
16:23 jberger defined at least
16:23 jberger perhaps some mechanism to handle falsey
16:24 sri jberger: you can only choose one :)
16:24 jberger ->compact(1) :-)
16:24 sri no!
16:24 jberger remove all falsy values
16:24 jberger hahahah
16:24 jberger I expected that
16:25 jberger most cases that I can think of, a defined but perl-ly false value is useful information
16:26 jberger no, that's not totally true
16:26 jberger hmmm
16:26 jberger 0 is often useful
16:26 jberger '' might not be so much
16:26 jberger I'm thinking of scraping contexts here mostly
16:27 * sri is not sure either which one would be the best choice
16:27 sri gonna think some more about it
16:28 jberger IMO, checking defined is an easy win, once you try to go beyond that the use-cases start to diverge
16:28 sri not like ->grep(sub {defined}) and ->grep(sub {!!$_}) are that bad
16:28 jberger no, and they convey their meaning
16:29 jberger but most of the utility methods in ::Collection have longer equivalents (don't go removing them! hehe)
16:30 sri it's mostly the undefined values that annoy me though
16:30 jberger right, I agree with you
16:31 jberger those are almost never useful in a collection
16:32 * jberger is working on a tiny model layer for Mango
16:32 * jberger misses being able to call result-set methods
16:57 jberger sri: is this example correct? https://github.com/kraih/mojo/blo​b/master/lib/Mojo/Loader.pm#L133
16:58 jberger if Mojo::Loader returns true but not an object, that doesn't indicate 'already loaded' but 'not found' right?
17:01 Vandal joined #mojo
17:03 sri jberger: you're right
17:03 good_news_everyone joined #mojo
17:03 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/7LvXnw
17:03 good_news_everyone mojo/master 6dac40b Sebastian Riedel: fixed Mojo::Loader example
17:03 good_news_everyone left #mojo
17:04 * sri has been thinking about a Mojo::DOM method to filter out unwanted tags
17:05 jberger sri: for example?
17:06 sri $dom->only(qw(div p pre a)) perhaps
17:07 sri all other tags would get removed but their content preserved
17:08 sri it can be done already, but not very efficient
17:10 sri $dom->find('*')->grep(sub { $_->type ne 'div' })->each(sub { $_->replace($_->content_xml) })
17:11 jberger seems reasonable
17:12 crab seems like a _slightly_ strange thing to want to do, but sure, why not
17:12 sri perl -Mojo -E 'my $dom = x("<div>A<p><div>B</div><a>C</a></p>D</div>"); $dom->find("*")->grep(sub { $_->type ne "div" })->each(sub { $_->replace($_->content_xml) }); say $dom'
17:12 sri example!
17:12 sri crab: it's extremely common actually
17:13 sri who doesn't scrub unwanted tags from their html input?
17:13 sri LETS JUST KEEP THESE SCRIPT TAGS IN OUR USER GENERATED CONTENT!!!
17:14 sri famous last words
17:15 jberger oh, that's not what I was thinking you meant, but that does also seem reasonable
17:15 sri hat did you think i mean?
17:16 jberger (what I was thinking about is essentially comma joined selectors)
17:16 sri we already support those
17:16 jberger right :-)
17:16 jberger my brain is in model land
17:17 jberger actually that sounds handy for Galileo
17:18 sri i suppose an efficient way to remove a tag while preserving its content would be enough to make Mojo::DOM good at scrubbing
17:18 jberger my javascript markdown editor can do scrubbing, but I have to do it when I display the engine, which makes things hard to do
17:19 sri jquery has a .unwrap method... but that only removes the parent
17:24 sri i guess $dom->find('*')->grep(sub { $_->type ne 'p' })->each(sub { $_->strip }) would work
17:24 sri ->strip as an alternative to ->remove
17:25 sri remove element, but leave content alone
17:25 sri ->prune sounds better though
17:40 bpmedley joined #mojo
17:41 sri oh, i also forgot about the :not() pseudo class
17:48 sri hmmm, i guess i have an implementation
17:49 sri erl -Mojo -E 'my $dom = x("<div>A<p><div>B</div><a>C</a></p>D</div>"); $dom->find(":not(div)")->pluck('strip'); say $dom'
17:49 sri <div>A<div>B</div>D</div>
17:49 sri kinda cute
17:50 sri selectors like :not(div):not(p) also work to whitelist more
17:50 jberger not sure I knew about :not
17:50 jberger sri++
17:52 sri two open questions, what does ->strip return, and what name to give the method... ->strip, ->prune, ->unwrap...
17:57 sri i tend towards returning the parent element
17:59 jberger if the idea is to scrub, presumably you then want to store it somewhere or else render it, so yeah, returning the parent seems sane
18:00 jberger sri: question, if I want to have a default Mojolicious app (so a model instance on its own has one) should I use Mojolicious or Mojo::HelloWorld?
18:00 sri stop right there
18:00 sri i don't think a model should know anything about the app
18:01 jberger I need to be able to get at helpers
18:01 jberger I generally agree with you
18:02 jberger I guess I could do without it, but there are some really nice helpers I want to use
18:02 jberger Mojolicious::Plugin::Bcrypt being one
18:05 jberger it also would let me cache some data in helpers
18:05 jberger though that is of questionable value
18:17 sri ohoh
18:17 * sri found quite a few big bugs in remove/replace
18:18 sri the return value is actually wrong
18:18 sri it can't work the way it's documented :S
18:27 basiliscos joined #mojo
18:29 Mike-PerlRecruiter_ joined #mojo
18:30 sri we can't actually return the removed element tree, because we perform destructive operations on it :S
18:30 sri so the return value is extremely inconsistent and often broken
18:31 sri i bet fixing it will break a few things
18:32 sri only real solution i see would be to return the parent consistently instead of the removed element
18:38 mst sri: you could check for void context
18:39 mst sri: and copy the removed element tree before destroying it to return it if not
18:39 mst sri: this might or might not be worse though :)
18:39 * sri runs away screaming
19:00 marcusie joined #mojo
19:03 good_news_everyone joined #mojo
19:03 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/b5GOuA
19:03 good_news_everyone mojo/master 1773cb9 Sebastian Riedel: added strip method to Mojo::DOM and fixed a few return value bugs
19:03 good_news_everyone left #mojo
19:05 sri https://github.com/kraih/mojo/commit/1773c​b9e0b2260eded5d88b3954ac523736805d8#L2R335
19:05 sri that makes html scrubbing rather conveninent
19:11 marcus conlenient
19:13 sri thinking some more about it... i would actually be surprised if anyone really depends on one of the few cases where return values were correct
19:13 sri our examples were mostly just ->remove->root... which still works
19:15 sri and back to Mojo::Collection::compact
19:15 sri not actually sure anymore we have that many use cases for it
19:15 sri ->attr, ->namespace and friends return an empty string if they can't find anything
19:16 sri just ->next/->previous/->parent that can return undef
19:21 good_news_everyone joined #mojo
19:21 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/W9_ndQ
19:21 good_news_everyone mojo/master abb4c06 Sebastian Riedel: added example for HTML scrubbing
19:21 good_news_everyone left #mojo
19:25 sri jqlite from angular is actually a good list of the most essential jquery methods :) http://docs.angularjs.org/api/angular.element
19:28 sri the one thing i might be interested in is wrap()
19:29 sri if only the api wasn't so damn ugly
19:51 alnewkirk someone should update the cookbook with instructions on how to avoid the generated favicon, not-found and exception content, imho
19:58 denisboyun joined #mojo
20:03 good_news_everyone joined #mojo
20:03 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/y2uvYg
20:03 good_news_everyone mojo/master 805d75d Sebastian Riedel: fixed Mojo::DOM formatting
20:03 good_news_everyone left #mojo
20:10 marcus alnewkirk: I agree. Pull request?
20:10 sri someone should read the documentation
20:11 sri sooo, i suppose ->strip is the right name for the method?
20:16 good_news_everyone joined #mojo
20:16 good_news_everyone [mojo] kraih tagged v4.21 at 8caa65f: http://git.io/d4Aznw
20:16 good_news_everyone left #mojo
20:24 maxhq joined #mojo
20:27 bluescreen joined #mojo
20:28 marty joined #mojo
20:51 bluescreen_ joined #mojo
20:56 Moataz-E joined #mojo
21:14 trone joined #mojo
21:26 Moataz-E joined #mojo
21:29 bluescreen joined #mojo
21:35 basiliscos joined #mojo
21:36 phips|mac joined #mojo
21:48 basiliscos joined #mojo
22:05 basiliscos1 joined #mojo
22:19 Moataz-E joined #mojo
22:41 punter joined #mojo
22:44 Moataz-E joined #mojo
23:03 good_news_everyone joined #mojo
23:03 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/t7wrRg
23:03 good_news_everyone mojo/master 019b22f Sebastian Riedel: small optimizations
23:03 good_news_everyone left #mojo

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary