« first day (420 days earlier)      last day (4528 days later) » 

<script type="text/javascript">
  /*
    Seriously, learn Javascript, not just jQuery.
    And please, don't use w3schools.com as a learning material.
  */
</script>
\o/
 
yeah noticed that as well :D
also, first result in google for that question \o/
 
@Raynos I was deeply saddened to see the guy organizing a "startups" meetup here in town, with 50 attending, list "PHP, Java, HTML, CSS, and jQuery" and his fucking resume and no javascript
s/and/on
 
@ThomasBlobaum You can edit your messages here. Like this!
 
4:09 PM
s/ should edit messages
 
@ThomasBlobaum trolololol.
0
Q: hand optimising javascript selector function

RaynosI personally want a small selector function that covers the three common cases getElementById getElementsByClassName getElementsByTagName It should support contexts and should not support querySelectorAll since <opinionated> QSA is slow as hell and should be avoided </opinionated>...

>_>
 
@Raynos I see youve begun working on jQuery 2.0
 
Nop.
It's just a useful utility function
because the rest is verbose as hell
 
why cant i post on that website
 
because you didnt log in?
 
4:12 PM
You need to create an account, because we're not in Kansas Stack Overflow any more
 
0
Q: hand optimising javascript selector function

RaynosI personally want a small selector function that covers the three common cases getElementById getElementsByClassName getElementsByTagName It should support contexts and should not support querySelectorAll since <opinionated> QSA is slow as hell and should be avoided </opinionated>...

 
@Raynos If you think querySelectorAll is slow as hell, then why not benchmark it against querySelectorAll?
Comparing it to jQuery is just silly
 
Fair enough
That's probably fairer
QSA is slower then jQuery -.-
 
Wut?
 
I told you QSA is slow as hell
 
4:18 PM
one sec
 
Okay, so jQuery must have some string parsing logic behind it, but uh...
Shouldn't querySelectorAll have the same optimization natively?
 
It should
browser vendors suck
 
I got it half as fast as native
one sec, will post
 
@Raynos there happened something strange in opera
 
I see jQuery performing better than querySelectorAll on the latest Firefox stable
 
4:24 PM
your selecthash is fail. lol
 
It is
I fixed it now
 
@YiJiang thats because it parser for # and . and uses the real methods
 
select2 marginally slower
posting mine tothe thread
 
@Raynos I know, that should be obvious
But still, native optimization?
 
4:25 PM
natives doesnt optimise
 
the opera's result is fun .. even on my netbook
 
@tereško because its win?
 
done
 
@gsnedders wtf, why is opera's QSA a beast? THIS IS MADNESS. Your not allowed to have a fast dom
 
Posted
 
4:27 PM
guess that how "native optimization" looks like
 
random char
 
<div className="bar"></div>
 
Come on, its such a low hanging fruit that I can't believe the vendors haven't optimized for it yet
 
ouch
 
4:30 PM
<div className="bar"></div> again
do you really guys suck so much at HTML ?
 
oh i didnt do that lol
RAYNOS
 
LMAO
 
ok i updated it
 
Ahahaha :P
 
4:32 PM
done
 
@tereško what's wrong with not having self closing tags?
 
I like the By.x a lot better than Stringly-typed and it's very fast, almost same as natives
 
select3 looks like mine
hmm lol, no difference
trying it in chrome
 
@Raynos You're digging your own grave deeper and deeper. Look at the attribute.
 
again with the className
 
4:34 PM
ffff
HTML Y U NO SAME AS DOM DOM Y U NO SAME AS HTML
 
class is semi-reserved identifier
 
this is doing fairly well against native and By
 
@Raynos Because class is a reserved word in JavaScript
 
0
A: hand optimising javascript selector function

Thomas BlobaumThis is twice as slow as native (the original being 4x as slow) function select (selector, context) { var c = selector.charAt(0), method, context = context || document; if (c === '#') { selector = selector.substring(1); method = context.getElementById(se...

 
hmm ... its not my computer
looks like opera is really running the test there slower then the other browsers
 
4:36 PM
2.2mil ops to 1mil ops
opera only has a good UI, its js performance is lacking ;P
 
not really
 
var class = null
//SyntaxError: Unexpected reserved word

var lol = {"class": null}
lol.class
//null
 
Anyway, I think this is micro optimization. Though the performance of querySelectorAll was quite surprising
 
The weirdest thing about the DOM is the css access. CSS styles are with-hyphens, while DOM are camelCased. You can't find two less compatible naming conventions.
 
@YiJiang it is indeed micro optimising for the sake of micro optimising
However it should be noted that one should not use QSA when gEBI, gEBTN or gEBCN works
 
4:41 PM
yay mine is the winnar
 
@ThomasBlobaum just now finished running sunspider : Opera 11.60: 516.9ms , Firefox 8.0: 535.0ms
 
@ThomasBlobaum opera is far from slow.
 
there should not be such a huge difference in jspref, but there is
 
The only thing that made opera suck before was not doing ES5 which is now fixed
@tereško conclusing jsperf sucks o/
 
@tereško Hasn't Sunspider results bottomed out for all engines already?
 
4:42 PM
I mean it sucks for comparing cross browser speed. It's great for comparing different functions per browser
 
well , can you suggest some other benchamrking site ?
i just picked the one i knew
 
I love how by and native are the same in opera 11.6
 
Yeah, Sunspider is the most popular, hang on
 
@Raynos well .. the should be , shouldn't they
 
The problem with the newer benchmarks is that its all the vendors building them, so it feels like they're biased
 
4:44 PM
well .. get one from chrome
 
@tereško by has the overhead of getting a property of an object.
 
because i am testing opera VS firefox
 
@Raynos We cache the result of QSA. Everyone else only does for gEBTN/gEBCN, I believe.
 
what else can be done to select3?
 
@gsnedders how do I bully firefox/chrome into caching QSA?
 
4:45 PM
@YiJiang Nah, there is still movement on Sunspider, not just much.
 
well .. ok .. give me a benchmarking site, someone
 
@YiJiang Sunspider was written by Apple (in large part Oliver Hunt, I believe), so is no more neutral.
 
@Raynos That's an easy one
 
@gsnedders Dude. You have an exam on Monday, go study.
 
4:46 PM
@tereško jsperf... lol... which shows opera slower than everyone else
 
@Amaan No.
 
:P
 
@gsnedders To be fair the bias might not be intentional; different vendors may believe different areas are more important and thus optimize them more, which would also reflect in their benchmarks
 
@YiJiang - firefox 8.0: 1654 , opera 11.60: 2212 .. additionally firefox has only one tab opened , opera has like 30
 
4:48 PM
@YiJiang With V8 the bias isn't intensional: it's just they came up with a benchmark of what they thought was important and then wrote a engine that would be quick on it. Guess what, their engine is quick on it.
 
lame i cant upvote anything
 
@ThomasBlobaum Get 200 reps on SO, then you'll get 100 reps bonus on Code Review
 
@YiJiang Kraken arguably has some accidental bias as well, but it's equally plausible that it's deliberately checking you have things such as CSE.
 
so , basically jspref sucks
 
@YiJiang There enough radically different approaches in current JS engines that I'd be surprised if they all did equally well on all benchmarks. The implementations are just too different.
@tereško It's decent for comparing stuff on a single computer.
 
4:52 PM
@gsnedders When multiple people try to run the same test with the same browser the data becomes useless for comparing between browsers
 
@gsnedders not really .. firefox does everything 2-3x faster there then opera ... hell .. any browser works 2-3x faster there
 
@tereško That depends on what you're testing.
 
well .. you cannot test browsers with it
 
Hello, does anyone knows if is possible to highlight different languages inside the same "text block" using brushes, with syntaxhighlighter script?
like both php and javascript
 
@BeNdErR Don't think its possible
 
4:54 PM
@tereško I do genuinely believe what jsperf gives for JS/DOM/CSSOM performance, given it all run on a single computer. If you perceive one browser to be slower, are you sure it's JS/DOM/CSSOM perf that makes you think it is slower?
 
i honestly dont know
 
@YiJiang I tried to skew all results equally by running all of the browsers. I even ran IE9. :P
 
@TimStone Then someone comes along with IE6 and ruins the fun
 
@Raynos Y U NO WRITE CONDITIONAL BLOCKS LIKE A BOSS
 
@ThomasBlobaum ?
 
4:57 PM
hmmmmm ok, thanks.
another question abouth syntaxhighlighter: I have this little code:
<pre class="brush: js">
var a = 'hello'; //this should be a comment! ';'
var b = 'lol';
</pre>
 
@YiJiang That would just be, as @Raynos says, trolls.
 
it seems like
the interpreter interprets the second ' afterh the ; in the comment
as an opening quote
and not like part of the comment
any suggestion on how to fix this problem? because var b = ' is interpreted as a string
and is not what it is..
 
use another highlighting script, or fix the regex or whatever this one is using to "parse" the "tokens"
 
@IvoWetzel which script do you use/suggest?
 
I am getting 23% difference in jsperf for the exact same operations lol
this is also what weirds me out in jsperf: jsperf.com/homebrew-vs-native in google chrome the "homemade" is faster for me :o
 
5:07 PM
there is no difference for me
 
@Esailija bind is known to be in general slow and hard to implement natively
 
@gsnedders, the homeMade wasn't a real bind, it was optimized for 1 argument like dart does but it's still surprsing that one can do so =)
if I change it to apply( ctx, arguments ) it's slightly slower
so doing this: gist.github.com/1277224#L80 doesn't seem so bad after all? :P
 
@Esailija That isn't what the current Dart -> JS compiler produces :P
 
It got me wondering nevertheless :D
 
@IvoWetzel this is where I think the regex is made

regexLib : {
singleLineCComments : /\/\/.*$/gm,
multiLineCComments : /\/\*[\s\S]*?\*\//gm,

do you see something wrong?
 
5:15 PM
Hi, anyone who can help me with Sencha Touch?
You would make a man happy :)
 
Purchase Options
Sencha Touch Support from $299
Buy Now
 
haha, I only have one question
a simple one
 
sure
 
"Sencha Touch...make a man happy" I'm suspicious
 
Do I use Ext.Application on every page?
I am currently learning Sencha Touch and the guides so far has only dealt with one page. So in the index.js I have new Ext.Application(....), but should for example contact.js etc have new Ext.Application(...) too?
 
5:20 PM
do you use Ext.js?
 
Yes
 
Is the question "do I have to use Ext.Application on every page" or "so far, did I use Ext.Application on every page"? Former: If you do, ditch it. Gods shouldn't have a place in programming. Latter: We can't know
 
Huh
 
Kind of hard to answer... do I use jQuery.proxy on every page?
I tried googling but didn't see anyone using ext.application :D
 
5:24 PM
How do I make multiple pages in with Ext JS then?
If I have a contact page, index page, about page for example.
 
That's a very general and vague question.
 
yea, so don't bother then
 
but nobody else can answer very general and vague questions either :P
it's like asking how do I build a computer
 
Well, if you're asking if you need Ext.Application on every page, then I'm fairly certain you don't know what Ext.Application really does. Learn it first, and then you can answer your own question.
 
You should be looking for some getting started tutorials or something
Once you see a specific problem or something then you could ask about that
 
6:02 PM
Java I am sad. Why you maek somethin so simple, so complex
 
raynos do you use mongoose
 
I don't always write hello world in java... but when I do it takes me 100 lines
 
@Raynos y u so troll
this could be done
if (c === '#' || c === '.')
maybe.. or could jsut remove the last block entirely
also could test something else instead of charAt
 
6:21 PM
if ( methods[selector[0]] )
 
@ThomasBlobaum I dont like mongoose. I tried it once, it sucked
 
you dont play well with frameworks
 
charAt is supposed to be better
 
it seems
:)
 
@ThomasBlobaum no I tried mongoose when they massively changed their API
 
hey
6:23 PM
hey
 
so half the docs where like "it does this" and the other half was like "no, we trolling, it does this"
I then ragequitted
 
hey
I did the file upload via iframe. I use jQuery $("#my_form").submit();, and the target of the form is an iframe. Iframe returns text, my question is, how can I get the text returned from the iframe?
 
;_;
why u iframe
 
query the iframe DOM
 
hey
because i don't want to use messy plugins, when i can write code myself with 10 lines
 
6:26 PM
$("#iframe")[0].contentWindow.document.getElementById("text").textContent
 
hey
@Esailija: Can you show me how?
my code:
$('.submitbutton').click(function() {
$("#my_form").submit();
})
 
@Raynos you then read the source
 
It really depends what's inside the iframe...
 
hey
only text
 
@Raynos anywho i realeased a new thing github.com/tblobaum/mongoose-troop
 
6:27 PM
yeah but what dom element is the text in
if you only have text then it's inside the body element of the iframe as text only is illegal html and the browser then creates body etc for you
 
hey
When I use alert($('#my_iframe').contents());
it just returns Object object
 
@ThomasBlobaum back when i tried mongoose I was still a little noob :(
Something like aug 2010
Ok, ehm. I probably havn't touched mongoose in a year :D
Damn my biased opinion
@ThomasBlobaum I can't downvote github repos, but if I could i would
which idiot publishes an empty readme
 
Y U SO TROLL
 
hey
so, anyone has any ideas, please?
 
You should check out those plugins for mongoose, pretty wicked cool.
Forget the README, real programmers dont need that
 
6:31 PM
@hey, try alert($('#my_iframe').contents().find("body").text());
after the request is complete
 
mongoose-troop adds some of the goodies from redis and couchdb to mongooose
it is pretty useful, i couldnt live without it
 
@ThomasBlobaum seriously though, where's my f'ing readme. and mongoose plugins are so trolls :D
 
filter.js removes properties from your model that arent in your schema
merge.js lets you merge two documents together without creating a new model (which sometimes causes _id/index conflicts)
 
I just use redis and couchdb, job done.
 
so it fixes that
publishOnSave.js publishes all your models when they are saved based on a stream convention, so in other processes you can listen to those streams and get updates, there is otherwise no way to know when a model is updated across processes
removeDefaults.js removes the default values from a model, which is sometimes useful when you are sending your model to the client repeatedly
rest.js sets up controllers for all the models in RESTful format, which mimicks couchdb HTTP stuff
thats not even all of em
 
6:40 PM
That's cool and all, but I use couch and redis :D
 
I use redis
i wrote an ORM for redis
 
orm ._.
 
ODM even
 
@ThomasBlobaum you are one of those programmers
Next thing your going to say you "like ruby"
 
there are exactly two kinds of ways to program, focus on your personal wizard mana/hacking abilities, or focus on integrating systems
half the time i am one, the other half the time i'm the other guy
plenty of programmers are just one or the other
dont judge me -_-
 
6:47 PM
Anyone used OS/360 ? (@gsnedders)
@ThomasBlobaum it's cool. I'm sure your things are useful. I actually respect you get shit done. I just can't relate to the mongo stuff because I don't use it
 
raynos being nice ^^
 
best index.js file evar (once i fix the options var)
 
0
Q: Defining "eval" as a formal parameter of a Function constructor invocation. Shouldn't that throw a syntax error in strict mode code?

Šime VidasThe specification states: It is a SyntaxError to use within strict mode code the identifiers eval or arguments as the Identifier of a FunctionDeclaration or FunctionExpression or as a formal parameter name (13.1). Attempting to dynamically define such a strict mode function using the Fu...

 
probably because you are using new Function
too much WTF
oh, you might have answered your own question @ŠimeVidas
try putting use strict in global too and not using jsfiddle
 
@ThomasBlobaum But the spec covered this case...
 
6:54 PM
try it in more than one browser
 
@ThomasBlobaum I tested in FF, Chrome and Opera.
 
> Worst of all, bounds checking is inefficient.
 
@ŠimeVidas, this throws
(function () {
   var f = new Function( 'eval', '"use strict";' );
})();
 
@Esailija Yes, I just tested that exact code in jsFiddle... :)
 
oh.. well just saying not that it answers anything :P
 

« first day (420 days earlier)      last day (4528 days later) »