« first day (836 days earlier)      last day (4104 days later) » 

8:00 PM
fakk
 
@rlemon reply on HN!
 
nvm... why did I think that worked for some reason
 
@FlorianMargaine afaik in PHP you can run functions using their names as strings, maybe he's confused about it?
 
wow wtf
 
No... im talking about the deleted answer
 
oh...
 
the setHours method is way slower
 
LEMON FTW!
 
And oleg, you can run functions using a string in js too
im on my phone, someone show him an example pls ^
 
window.alert('here');
window["alert"]("here");
 
8:03 PM
As a property of an object yeah.
 
but everything is an object
;)
 
not true
 
not primitives
but thats not what we are discussing
 
aha
 
Sam
why does this work: 2..toString() ?
 
8:04 PM
 
Sam
!!>2..toString();
 
Aren't primitives objects in ror?
 
@Sam "2"
 
2.0.toString()
 
@Sam knowing idiosyncratic behavior with number primitives does not make them objects.
!!> 2.1234..toString()
 
8:05 PM
@rlemon "SyntaxError: Unexpected token ."
 
ahh
 
Sam
I didn't say it was an object. It was an actual question.
 
double .. only on non decimal
wtfjs.com you'll find a lot
 
Sam
I saw someone write something like that the other day here.
 
its about the js-parser (lexer) and how it figures and reads in that line. A dot can have multiple meanings
 
8:07 PM
I need a FAST set data structure in JS
 
I like ['1','2','3'][1,2][0]
!!> ['1','2','3'][1,2][0]
 
@Oleg "3"
 
var set = {};
 
Sam
^ O(1) for insertion an deletion
 
@Oleg heh, nice
@Oleg RoR isn't a language, so no. In Ruby AFAIK everything really is an object
 
8:10 PM
@Zirak yeah, thanks, I always get confused which is which...
 
RUBY on Rails. hm...
It's the chicken and the egg, really.
 
!!> ~~[,1,2]+[1,2,3];
 
@jAndy "01,2,3"
 
@Sam 2.something will think something is the decimal portion of the number. To force the dot notation, you either to 2..something or 2 .something (a space works as well)
 
!!> +(~~[,1,2]+','+[1,2,3]).split(',')[ 2 ];
 
8:13 PM
@SimonSarris mydoc.lemonmeme.com you can bookmark it :P
 
You can probably see that in the BNF, one sec
 
@jAndy 2
 
lol I love that
 
DecimalIntegerLiteral . DecimalDigits(opt)
And the accessors: es5.github.com/#x11.2.1
MemberExpression . IdentifierName
And since the decimal is seen first, the . character there takes priority.
 
Sam
Makes sense
That also explains why if a set an integer to x I can also call x.toString();
But I still don't get why basic types are not objects in JS. (I mean, how can I tell that).
 
8:19 PM
What do you mean "how can I tell that"? You want proof?
!!> var s = 'foo'; s.bar = 42; console.log(s.bar);
 
@Zirak "undefined" Logged: "undefined"
 
Sam
Yep. Anyway, maybe I just should read more on the ES definition.
 
 
And he's loving your long sleeve today. Chilly out jAndy?
 
^ proof. Here's roughly what happens:
 
8:21 PM
How about a nuclear option? Use your content script to blast away the entire DOM of the called page. Then replace the DOM with your own code. Once the question is answered redirect the user to the target (but don't blow it up this time). — mrtsherman 3 hours ago
^ blast all the DOM!
 
var s = 'foo'; //string "primitive"
Object(s).bar = 42; //primitive is coerced to an object so you can set a property on it
console.log(s); //s refers, of course, to the primitive, not to the object we created above
 
long sleeve is an easy guess
hidding
 
I think we had a discussion like this a week ago or so
 
Sam
and that object for setting properties is created as a new object every time I execute somePrimitive.someProperty ?
 
Yep. Not just for setting; s.toUpperCase() is actually Object(s).toUpperCase()
 
8:27 PM
But I guess it doesn't do it every time.
Coercion is done just once I suppose.
 
Why wouldn't it be done more than once?
 
@Oleg in ruby, yes.
 
@Zirak Why would it waste cpu?
 
@rlemon I would like to say, that you help me out a lot. My plugin is almost ready after weeks stuck with the code! Thank you!
 
np
 
There might be interpreter optimizations into it, but basically, there's nothing inherently stopping it from doing that every time.
 
@rlemon ;) Absolute thanks! See you!
 
any good explanation for that behavior ?
 
Objects work different that their primitive types
!!> [!!"", !!new String("")]
 
8:29 PM
ppl can you please fire this perf
 
@copy [false,false]
 
Okay ...
 
seems like the "internal" objectization is way faster
 
8:30 PM
@rlemon nice, but no-no twice :)
 
never knew wp did that for you
 
Is there any browser that do not use Javascript at all? i mean, why people says that turns off Javascript, How the DOM is created/implemented without Javascript?
 
@rlemon or maybe...
 
@copy [false,true]
 
let me think
 
8:31 PM
@nEAnnam It's not created
 
@nEAnnam ummmm by the browser.... nothing to do with js...
 
KHTML is the HTML layout engine developed by the KDE project. It is the engine used by the Konqueror web browser. A forked version of KHTML called WebKit is used by several web browsers, among them Safari and Google Chrome. Distributed under the terms of the GNU Lesser General Public License, KHTML is free software. Built on the KPart framework and written in C++, KHTML has relatively good support for Web standards. To render as many pages as possible, some extra abilities and quirks from Internet Explorer are also supported, even though those are non-standard. History Origins KHTML w...
I always will think of KHTML first...
damn I'm old.
 
m59
I'm going to think aloud here, as I often do. Thoughts are definitely welcomed.

I want to make a way for the output of my plugin to be re-ordered.
Let's say there's a menu, title, div. It seems like this would be the way to store the options:
var order = ['menu', 'title', 'div'];
My program currently has the markup for each item in a var of the same name. Now I just need to append the corresponding var to the context element in the order of the array. Assuming this is a good approach, I'm stuck on how to connect the array order with the elements stored in the vars.
 
am I missing something here ?
 
and iirc 2% of desktops don't have js enabled - almost half of mobile worldwide with web capabilities don't have js.
 
8:33 PM
how can the primitive access on object methods be so much faster ?
 
Actually, still no... I'd like to style the question a bit too.
 
@rlemon But its always needed a DOM implementation right?
 
no.
 
@nEAnnam ...
 
why implement a DOM when you don't need a DOM
 
m59
8:34 PM
Oh! I could use eval to do it!!!
lol
 
@m59 did you ever look at FragBuilder?
 
m59
looking now
 
!!/google FragBuilder rlemon
 
stupid bot
turns around and shakes fist at server
@m59 not "use it" but maybe "borrow some ideas from the code"
 
8:36 PM
@rlemon thanks for the reference, ill see if i can get it.
 
@nEAnnam webpages are just a bunch of random text. "Layout Engines" like WebKit are used for physical presentation, DOM APIs work in the Javascript parsers (V8 for Chrome) to allow you to programatically add interactions to the Elements on the page/work with them. Otherwise you're stuck with classical forms and HTTP
lynx.browser.org < - text only browser
 
m59
I just noticed something I never figured out entirely.
and it may differ in php
which is where I noticed it
 
user1125394
@FlorianMargaine o thx
 
m59
var foo = 'bar';

var obj = {bar:'data'};
alert(obj.bar);
alert(obj[foo]); //This doesn't work, right? A var can't be evaluated here?
 
user1125394
8:43 PM
obj['foo']
 
m59
without the quotes, it will be evaluated as a var!?
 
@m59 Yes, it will work
 
m59
Whaaaaaat epic
 
A variable is just a value container
 
@rlemon Now i get it :) sorry im a noob, I needed that "Layout Engine" to connect some things that i've readed. thank you:)
 
8:45 PM
Indeed, truly epic.
 
@m59 that will work... why don't you just try it before asking?
 
!!> var foo = { bar: "Hello World" }, fix = "bar"; console.log( foo[fix] );
 
@rlemon "undefined" Logged: "Hello World"
 
m59
I was just thinking that. I was positive that particular thing didn't work, so I was actually asking how it could be done.
Sorry, I was unclear, and VERY VERY wrong.
and very glad about that.
 
o0o0o0o meta is in "read-only" mode
 
8:46 PM
Only for you Neal.. they got sick of your shit!
 
@rlemon o rly? u don't see read only?
 
Sam
@Neal I see it, too.
 
I see it, three.
 
You guys suck!
YOU SEE A TROLL TROLLING AND YOU RUIN IT!
I wanted to convince Neal it was only him
 
Trolling is for dorks and trolls.
 
8:47 PM
nomming is for fat people - you must be fat.
 
Sam
Sorry, I didn't notice.
 
fatnomnomnominal
 
Morbidly obese.
 
COW!!!
 
8:48 PM
@rlemon haha U ddnt fix the top bar :-P
 
You must be an acidic fruit.
 
!!> var l = 55000,s = new String("bench me"),b = Date.now();while(l--) {s.toUpperCase()}Date.now()-b;
 
@jAndy Maximum execution time exceeded
 
Sam
And the opaque "Ask" button
 
silly duplicates... tricks are for kids...
 
8:48 PM
@jAndy 3
@jAndy 6
@jAndy 13
 
crazy ! :P
 
no u crazy! :P
 
Y I CRAZY
 
Punctuation shouldn't be optional.
 
rlemon hits me.. :(
 
8:51 PM
@JuanMendes quick google search for detect if browser is webkit got me this: jsperf.com/test-if-browser-is-webkit/3 so easy even the OP could have done it.... — Neal 10 secs ago
 
Why does SO not just run a Google search on the posted question before uploading it?
 
I have no idea....
 
6
Q: Stack Search Chrome Extension

rlemon Stack Search A Google Chrome Context Menu Extension Screenshot About This is a simple context menu extension that adds an option for selected text on a page to be searched on your favourite Stack Exchange sites. The extension has two main components, the context menu list and the '...

 
@HiroProtagonist so go complain to the backbone devs :-) — Neal 4 secs ago
 
I use this quite a bit
 
user1125394
8:53 PM
why does "2013-01-18T14:19:01".split(/-|T|:/).map(parseInt) fail?
 
18T
 
Is it because parseInt takes 2 parameters?
 
awww
 
@rlemon fancy
 
@phenomnomnominal Yes
 
8:53 PM
because map passes the split array as the second parameter to the function
 
!!> "2013-01-18T14:19:01".split(/-|T|:/).map(parseInt)
 
@jAndy [2013,"NaN",1,1,1,1]
 
thus parseInt will receive a lot of funny "bases" to parse the integer from
 
!!> [10, 10, 10, 10, 10].map(parseInt)
 
@copy [10,"NaN",2,3,4]
 
8:54 PM
!!> function fakeParseInt(n) { return parseInt(n, 10); } "2013-01-18T14:19:01".split(/-|T|:/).map(fakeParseInt);
 
@rlemon [2013,1,18,14,19,1]
 
!!> "2013-01-18T14:19:01".split(/-|T|:/).map(parseFloat)
 
@phenomnomnominal [2013,1,18,14,19,1]
 
@phenomnomnominal wins
 
but what if he no wants floats
 
8:55 PM
Yeah, not in every case
But with dates it shouldn't matter?
 
touche
coffeeeeeeeeeeeeeeeee
brb
 
Relevant article: nedbatchelder.com/blog/201301/stupid_languages.html (just a few days ago explaining the whole parseInt / map thing)
 
You could also use Number
 
!!s/eeeeeeeeeeeeeeee/script/
 
@phenomnomnominal coffscripte (source)
 
user1125394
8:56 PM
heh well done
 
lol
 
Sam
close enough
 
user1125394
I need to test Date.apply(this,"2013-01-18T14:19:01".split(/-|T|:/).map(function(n) { return parseInt(n, 10); })); on android because new Date("2013-01-18T14:19:01") works on chrome , not android
 

« first day (836 days earlier)      last day (4104 days later) »