« first day (2767 days earlier)      last day (2405 days later) » 

00:14
saying "everything" isn't appealing
always possible we've missed something, just look it up
00:54
morn
Aw no, who deleted Kovu's starred message?
01:30
Hey folks
I'm having some trouble with my JS
ohhi
So basically, I'm fetching a user's profile name (from Google), and the day of the week
Depending on the day of the Week, and said profile name, it should display either "No Gym" or "You have Gym".
The problem is that even though it should display "No Gym", since it's Sunday, it says "You have Gym"
Very weird
Plus, it doesn't even show anything on the console
If anyone could help, that would be greatly appreciated
code?
don't really care about the result
on saturday and sunday, you're not changing the value of the span
01:42
ok let me check
So do I have to put No Gym?
Oh, leaving it blank will assume the last state of the span, Im guessing?
OK, so I just comitted; hope it works
@KevinB Thanks, it worked
Nice fix
oh man those massive if/else blocks
@KevinB Sorry can I ask one more question?
@david I know of no other alternative
an array, or lessthan/greaterthan
Basically, I want to change the picture of the blue bridge in the center to the profile picture of the user. I've tried to do this by doing id.style.backgroundImage="URL". But the original background image persists.
function onSignIn(googleUser) {
var face = document.getElementById("circleface");
face.style.backgroundImage = "profile.getImageUrl()";

 var profile = googleUser.getBasicProfile();
 var profileName = document.getElementById("googleName");
  profileName.innerHTML="Hey "+profile.getName();
  console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
  console.log('Name: ' + profile.getName());
  console.log('Image URL: ' + profile.getImageUrl());
  console.log('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present.
Oh, It's in quotations! I think that's why
Oh great
Everything's messed up
02:11
OK, so I fixed one of the errors
The thing is that I can't change the center image to the profile picture
@KevinB Any ideas?
If anyone can help that would be great
Rob
Rob
I'm assuming profile.getImageUrl() is returning merely a URL
You can't set backgroundImage to a url
You'd need to set it to "url(someurl.com)";
@Rob OK, Let me check it out
Rob
Rob
Sorry, I missed quotes here
You'd want something like
Yeah no problem I got it
Rob
Rob
backgroundImage = 'url("' + profileImageUrl + '")'
02:25
Thanks @Rob It's always the small mistakes that get me
Rob
Rob
No problem. Did that fix it?
pretty please
`backgroundImage = url( ${ profileImageUrl } )`;
03:00
this damn game crashes so much
which one?
03:17
witcher2
crashed just opening the map
user1596138
Who cleared so many stars
user1596138
Why is May 7 on the list
user1596138
And can I get a invite to chat 2.9? I was gone for 4 days. All moved in
@Jhawins i only noticed one that got removed, but didn't see that they'd all been messed with
03:33
So my mormon cousin is being sent to las vegas for mission work
well for his "mission" lol.
@overexchange It has little to do with ES6.
Several years ago, NodeList didn't have a forEach method, or any of the other ES5 methods, since it was not an array.
Some browsers (Chrome being one) started adding 'forEach' on 'NodeList' as a non-standard feature.
This was later incorporated into the DOM Standard.
And now most browsers support it.
Array.from(NodeList).forEach(..)
should work everywhere with appropriate polyfill
yo i need some html/css help
Then again, Array.from is newer than NodeList#forEach
is there a place for like css libraries...
03:38
@littlepootis fine do
erm I want to make a "create your player" page
[].prototype.splice.call(NodeList).forEach()
or whatever it is
Array.prototype.forEach.call(yourNodeList, function (e) { ... } )
@FlorianMargaine Congratulations dude. I wish nothing but the absolute best for you and your growing family!!!
04:02
Hello friends
1 message moved to Trash can
@Phoenix Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. For posting large code blocks, use a paste site like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
"blr":{
        "User Defined": {
        "path": "",
        "version": ""
        },
        "dev_ok": {
            "path": "/x/eng/bbnbs/daemon/DOT/dev/ok",
            "version": "9.5"
        },
        "dev_nightly (cst-ok)": {
            "path": "/x/eng/rlse/DOT/devN",
            "version": "9.5"
        },                                                                                                                                         }
How do I print the path /x/eng/rlse/DOT/devN here
console.log(Object.keys(builds)[1]) I did this and got till "blr"
599
Q: Access / process (nested) objects, arrays or JSON

Felix KlingI have a (nested) data structure containing objects and arrays. How can I extract the information, i.e. access a specific or multiple values (or keys)? For example: var data = { code: 42, items: [{ id: 1, name: 'foo' }, { id: 2, name: 'bar' }] }; ...

Thanks a lot :)
 
3 hours later…
06:54
Hello, is there any way of outputting JSON objects as string in HTML without them getting encoded to escape quotes? I'm using JSON.stringify(obj); and getting this output: {"1":false,"2":true,"3":true,"4":false}
> For Chrome: Create an XMLHttpRequest with responseType 'arraybuffer' that gets a size X from Content-Length header or X from a ProgressEvent's total attribute but response.byteLength Y; Y is smaller than X. You may write the URL endpoint you're making a request to.
I will repeat this until someone figures this out :D
Hey guys (and girls) :) ... I'm looking for a way to make a tampermonkey user-script for my Firefox v56, where it will 'insert' one button on a webpage and when I click on it, it will paste the clipboard content into <input> field. I asked the question but it was marked as duplicate, here: https://stackoverflow.com/questions/50323091/

I was being told that its not possible without creating an extension. But...can some of you check my question and see if there is a way without creating any extra extesions (addons) for Firefox. I just need a 'simple' script that can paste from clipboard into
@sarah997 Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
I just found some code in the codebase that tries to prevent uuid v4 collision
is that dumb?
my first reaction is that it's dumb
but maybe the seeds aren't quite right or something
what could be some reasons for that to be there?
07:08
@towc fundamental misunderstanding of what uuids are or how they work, reminds me of thedailywtf.com/articles/A-More-Unique-Identifier
@towc sounds dumb
there could be collisions
@BenjaminGruenbaum so I should be checkinig the implementation, right?
but anyone trying to prevent collisions doesn't really have a good understanding of uuids or statistics in general
see what the authors have to say about it
> "Oh," Andy said, embarrassed. "I see. But what are the chances of that?"
cracks me up
07:29
huh, found this in a comment: feedback handler for loginless users
that's nice
it's as funny as it is frustrating
one of the programmers tends to put his comments in all caps
// THIS HAVE TO BE CHANGED
he's so calm irl
this is pretty crazy
32:1 fuel ratio, 16:1 compression
07:54
how do you deal with variable shadowing for errors in node callbacks?
something((err) => {
  if (err) { ... }
  somethingElse((err) => {
    if (err) { ... }
  })
})
I don't actually care about accessing the first err, but eslint is complaining, and turning off the rule is dirty
I'd guess that using promises would actually solve this, but this team seems to prefer async/await regardless, and the api is full of callbacks
@towc promises === async await
well, promises don't leak scope
I have an answer with like a gagillion upvotes on converting a callback API to promises - google it
something
  .then((a) => { stuff with a })
  .then((a) => { more stuff with another a })

// vs
const a = await something;
stuff with a
const a = await something that emerged from stuff with a
oh wait there's an error
@BenjaminGruenbaum I know that you mean util.promisify, and it's very helpful
I guess with async/await, in the specific case of an error, the scope doesn't leak because of the try/catch block
but then maybe you want to do some other api request in the catch, which might also fail, and you're back to square 0
and even then, I'm not going to spend hours now converting the codebase to promises
thought that there's probably another elegant solution out there
You realize async/await works with try/catch right?
08:06
@BenjaminGruenbaum what did I say that would contradict that?
USM
USM
Hello
@towc You're not making any sense. That's not "scope leak" it's the fact then callbacks have to run in a function - it's a limitation and certainly not a feature. Also "oh wait there's an error" implies you don't understand error handling in async/await or atre being unclear
well, I like the fact that you're forced to encapsulate things in smaller functions
while with async/await, you need to worry about more things
Just use a block
and the error is that you declared a twice, not an error coming out of the async/await
@BenjaminGruenbaum have you ever seen someone use async/await and wrapping them in blocks?
08:14
@towc no, because it solves a made up "scope problem" you just invented.
it's a possibility, but for it to do stuff, it would need to use unnecessary mutability anyway. In which case you'd want to put that in a smaller function anyway
and at that point you would just want to use promises
Has nothing to do with mutability...
if you create a scope for the await, in order to do stuff with the scope above that, you need to modify a declared mutable variable
let a;
{
  const b = await something();
  a = stuff with b
}
stuff with a
I assume this is what you'd mean
You can just do in the above:
const a = stuffWith(await something());
yes. As mentioned, at that point you encapsulate things in smaller functions
and I'd rather have a cascading list of functional instructions (promises) to composition (async/await)
maybe it's subjective
maybe you do prefer composition
08:18
I'm not even sure what to say to that other than that you've not demonstrated that it's a problem or that it's even a worth-discussing tradeoff. It sounds to me like you're just inexperienced with either async/await, promises or both
api1((err2, data) => {
  if (err) {
    api2((err2, data) => {
      do2();
    }
  }
  do1();
});
in promises. that might look something like this:
api1()
  .then(do1)
  .catch((err) => {
    return api2();
  })
  .then(do2)
  .catch((err) => {
    ...
  });
I mean, not quite
do2 would happen regardless of whether the first api errored out or not, right?
but I think it gets a lot messier with async/await
That code is inconsistent though, what if api1 succeeds but do1 fails?
@BenjaminGruenbaum yeah, sure, there are more differences
08:24
Right, but you haven't properly defined the desired behavior
In fact, I doubt you understand the intricacies - which is why I recommend using async/await - at least until you understand things better
yeah, it's more complicated and less likely than I thought, I guess
I just don't really want to spend 10 minutes writing a proper example :/
and for now I guess I'm not clear enough for what I think the minor problem is
You're not :)
Hello everyone. I was hoping someone could help me out. I need to set a cookie if the customer clicked on the megaMenu. This needs to be false by default and the set to true on the next page if the customer clicked on a menu button. Any help would be appreciated
Wax
Wax
Hi.
I'm trying to create a simple blog function on my angular project where I can enter things with html tags like <b>
How do I make it render properly?
so far it's outputting things like this <b>lorem ipsum</b>
instead of it becoming bold.
09:07
Did anyone tried Continuously running selenium code for free on internet ?
@Mathematics not sure what you mean
@Mosho running code on cloud services for free, but code using selenium api
sure, if your network is configured to allow outgoing traffic
which it probably would be by default
09:22
is img tag exception to Same origin policy?
no
09:42
@SurajJain same origin means you can access the data - an img tag gives you opaque data. If you want to actually process it (in a canvas for instance) you need the appropriate CORS headers
09:58
@Mosho is that for me ?
10:18
So it is not exception right, we cannot read the image, if the origin is different we cannot read imagw though JavaScript it will be rendered but we cannot read.
This answer security.stackexchange.com/a/157065/166709 is misleading according to me, it is telling IMG tag is exception, but it is not.
10:32
@Mathematics yeah
"Same-Origin Policy (SOP) does not make CSRF impossible but it somehow limits the impact of CSRF in that the request gets send to site B but the result returned by the server of site B can not be seen by the attacker. Thus SOP makes CSRF write-only, i.e. CSRF can be used to execute unwanted actions but it cannot be used by itself to exfiltrate data from site B. "
In image case and script case too this happen we can not read image content, if try to read it with canvas will get error and we can execute script but cannot read its contents.
So could you correct that answer?
That answer is correct.
"Note that SOP does not prevent resources hosted on different domains to be embedded in a page by using script tags, CSS and image tags." <-- that's correct.
@SurajJain he's saying the request will reach the server but the response won't be seen by whoever made the request
that's correct
10:51
it's not about network or traffic.

I got this selenium web driver code as console app working on my laptop, I want to host it somewhere for free
@Cerbrus But it says img and script tags are exception taht is what is wrong.
I know it is saying that, that is what SOP is, but then how is terming img tag to be exception.
It is correctly following the behaviour.
@Cerbrus You will then get the CORS error on loading img to canvas, if origin is different.
Point is I am saying img tag perfectly follows SOP, how is he terming it as exception.
I found this error using socket.io latest version: "index.js: 83 POST http: //localhost/socket.io/? EIO = 3 & transport = polling & t = MDUHEO9 404 (Not Found)".
I understand the reason: the true address must be http: // localhost: 3000 / socket.io /.
Do you know how I can correct?
The answer is edited now guys.
@Mathematics to be able to open a browser you need outgoing traffic
It was corrected just 7 hours ago.

« first day (2767 days earlier)      last day (2405 days later) »