« first day (1824 days earlier)      last day (3120 days later) » 

10:00 AM
@Baldráni Count your braces.
 
Hit F12 and look at the error...
 
@Baldráni this.dataSet.value
 
@MadaraUchiha Ho god
 
user5020521
can I empty an array by setting its length to 0?
 
10:01 AM
@Baldráni And get some sleep! :-)
@Riccardo990 Yep.
 
user5020521
is it better to set its length or to use splice function?
 
user5020521
I've just read about it in a SO question and somebody preferes to use splice others the length property
 
@Riccardo990 Or just create a new array. Otherwise, set the length. More intuitive. Save human CPU time first.
 
user5020521
actually I need to empty an existing array and then call the function which creates it
 
user5020521
have I been clear?
 
10:05 AM
No. :-)
 
user5020521
matter of fact I have a function which creates an array in another function I set its length to 0 and in the same function where I set its length i call the function which creates it in order to destroy and create
 
Are you trying to create an array pool and recycle them? o_O
 
someone suggested to compare objects with Object.is()... but it doesn't work with objects
 
user5020521
I'm not sure about the reply I might give you since I'm not well acquainted with array pool
 
@ErroreFatale Object.is is designed to work on "primitive objects". It doesn't do deep compare. Like we said.
 
user5020521
10:12 AM
@Sheepy might I fiddle you the js code in order to explain me better?
 
Ok... I thinked that with "deeop compare" you wanted to say "comparision of contained objects too"
 
@Riccardo990 Sorry I think not me. I have a course to attend as soon as I am off, which is soon...
 
Object.is is basically an exposition of the internal SameValue function.
 
@ErroreFatale Or their subobjects. Or the subobjects of these subobjects. And so on.
!!>Object.is([], []);
 
@Sheepy false
 
10:14 AM
It's not terribly hard to implement but please don't put it in Object.prototype
 
So, keep it on primitives and roll your own equals.
 
!!> console.log(NaN === NaN, Object.is(NaN, NaN))
 
@AwalGarg "undefined" Logged: false,true
 
then there are differences between behavior of +0 and -0 etc. but that's basically it.
 
Yes. I think these are the problems that Object.is is trying to solve?
 
10:16 AM
Yep
 
26262601: I'll take "guess the context" for 500, please.
 
@JanDvorak That's so meta
First rule of tautology club is the first rule of tautology club
 
Sorry, but if you can't extend prototypes as I used to do, then how do you create a "clean extension" of a standard type? For example I have pushArray(array) which pushes an entire array inside my array... how would implement pushArray(array)?
array.pushArray(array)
 
you can extend prototypes in some situations
 
sorry... arr1.pushArray(arr2);
the best is... arr1.first(predicate)... standard libraries don't have it
 
@ErroreFatale arr[arr.length] = newArr; ?
 
@ErroreFatale Use your own namespace: $.pushArray( a1, a2 ), _.pushArray, err.Array.push etc.
For your reference, ES6 used to propose Array.contains. However in field test it conflicted with some framework, and now it is renamed and pushed to ES7. Because a framework decided to rollout its own contains function on Array.
 
Sheepy are you suggesting a wrapper of array?
 
I suggest putting your functions outside of native prototype chain.
 
Can you provide a clearer example, maybe online?
 
10:32 AM
“Your credit card number cannot contain spaces, please try again” No, your enterprise Java developers need to learn Regex.
 
var errf = { // ErroreFatale's functions
  pushArray() { ... }, // instead of Array.prototype.pushArray
  popArray() { ... }, // etc.
}
errf.pushArray( a1, a2 )
 
In other words,it's creating a a simple function which takes array1 and array2 as arguments. Ok, but what I was asking is if there's a clean way to achieve this but with the syntax arr1.pushArray(array2)... something nearer to "pure OOP philosophy"
 
Not at this moment. Wait for Array subclass. Common browsers should implement it in a year. Safari, 2 years (may be).
 
Am I missing something? Does Array.prototype.concat not do what you want?
 
Good question. I wanted to ask that too but forgot :p
off now, have a nice day~
 
10:41 AM
Array.concat does techinically the same thing, but the form is different
It doesn't update the array... it returns a new array
 
!!> var a = []; a.push.apply(a, [1, 2, 3, 4, 5]); console.log(a);
 
@phenomnomnominal "undefined" Logged: [1,2,3,4,5]
 
by the way Sheepy, I think that the reply to my question is "create a wrapper of array" ----> var wrapper = new ArrayWrapper(myArray); wrapper.pushArray(arr2);
In the wrapper I can then have all methods I want
 
Can someone have a look at this: pastebin.com/CNrXQrwK
I am trying to make ajax calls synchronous in angularjs
 
@shyam don't.
 
10:46 AM
@phenomnomnominal?
 
shyam it's deprecated at least in google chrome because the user experience would be not good
 
Not exactly synchronous. I am using the promise to make ajax calls one after the other
But I cannot use $q.all() right away because only some calls need to be made for each call
Caution: the paste above might look like utter non sense
I've put it there just to give you guys an idea of what I'm dealing with
All the similary named functions perform similar tasks.
So I did not put all of them in there
 
@shyam I don't understand what you're trying to do/
 
sounds like async/await
or Promise.reduce etc.
 
You're trying to call ajax requests one at a time?
 
10:55 AM
or chained promises (yuck)
 
I want to call saveVendorProduct() after saveProductName(), saveProductType() and/or saveProductCategory has all completed
@MadaraUchiha yes
 
@shyam Based on what?
 
saveProductName().then(saveVendorProduct)?
 
The scenario is like this
I have auto complete inputs for names, types and categories
but if the user enters something outside the already existing names, types or categories, they should be posted to the backend first
before creating the product
Once I post the names, categories and types, I will get ids for each of those
and this should be included while posting a new product
 
-3
Q: Is it good idea to disable 'Hot Network Questions' to boost productivity?

Michal StefanowI'm using StackOverflow to get stuff done. (not when looking for entertainment) The Hot Network Questions is interesting, entertaining but doesn't get me closer to get stuff done. That is why in every browser I have ad-blocker installed and I add a custom rule to block #hot-network-questions ...

lol, what a dufos.
 
11:04 AM
So I cannot just do saveProductName().then(saveVendorProduct) @Mosho
Because if the product name already exists, I don't need to save it again
 
@shyam then saveVendorPRoduct should handle that...
Or, have a method that wraps it.
Also, it should probably be one save, and atomic.
 
@BenjaminGruenbaum How? Are you saying I should I just handle the condition once the saveVendorProduct fails without having the required fields?
But as far as I know $q.all().then() should actually execute .then() only after finishing the promises in .all() right? So how then do I get the promises into .all()? I don't know if I am doing it the right way now.
 
11:20 AM
howdy... anyone want to enable my laziness and share a grunt script to quickly reformat my javascript, ideally after each save?
or save the research of which package is best?
answer my own- seems to work ... github.com/vkadam/grunt-jsbeautifier
 
!!urban dufos
 
@DenysSéguret Dufo Dufo is a word for people thath do amazing things for their freinds or family.
 
 
I need to open 4 pull requests, but don't know what to do
someone link me their project(s)
 
@Cereal add screenshots to readmes
 
11:35 AM
@AwalGarg That's genius
 
yw
 
Now I just need to find a project that needs screenshots
 
So... all of them?
 
The first project I thought of to link already has screenshots
 
I searched "Desktop messenger" on github
 
oh you wanted us to link to our projects. feel free to cleanup my phpepl's JS code. It is just 200 lines or something and you can do that in 5 minutes or less.
 
@DenysSéguret Well I'm already overwhelmed
@AwalGarg Do you really want me cleaning up your code? link me
 
(jQuery, yeah sorry) I have a play button. Once a user has clicked it, it gets .removed(). Normally I'd check first if it exists and only attempt to remove it if it does. However jQuery silently fails if the element is not found. What is most efficient? I mean... it's nicer to check if it exists before attempting to remove it, but if jQuery doest this as well... thoughts? :)
 
I wonder if project maintainers everywhere are feeling the load of useless spell fix PR...
@Eirinn Right solution: don't check
But if you really want to check, check the length property
 
oh btw @DenysSéguret were you able to figure out what caused that SO logo being screwed up in SO chat oneboxing? Florian reproduced it in the main JS room
 
11:42 AM
> Removed all gendered nouns from documentation
 
That'd be one easy PR for me btw :D
 
@DenysSéguret yeah that's what I'd normally do, but if it latently checks then I don't need to
 
@AwalGarg I had the problem and fixed it. I can't remember how...
 
@Cereal github.com/awalGarg/phpepl/blob/master/html/static/better.js you can maybe separate the snippets part into its own file. do whatever with it.
 
@Cereal ew
 
11:44 AM
@DenysSéguret hmm, I still see the same issue :/ caching?
 
You have the issue on Miaou ?
 
yeah
 
@AwalGarg Is it bleeding edge? Can I arrow functions?
 
@DenysSéguret and thank you :)
 
11:46 AM
@Cereal wait, don't put real coding time into it ~_~ that code is dreadful and I don't want to take the sin of putting you into it. It is just one bleeding edge case where you can do minor things that count as improvement.
just separate the code into two files or something
 
@AwalGarg I'll do a seperate pull request for every change
> added line break fast snippet definition
 
lol
@Cereal awesome
 
@AwalGarg I see. I'll fix that as soon as I get some internet
Or... maybe... it looks like it might be worth a fourth of a tshirt...
 
@AwalGarg Why's it wrapped in an immediate function?
 
@Cereal no less globals
 
11:54 AM
Seems silly
I'm forking it, give me ~30 seconds and I'll be done.
 
It was the standard a while ago. Now everyone uses a module system and I don't.
see the revealing module pattern for instance
 
@AwalGarg How do I test this nonsense
 
no need to test lol
 
Random pull request incoming
jk I don't know how to do a pull request
Figured it out
 
12:05 PM
@DenysSéguret lol
 
@AwalGarg There, have fun with the merge conflict
 
lmao
 
10/10 to myself for doing that in the master branch
damn it
 
@Cereal i didn't test but you have a typo
 
2/4 (but I'm really improving the code)
To make it easier with the merge, I think I'll propose a rename of the HTML directory whose content just isn't HTML...
 
12:11 PM
@DenysSéguret it is the composer naming
 
Should I really care about this constraint ? The semantic is wrong, nothing else matters.
Where's my axe ?
 
consistency matters ;)
 
@AwalGarg I copy and pasted. you have a typo
>:((
I sure do
:(
 
room topic changed to JavaScript - Scripting Javas: Read this: rules.javascriptroom.com. Before asking inform yourself on the XY problem goo.gl/taIqf | devdocs.io Documentation™ Helps. WooHoo ES2015 (ES6) released! [ecmascript] [es6] [ill-get-the-ladder] [iojs] [jabbascript] [javascript] [nodejs] [promises]
 
@Cereal lol. also no idea how do I merge your PR :/
 
12:22 PM
I fixed the typo
 
@Cereal your commit message has a typo now :D
j/k
 
rofl it does
I can't do more random PRs without you merging it because I messed up
 
@rlemon I see your new profile picture. Is that you ?
 
@Cereal I am trying to figure out how to merge :/
 
@DenysSéguret substract the beard, then yes
 
12:24 PM
@DenysSéguret I think it's a fake one though.
 
I don't even see what the conflict is
 
hmm, i had a long file, you forked, dystroy forked, you edited, dystroy edited, dystroy pr'd, i merged, you pr'd -> merge conflict
 
ooh
 
@DenysSéguret yes, sans beard
 
@AwalGarg Should give you the option to fix, then commit, no?
 
12:27 PM
ok
but removing the beard isn't a small deal
that's a magnificent beard
Go grow one now!
 
rlemon is magnificient with and without a beard.
 
what the hell does "both modified" mean in git status?
 
@AwalGarg He modified better.js. I modified the same code (re: removed it)
So we both did something to the same code, you have to pick which one to keep, or whatever
just pick mine, I put his change in mine anyway
 
em, anyone work with facebook graph api?
 
@Cereal sigh, merged
 
12:39 PM
I did a pull request for the readme, but I don't see it listed.
 
lol
@Cereal are you sure you didn't just send a new commit? because gh bundles all commits to a single PR :P
 
No, I did it though github
 
weird. I don't see it either.
@Cereal what was the change anyways?
 
why i find it so difficult to understand callbacks and promises :(
is it just me ?
 
no
 
12:43 PM
@AwalGarg Telling what the project was.
I had no idea what a phpepl was
 
@Cereal oh, lol
merged
 
let's see what else I can break
 
@Cereal you have hosted ruby app with nginx?
 
@AwalGarg Yeah
 
how bad is it?
 
12:50 PM
how on earth can i follow this post to get this
1852
A: How to return the response from an asynchronous call?

Felix Kling -> For a more general explanation of async behavior with different examples, please see Why is my variable unaltered after I modify it inside of a function? - Asynchronous code reference -> If you already understand the problem, skip to the possible solutions below. Explanation of the...

0
Q: How to return data before moving forward in object literal pattern

Please TeachI have this code, MyNameSpace.Crate = { init: function (crateID) { var crate = MyNameSpace.Crate.get(crateID); MyNameSpace.Crate.processData(crate); // do more with data }, get: function (crateID) { var url = root + "Crate/"; $.getJSON(url, { ...

 
@AwalGarg
            try {
				Snip.UI.open(Number(e.target.dataset.snipindex));
			}
			catch (err) {}
Why
 
@Cereal it could be a GC'd snippet
 
Let me rephrase
catch (err) {}
ihu
 
!!urban ihu
 
@AwalGarg That didn't make much sense. Maybe you meant: urban, unban
@AwalGarg [ihu](http://ihu.urbanup.com/2122956) i hate u.
(i hate you)
 
12:52 PM
:(
 
In that vein, shouldn't it not do that if the delete button is clicked
Oh you return
 
no idea what da hell you are talking about XD but that code is terrible. The guy who wrote the original PHPEPL was all hacky
I forked it and tried to pile on whatever I could add
 
@PleaseTeach That's not how things works.
 
when it "worked" back, I stopped looking at it and just used it.
 
Free pull requests for me!
 
12:56 PM
@Uppah 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.
 
@PleaseTeach You need to have in your init :
var crate = MyNameSpace.Crate.get(crateID);
crate.done(MyNameSpace.Crate.processData);
 
10
Q: If vs Case statements

fealinAre there any performance differences between using if-else and case statements when handling multiple conditions? Which is preferred?

Too broad
 
And in the .get your return your $.getJSON
 

« first day (1824 days earlier)      last day (3120 days later) »