« first day (971 days earlier)      last day (3977 days later) » 

4:00 AM
you will need to pass context
 
var bindable = bind.bind(bind);
var callable = bindable(call);
var arrayFrom = callable([].slice);
Then you can do arrayFrom(arguments)
Also if you want to use new and apply together:
 
that's the same as var arrayFrom = call.bind([].slice)
 
new (bindable(constructor, null).apply(null, arguments))
@Esailija - Exactly - bindable is just bind.bind and callable is just call.bind.
 
Array.prototype.forEach.call(document.getElementsByClassName("message",function(element){  console.log(element.textContent) });
 
In fact bind.bind(bind) is just bind.bind.
 
4:03 AM
boy that was fun
 
Hence bindable(bind) is bindable itself.
 
@Trevor could localStorage be used as way to fingerprint visitors? uniquely identify them and know even when they clear their cookies and stuff.
 
@Darkyen - Or you could do:
var forEach = callable([].forEach);
forEach(document.getElementsByClassName("message",function(element){  console.log(element.textContent) });
 
i'd much rather do [].forEach.call
why waste a line :?
 
Because you can use forEach anytime you want again.
You don't have to keep repeating [].forEach.call.
 
4:06 AM
Sick

[Head|Tail] = [1,2,3,4].
> [1,2,3,4]

Head.
> 1

Tail.
> [2,3,4]
 
var head = function (list) { return list[0]; };
var tail = function (list) { return list.slice(1); };
 
That is a tedious process
 
JavaScript doesn't have pattern matching.
 
@Dave thanks for the korean tv show links, I'm gonna watch them while I eat my dinner :)
Is there a Korean tv show with high heeled women?
 
@KimJongWoo Dinner already ? You obvious don't live in Korea right?
 
4:11 AM
I don't live in Korea that's right.
 
@O0oO0oOO0ooO why are you being Pythonic ?
 
so where do you live?
 
i know this is valid in ES 6
but seriously that syntax just pops my eyes out
python confuses the fuck out of me
a,b,c = foo();
now this fucker can fill 3 variables all alone
or it might be just filling the third one
 
@Darkyen - Take a look at Forth.
Over.
 
@AaditMShah i worked with python bro... it just makes me feel ugly :-(
 
4:13 AM
Do you mean that foo() cunt can accept 1 to 3 variables?
 
+ i miss my curly braces
@O0oO0oOO0ooO no
return (10,20,30)
 
@Darkyen - At least it's better that PHP.
That language just drives me nuts.
 
@AaditMShah php is decent bro
 
Oh, not to mention, Visual Basic and Java.
 
its just over done
Java is evil
 
4:14 AM
@AaditMShah How come Java drives you nuts?
 
i am going to have to go through a training 14 days of ASP.NET Or JSP
 
@Darkyen - PHP is the most inconsistent language I've ever seen.
 
i wonder which should i rather take as death
@AaditMShah how about C++ ?
 
@O0oO0oOO0ooO - That's a lot to explain on chat. I wrote an entire PDF in LaTeX about why Java Sucks. Should I forward it to you?
 
c = a + b; can mean literally everything
 
4:16 AM
@Darkyen - I would rather use C.
 
@AaditMShah have you seen C++11 though ?
it makes it pretty neat and useful... but with confusions from past
 
@O0oO0oOO0ooO - Also there's a chat room of StackOverflow dedicated to how much Java Sucks.
@Darkyen - I would still rather use plain old C.
 
@AaditMShah take any chatroom on stackoverflow ask "Why java Sucks"
 
@O0oO0oOO0ooO is that kind of language really necessary?
 
The most annoying language is Actionscript 3. While you are working on a large flash project and if your Flash Professional crashes then you cannot access to .fla file any more. It happened to me several times before
 
4:17 AM
why :? :? why so much affection for C ?
 
@Darkyen - Well, the Linux kernel is written in C. If you want to do any assembly programming you need to know about C data structures. It's not as messed up as C++, and it's easier to do functional and prototypal programming in C.
 
Today was fun :D
 
m59
@Gacnt hey bro! You rich yet?
 
Is that a monster truck jr?
 
@m59 Not even close lol
 
m59
4:19 AM
lazy
 
haha
 
m59
=D
I have narcolepsy so I'm useless, I have no room to talk.
 
haha
You tired all the time, or just have a hard time falling asleep waking up
 
m59
Tired all the time...I sleep fine, but way too often and at many very bad times. It's the struggle of my life to get out of bed in the morning.
 
I think people say Java sucks so it must be deprecated because the current job market is looking for more developers of its rival language C#. Every languages suck at some point
 
4:22 AM
@m59 Hah, I used to be the same, now I get up at 4:30am for work :P
 
m59
You have N? Or you just mean being tired?
 
N?
 
m59
Narcolepsy.
 
Oh, I may have had undiagnosed Narcolepsy, pretty sure I did, I kid you not, I could sleep 18 hours a day, and still be tired, I did for the longest time
A few years ago I used to sleep entire days, and wake up 2 days later
Just because I didn't want to get out of bed
 
m59
It wouldn't get better, though.
It actually only gets worse with time :(
 
4:25 AM
Maybe I'm just fucking lazy then :P
 
m59
But sounds like you had something going on.
 
I love, to sleep
 
m59
Heh. I really try. Even knowing what I have I still can't convince myself I'm not just a loser.
Kinda sucks :(
 
Schadenfreude <- best thing ever. Over.
 
m59
LOLLLL whaaaat
Glad I could help?
 
4:32 AM
@Gacnt Could be restless leg syndrome
 
m59
or sleep apnea
 
@AaditMShah personally i like C++ because of well somewhat not naked pointers and the stl
 
TONIGHT ONLY: LIVE NUDE POINTERS!
 
m59
Ooo, I'm double confused.
If I had something like mydomain.com/api/users/m59/images
I feel like that should mean a table called users with a user called m59....
but then images would need to be in its own table??
 
m59
4:41 AM
Relational database sounds like what I need...looking into that
 
@SomeKittens lol
qouting an example from a book
gurr i will have to find the book for the code but meh,... lemme do it old way
the code was somewhat like this
class String{
   char * data;
   public:
   void concat(String &str2){
         int len= strlen(str2.data) + strlen(str1.data);
         char * temp = new char[len];
         memcpy(temp,str2.data,strlen(str2.data));
         memcpy(temp,str2.data,strlen(str1.data));
        // those who know C / C++ will be having heart attacks on tis code :D
   }
}
 
Anyone here follow Hockey? NHL I mean.
 
@Darkyen - Pointers are simple things. Especially in assembly. Plus they are really powerful.
 
^
dont u see a memory leak in the code :?
everytime u call concat ?
also the second call should be temp + st2.length
 
@Darkyen - My last sentence was in the context of "personally i like C++ because of well somewhat not naked pointers and the stl".
 
4:53 AM
ah...
mkay
i guess i need to practise more C :-)
 
In my opinion instead of having classes it's better to have polymorphic functions.
For example JavaScript supports a basic form of polymorphism via this.
 
eh ?
well true
 
You can have a forEach function and a Array.prototype.forEach function.
 
but false :P
 
In the second case the first argument is typed as an array.
Hence JavaScript supports a rudimentary form of polymorphism.
If you see classes are made up of two things - properties and methods.
Instead of methods if you had polymorphic functions then you would only need properties.
 
4:58 AM
Classes are much more then polymorphism though
 
An object with only properties is something like structs in C. Hence C is all I really need.
 
and having a sense of logic is usually a plus point for me
for instance
 
Classes have encapsulation. C has encapsulation.
 
Car::setDriver(Driver);
makes more sense :P
then
 
Classes have inheritance. Structs in C can have inheritance.
 
4:58 AM
car_set_driver(&Car,&Driver);
not to mention the global namespace stays clean and clear
 
The point is that you don't have to do all the name mangling yourself.
You could write a transformer tool to do that for you.
 
what do u have in C against this
 
@Darkyen hi
 
The global namespace doesn't stay clear. Even in C++. The names are mangled to include the data types when compiled to object code.
 
int main()
{
   // Create a vector object that contains 10 elements.
   vector<int> v;
   for (int i = 0; i < 10; ++i) {
      v.push_back(i);
   }

   // Count the number of even numbers in the vector by
   // using the for_each function and a lambda.
   int evenCount = 0;
   for_each(v.begin(), v.end(), [&evenCount] (int n) {
      cout << n;

      if (n % 2 == 0) {
         cout << " is even " << endl;
         ++evenCount;
      } else {
         cout << " is odd " << endl;
      }
   });
 
5:02 AM
typedef struct {
    int x1;
    int y1;
    int x2;
    int y2;
} line;
 
dude ?
that example was for lambda expressions
 
TLDR!
 
god !
lol
 
Personally I wouldn't use either C/C++ for functional programming. It just not meant for that.
 
see the C++ 11 keynote by Bjarne
it worths it :P
 
5:04 AM
You can't convince me to use C++ over C, and you can't convince me to use C over Scheme.
IMHO Scheme is the most expressive programming language ever.
BTW do you want to read my seminar report on why Java sucks?
 
Can somebody tell me what type of documents come under the term Technical Writing for Software?
 
@RomanticElectron - RFCs
 
@AaditMShah I would love to :D
 
@Darkyen - Here it is: pdfhost.net/…
 
Great@
in my next presentation i am thinking of doing why java sucks :P
(xD) you just inspired me more on it
 
I think even North Koreans can make a better presentation slides than this out of cardboards
 
Working iOS7 beta with no registered UDID on a developer account, just FYI for anybody
 
@Gacnt, got it from work
 
Must be nice
I got it from home, in the comfort of my room
Your face is my wallpaper
 
I'll snapchat you later
 
5:21 AM
LOL
Vine bro :P
 
haha
It's so damn unstable, Over.
 
dear god he probably wanted to make his website in C++ i guess ;-) ;-)
 
What's unstable, vine or iOS7
 
!!/choose vine iOS7
 
@Darkyen iOS7
 
5:24 AM
Your answer has been granted
 
God damn, I love teh scrolling how things get compressed when they come to a sudden stop, it's the simple things in life that give you a boner
 
so does CORS (Cross Origin Resource Sharing) require a remote domain to modify it's header to support CORS? So it won't work with 99% of sites out there don't bother with CORS?
 
Did apple rip off Android UI ?
 
Or did they take it and make it better
The only thing I would love for this, is gridlock
 
5:53 AM
I wonder why they don't let the grooveshark app on the app store
 
@dmitry.sh Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
6:12 AM
@JanDvorak Done and posted my own answer too.
0
A: Edit or comment?

Octavian DamieanExtending JoshDM's answer. In general, I would just edit the answer without prior notice to the author, because the author will be notified of the edit and can revert it at any time if he believes the edit is not correct. Stack Overflow is all about helpful, up-to-date technical answers, if you...

 
is typedef like enum?
 
totally not (and there is no typedef in JS)
 
I can't believe that seven people up-voted that guy's answer on that Meta question ...
> Editing an answer that isn't your own shouldn't update the answer, it should only improve things like formatting and grammar. The answer shouldn't change, only how it is worded
 
@phen fav iOS7 feature?
 
6:19 AM
can v8 engine be implemented in C programs?
 
V8 is implemented in C++
2
A: ECMAScript-262 implementation in C?

Jan DvorakThe SpiderMonkey wiki claims it is C/C++, however, from looking at the source package, it seems to be pure C actually. The official download link is http://ftp.mozilla.org/pub/mozilla.org/js/js-1.8.0-rc1.tar.gz If that doesn't turn out to be pure C, try the older versions. Their FTP (http://ftp...

 
6:35 AM
@KimJongWoo sorry i missed you're question, you could keep a database of people with hases or whatever method you please using localsotrage, i am not certain of its clearing plicy but to my understanding, it will never clear as long as it is not cleared by the user, of corse ip profiling is a more standard root to take but localstorage will not clear on its on and is separate from cookies will remain even if cookies are cleared
 
6:51 AM
Morning Folks!
 
Man, I love Mozilla more and more.
 
MDN or FF
 
Mozilla in general.
 
I have to append some html after the username field in a form
Here I have a construct which just appends to a form-
 
Their ideology (not the Karl Marx meaning of that word of course).
 
6:55 AM
$(".zend_form").append('<p><font color=\"green\">Username Available!</font></p>');
I want to append after the first child of form element
 
Please don't use <font>
 
why? @JanDvorak
 
It's a little inflexible, to say the least.
Use CSS
 
6:57 AM
Your javascript should not be concerned with presentation. Place a paragraph there (with some class, perhaps), and let CSS tell the browser it should be green
 
alrite!
 
At the very least, you could do $("<p>...").css("color", "green")
 
and how to append my html after the first child of form?
ok! @JanDvorak
 
Are you looking for $("form > *").first().after(content)?
or $("form > :first-child") or $("form > :first")
 
@Oct have you got around to making JS apps on the FF device?
 
7:00 AM
(the last being non-native to the browser, and thus slower)
 
$(".zend_form").prepend('<p style="color:green;">Username Available!</p>');
I think this is what he needs.. not sure
 
$("form > :first-child").after($("<p>", {text: "username available"}))
please avoid forcing the browser to parse HTML. It takes time.
 
yes! this should be correct! @JanDvorak
i try and get back to you
 
or $("<p>", {text: "username available"}).insertAfter("form > :first-child")
 
@Mr_Green prepend will insert it at the first i guess..right?
 
7:03 AM
yes
 
that will place the element before the first child, not after
 
yeah
 
Note: we are talking about element children, right?
 
yes, here the element is form
 
I mean, do you consider text nodes as children?
or children = child elements
 
7:05 AM
How about you sacrifice your first child to me
 
$(":first-child", this).protect()
IOW: NO :-<
 
I just looked at my form-
It is different from what i expected
<form enctype="application/x-www-form-urlencoded" action="signup" method="post"><dl class="zend_form">
<dt id="username-label"><label for="username" class="required">User Name:</label></dt>
<dd id="username-element">
<input type="text" name="username" id="username" value="" size="35"></dd>
my username tag is the third child
and the child i want to append should be 4th
:-)
 
why not select it by ID?
much faster, and less prone to errors
 
yes
that's good idea
and btw, here the parent is dd
got it.....
 
Selection by ID is about the fastest way to get a DOM element you can do in javascript. Only variable access (also a great idea) is faster.
 
7:13 AM
the above code works
changing form to username-element
 
$("#username").after(...)
 
This works-
$("#username-element > :first-child").after($("<p>", {text: "username available"}))
 
$("#username").after($("<p>", {text: "username available"}))
and you're done
 
not yet!
 
@vp_arth Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
7:16 AM
i get the text below the username
 
elements that have an ID should be selected by their ID
 
what if i want just to the side of username text box?
 
CSS issue
 
ok!
i have no idea on CSS
alrite, i have a look at that!
Thanks All!
 
p is a block-level element and means "paragraph". Perhaps you want a span?
 
7:17 AM
yea, maybe
 
If it displays to the right, it's not a paragraph!
 
i give a check
@JanDvorak You got it!
Its working..
thanks.
 
anyways, do learn CSS
 
posted on June 13, 2013 by paulirish

If you use either sourcemaps or sourceURL (both covered in the HTML5 Rocks Primer on Sourcemaps), then you may see a warning in Chrome console like "/*@ sourceMappingURL=" source mapping URL declaration is deprecated, "/*# sourceMappingURL=" declaration should be used instead. Here's what that's about: Impetus //@ sourceMappingURL was found to have a conflict with IE whenever it was

 
it's easy.
If you're using jQuery, you already know half of CSS
Actually, jQuery assumes the knowledge of CSS
 
7:20 AM
aha...okay!
@JanDvorak do you work on zf?
 
jQuery selectors = CSS selectors + few custom pseudoclasses
Zeno-Fraenkel set theory? No, that's already complete
 
ha ha, nope
zend framework!
 
nope
neither "on", nor "with"
 
hearing Zeno-Fraenkel set theory for the first time..
ok
 
Ah, sorry, wrong greek
In mathematics, Zermelo–Fraenkel set theory with the axiom of choice, named after mathematicians Ernst Zermelo and Abraham Fraenkel and commonly abbreviated ZFC, is one of several axiomatic systems that were proposed in the early twentieth century to formulate a theory of sets without the paradoxes of naive set theory such as Russell's paradox. Specifically, ZFC does not allow unrestricted comprehension. Today ZFC is the standard form of axiomatic set theory and as such is the most common foundation of mathematics. ZFC is intended to formalize a single primitive notion, that of a heredita...
 
7:25 AM
@Reno I had no time for that yet, but generally it is just a normal website like any other website, just with a few differences.
 
can i get some review on this, i feel like i'm overlooking something big, because i just shed 4 seconds off of load time with a dumb misteak but maybe i'm not seing something. pastebin.com/6nSDd57A
 
ul#table_search.mb_1 is horribly inefficient. Use #table_search.
What's the change that saved four seconds?
L28-L30 are indented one level too little
 
i was getting code from another page and appending it to a div then using $("#id").find() instead of just using $(ajaxResultSource).find()
 
cache your selections. $ts = $("#table_search"); ...
 
allbutton.contents().css("backgroundImage", dissbledurl);
allbutton.contents().css("background-position-x", "0px");
allbutton.contents().css("background-position-y", "0px");
 
7:38 AM
@DanielK. Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
Do that in one go, over.
 
@phenomnomnominal yea i probibly should have it was just that way for readiblity sake
 
@phenomnomnominal jquery splats that into a loop anyways, doesn't it?
 
I don't find it very readable, over.
@JanDvorak either way, getting the contents 3 times sucks, over.
 
@phenomnomnominal aye. I looked to the right.
How many elements are you setting the same CSS to?
 
7:42 AM
its 1 span
 
use children instead of contents. contents selects text nodes too
 
allbutton is the parrent span of 1 more span
 
tabbar.eq(1).contents().contents().html(...) -- WTF? Assign an ID to that element
 
@JanDvorak ZOMG thats the problem with my math function!!!!
 
O_O
 
7:44 AM
mainul.eq((i*2)+paidli*2+1).find("a").eq(0); accounts for all the #text
i chould be using child instead of contents
and this isnt my html that i can just go and edit, its another websites
 
don't they have an ID there?
 
idk let me check that part....
thats what tabbar.eq(1).contents().contents().html(...) leads to
 
ul.outer?
There are plenty of classes to hook to
 
contents().contents() is <li><a> to reperesent
 
.find('a')
 
7:49 AM
0
Q: How to implement tile enemies behavior?

GeoPhoenixI'm having a difficult time to understand , how to implement the behavior of an enemy in a tile based game, movement attack behavior per enemy level ( higher level enemies should be hard to kill) defend other behavior since the game is a tile game written in javascript, the behavior of the ...

 
should i switch all my .contents() for children?
 
yes, unless you actually need things like text nodes
 
i dont at all and they have been pests
and .find('a') skips 1 function but calls a selector is it better to have 2 children() or 1 find()
 
find('a') calls a selector, but it's a selector over a tiny tree, and contents().contents() iterates (over a one-element NodeList) twice.
It also creates a temporary jQuery object
I'd say creating a jQuery object is slower than calling querySelectorAll
or getElementsByTagName
 
sounds like you've read jquery source... how come people know everything about how different functions weave?
 
7:55 AM
@user2442335 Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
@phenomnomnominal is my code actually hard to read?
 
@TrevorRudolph, I don't like reading it very much, over.
 
@TrevorRudolph if you're building a house, it's good to know what your bricks are made of
 
Doesn't mean that it's bad, over.
 
@JFC Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
7:58 AM
@JanDvorak very well put, poetic even :P
 
sigh, Y U ARE SO STUPID FACEBOOK?
5
A: Facebook like box widget not recognizing data-width attribute?

nam voi think we should tell fb to fix their dumb script, now fb like box must be at least 292 px in width. They state clearly on https://developers.facebook.com/docs/reference/plugins/like-box/ The minimum supported plugin width is 292 pixels.

 
:-D
 

« first day (971 days earlier)      last day (3977 days later) »