« first day (2753 days earlier)      last day (2178 days later) » 

12:02 AM
what is Miaou and does anyone have a link to it?
 
a chat site and.. not on me.
use this room's search box for "Miaou" and you'll find it
ohh shit. Loktar has gone feral.
 
i have located it, thank you
 
@Luggage He's just feeling a little blue right now
Welcome to defenestration club. The first rule of defenestration club is: *throws rule book out window*
 
I just learnt that JSON.stringify(obj) always invoke obj.toJSONmethod if provided, and casting objects that have a toString() method against numbers like new Date() - 1000 will properly do the subtraction... What's this "technique" called? I want to read more about this but can't find anything in google. I just want to know the list of methods I can use in objects to control how they work against some operations like the ones I just mentioned for serialization and math operations
 
rtyley.github.io/bfg-repo-cleaner This is a fantastic tool
Accidentally published 4 api keys to github
This fantastic piece of magic made it all go away
 
12:17 AM
@Frondor that's interesting, I didn't know JSON.stringify did that
 
@david I'm amazed like a kid who just created his first function xD I know in PHP these methods are called magic methods but I don't know if javascript has a naming for that
 
and NaN gets serialised to null...
!!> JSON.stringify([NaN, null, Infinity]);
 
@david "[null,null,null]"
 
@Frondor js has many quirks like that, and you can find them all in the ECMAScript spec
although it's not as easy to read as regular docs
 
Yeah, everything is there in the spec but how do I know how to look for something like obj * obj = 4 for example? How's that called?
const obj = { toString () { return 2 } }
console.log(obj * obj)
 
12:38 AM
oh man that is messed up...
 
12:52 AM
@CapricaSix Now that IS bad.
 
1:05 AM
public async query(...args: any) {
    this.pool.query(...args);
}
Any suggestions how to keep type safety in code like ^
the query thing comes from pg so I don't want to implement all the cases
@SomeGuy I had similar if not the same RSI issues, it depends on what you prefer there are very low pressure firing switches like Cherry MX Browns. I would recommend trying them out if you can. What you should be wary off, buy it off Amz.com (not .in) 😀, there are tons of cheap knock-offs.
 
1:22 AM
var obj = {
    toString () { console.log('called to string'); return 2 },
    valueOf () { console.log('called to valOf'); return 4 }
}
console.log(obj * 4) // 8
If valueOf returns a primitive, then js uses it, if not, it falls back to toString... This is madness!
 
yeah it will be in the spec too... I think all of these things are in the realm of stuff that I'll just never actually do... and that way I'll hopefully never have to worry about them
 
1:51 AM
I find it cool to know when authoring libraries
 
2:31 AM
Hey folks, anyone around with experience dealing with character encoding/decoding issues?
I've got a websocket server that's passing me misinterpreted encoded strings like "You might mistake it for a human, but it won’t mistake you for a Mech."
This regex works fine in the browser console:
"You might mistake it for a human, but it won’t mistake you for a Mech.".replace(/’/i, "\'")
21:47:28.565 "You might mistake it for a human, but it won't mistake you for a Mech."
But when I put it in a function like below, or even use the regex directly in my code (plain vanilla JS), it doesn't work at all
const fixEncoding = function(inputString) {
    let fixedString = "";
    // ’ to single quote
    fixedString = inputString.replace(/’/gi, "\'");
    return fixedString;
};
I've been digging around for a while trying to understand WTF is going on, but not having any luck
I can ask on SO site if you think that would be better
 
I'd suggest fixing the problem at the source, why are you getting '’' in your string?
 
We gotta fix something on the server, but that requires a new deploy/release so I'm trying to quick-fix it client side for now
I've also added <meta charset="UTF-8"> in the HTML, to no avail, and also tried this, which also didn't produce the desired results
It's almost as if the string from the websocket is not behaving like a regular string
This is what I get when I JSON.stringify it (one entry that has this issue)
        "8":{
            "command":"card",
            "id":8,
            "properties":{
                "SCRAP":2,
                "MAX_HEALTH":3,
                "imagePath":"cyborg-chronicles/default.png",
                "MANA_COST":4,
                "creatureType":"Mech",
                "TAUNT":1,
                "flavor":"You might mistake it for a human, but it won’t mistake you for a Mech.",
                "SICKNESS":1,
                "effect":"Change HEALTH by -2 on 1 random creatures of type Bio owned by opponent on Battlefield\n\n at start of your turn",
Well this is rich
const fixEncoding = function(inputString) {
    let fixedString = "";
    inputString = inputString.toString();
    // ’ to single quote
    fixedString = inputString.replace(/’/gi, "\'");
    return fixedString;
};
Adding .toString() to the input string fixed it. Wow.
 
3:11 AM
       // In a loop
       try {
            lemon();
            continue;
        } catch (e) {
            logger.error('Le error', e);
        } finally {
            // something
        }
WDYT: Will the finally execute ?
 
i kinda hope it will
yeah it does... phew
 
😃, I am amused that you thought it wont
 
i expected it to, but the fact that you were asking scared me a bit
i had to check to make sure that my understanding of the world wasn't about to fall apart
 
why is this oauth openid so god damn complicated!! ughh.
 
The fact that I had to test it to make sure myself, scared me a bit
@shriek Whats up, I can definitely help! Disclosure: I work for an Auth company
 
3:25 AM
lot of dancing.
 
How so ?
 
@shriek What seems to be the problem? Disclosure: I sometimes walk into things
 
@david 😃 lol
I am disclosing as per SO policy or something of that sorts I remember where people disclose significant "attachment"
 
is that actually a policy? ><
 
IDK vOv I saw almost all lib authors etc padd it
 
3:27 AM
ah, fair enough
 
@shriek Ideally it should be a redirect and at most one call to the OP.
 
still seems weird... almost like 'Disclosure: I know enough about the thing you're having trouble with to do it as a job'
 
In case of OpenID Connect you can in most times just drop the call unless you are getting an access token aswell, its extraneous.
 
Who controls the authorization server?
Guessing it's other than api creators?
Or maybe I'm completely misunderstanding it.
 
wut
 
3:30 AM
yup
 
@shriek Lets take a step back, what are you tryin to do?
@shriek Not a bad assumption.
"Shriek & Shrek Debugging"
@david so here is question,

How would you lock a class with a dynamic scope outside it? Or would you just use an instance ?
yeah I guess I am going to go with an instance
 
I'm not following the question I think
are you deciding between static methods on a class vs instantiating the class?
 
but it just feels ugly
@david yeah kinda
I am trying to wrap my ugly sql methods
but transaction is a problem
 
ahhh yes, transactions
we have a similar problem atm
 
I thought of using Class.withTransaction() to give me a version of the class which has all the methods bound with transactions.
 
3:38 AM
we're using knex, so all our methods expect to be called with a db object to operate on
but they can also be passed a trx transaction object to use instead
 
But I guess

Class.action(params, [transaction]);
instance.action(params, [transaction]);
 
but we're not super happy with the solution
 
Yeah that is what I ended up with ^
In JS what I am trying to do will work but not in TS :P
export default function getJobModel(db: Database | Transaction = instance) {
    return class extends Model {
        public static withTransaction(transaction: Transaction) {
            return getJobModel(transaction);
        }
   }
}
 
All our requests have a context object created that they can use, and this is what has the DB stuff attached. I had considered forcing every single request to have a single transaction but that is very inflexible
 
This is probably the ugliest and the worst way of doing this :P
because I'll shoot myself in feet with nested transactions
I guess what's good in React isn't good everywhere </joke>
 
3:43 AM
@ShrekOverflow
Just trying to understand how the flow works.
Trying to create protected resource/api with google/other_login_providers. Not really sure where the authorization takes place but I'm pretty sure Google/other_login_provider doesn't provide `access_token`.
Also, need authorization implemented too. Meaning users would have scope so certain users are allowed to do only certain things.
I'm pretty sure I'm overlapping multiple things into this but finding it hard to wrap my head around it.
Okay, I might be confusing scopes with OpenID scopes. I suppose I can grab the userid and check their authorization role from db.
 
3:58 AM
@shriek So on a very high level there are 2 inter-dependent scopes
OpenID Connect builds on top of OAuth 2 and provides only Authentication.
OAuth2 only provides the authorization to call the providers apis
From your application's point of view you'll need to build your own Authorization logic
 
lol
 
@shriek That would depend for example at Auth0 where we can issue AccessTokens for 1st Party (your) API you'd just tell us what scopes to put in the access token and we'd issue it for you.
Can you gimme an end to end example 😃 ?
 
Taking Auth0 out of equation for now. Let's say I do allow users to login through google and given that I have registered my service with google I get `access_token` from them I'm guessing(?), allowing me to see their userid/email/etc.
And I think based on the userid from the response I'd probably need to do a lookup in my db for user's role?
Is that somewhat correct?
 
4:19 AM
@shriek Yes and No.
 
4:35 AM
I'm researching like a mad man right now.
 
4:51 AM
how do i tell my NaN to return as '0'?
instead of 'NaN'
because in my code, a return of NaN is useless, i rather it return 0
 
if (Number.isNaN(<number>)) ... ?
 
can i do it in an 'if' statement?
 
how are you getting NaN?
 
if (if(number.isNan()))?
 
if your code is returning NaN there is probably something else wrong
 
4:57 AM
i have an object list
that pulls data from SQL table
the table starts off blank
so i get NaN when nothing is in the SQL table
my code goes to shit because of that
so i gotta make NaN into 0
'objectlist' --> 0 if 'NaN'
 
i'm not following completely... i'm pretty sure there is something else weird going on
 
no, not all sql tables are populated
they start off blank
 
yeah, but then you just get null or an empty array back when you query it
not NaN
 
it's an object array
DebitRewardsDataList.filter(x => x.NAME == pname).map(x => x.REWARDRATE)
 
so should get empty array no?
 
5:01 AM
just to be clear, what is an 'object array'?
an array where each element is an object?
like [{}, {}, {}]?
 
\o morn
 
Whoever is doing that, can you like not flag stuff from three days ago
That was soooo last weekend
thx
 
@BoltClock I wasnt flagging.. In fact I ended up here because I saw a flag
 
@SurajRao That's why I'm here
Was trying to address the flagger without naming them
 
fine I will leave it to you then :)
and it was a looong weekend
 
5:05 AM
hi all! I am relativelly new in server side world...If you have a bit of time, can you please make light to me about this question? stackoverflow.com/questions/47793329/… Thanks!
 
@BoteaFlorin The quote you linked is about a different type of node, not node.js
you could start with the node.js website nodejs.org/en
 
gime a sec guys
i think i found out the problem, thanks for the input btw!
 
5:33 AM
@Loktar Nope, I left when I became the only person to have been there in months
@ShrekOverflow Nice, thanks for the tips. I'll go with the browns, I think
 
what does localstorage does in jquery?
 
stores local storage in storage
 
And it's a JS browser API not a jQuery one developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
 
@Breathing developer.mozilla.org/en-US/docs/Web/API/Window/localStorage its storage in browser.. Not exactly related to jquery
 
@Breathing it's a place in the browser that webpages can store data between page refreshes. It's not jquery specific
 
5:43 AM
so is it different for different browsers?
Thanks by the way, all! :)
 
yes, if you load a webpage in chrome and it sets a value in localstorage, and then load the webpage in safari or IE the value will not be set
 
but that is how it is in real world right
That's how I am able to login with different accounts on 2 different browsers
 
yep
 
I see that in a code 'document.cookie' was replaced by this(localstorage)
 
I don't know enough about the merits of local storage over cookies to be able to comment really. They both do similar things. Cookies came before localStorage
 
5:57 AM
so between localstorage and session storage which one should I prefer?
 
how long do you want to store the data for?
 
not all day of course
some time period
 
6:12 AM
heyo
 
I have a question how can I transfer the array of variable to other variable?

For example

var x = ["bar", "foo"] //the bar and foo will be transfer to another for like into var y
var y = [];
Or

var x = ["bar","foo"] //copy the array into var y
var y = []
 
6:33 AM
@SurajRao thanks
 
@PureRhymerOrganization arrays in js are passed by value
And a handy method to clone them
is by using [].slice()
 
@SomeGuy again I recommend trying it out FTR the MacBook keyboard activation force is greater than the mx Blues
 
@SomeGuy or, you could go with Topre switches
ive never had a chance to use them but people praise them highly
 
@ShrekOverflow Oh, should be fine, then. The MBP keyboard doesn't feel too stiff
@KamilSolecki Never heard of those, interesting. It's not an option in the ErgoDox EZ (which is what I'm most likely getting), though
 
6:53 AM
Can someone tell me what is URL_REQUEST_DELEGATE?
I have tampermonkey, uBlock Origin extension
suppose on this page "https://stackoverflow.com/questions/18157012/possible-to-list-external-resource‌​s-loaded-on-a-webpage-with-javascript"
I have turned them both off
now when I go to the page again.
chrome://net-internals/#events
shows
175966: URL_REQUEST
stackoverflow.com/questions/18157012/…
Start Time: 2018-04-30 12:24:02.702

t=425892 [st=  0] +REQUEST_ALIVE  [dt=380]
                   --> priority = "HIGHEST"
                   --> url = "https://stackoverflow.com/questions/18157012/possible-to-list-external-resources-loaded-on-a-webpage-with-javascript"
t=425892 [st=  0]   +URL_REQUEST_DELEGATE  [dt=12]
t=425892 [st=  0]      DELEGATE_INFO  [dt=12]
what is URL_REQUEST_DELEGATE?
 
7:06 AM
@SomeGuy they are a more expensive alt to cherry, but a lot of people on r/mk love them
 
Ooh
 
7:19 AM
Morning all
 
@New_2_Code Morning!? it's 5:20 pm!
oh wait, the earth is round...
 
mornings
 
neat: 🤯
 
7:40 AM
@JacobSchneider lol 09:40 here. :D
 
8:09 AM
XD. Haha
 
How you manage to stay calm, sensible and reasonable is beyond me.
+1
 
^ that
 
Mod training from Node.js, formal training from for conflict resolution and years of meditation practice. Also, I'm genuinely not upset or angry.
 
That makes me wanna prod at you...
 
8:41 AM
See what it takes
 
Node and the mod team are always looking for more members, and I admit our space there is a lot safer (note safer isn't always better and safety isn't what we should optimize for IMO)
Me and twitter drama are quite acquainted, I don't use twitter but I often have to clean up after people are harassed at Node.js - I'm scared at a similar outcome.
 
There is an Xbox achievement: "Piss off Benji" I heard
 
Might be a bad idea though. 'Cause then I'd see the wrath of our overlord as well.
 
The worst possible scenario is that this keeps getting escalated by third parties - to be clear, the worst case scenario isn't that they close the chat. It's that this gets to reddit somehow where there is a very violent and active "anti SJW" crowd.
 
ok so interesting stuff
 
8:43 AM
The stupid thing is that I only ever see this kind of "interaction" on twitter
 
The worst case scenario isn't "we get shut down and move to slack" it's that Sam Saffron, Shog or Chris get death threats and phone calls 24/7. That is quite horrible and exactly the outcome I'd like to avoid.
They're playing with fire and I don't think they understand that.
 
@BenjaminGruenbaum wat, seriously?
 
if you wanna upgrade from win 10 home to pro but it won't accept your key for some magical reason, you need to edit registry to make it think it's win 10 pro, then upgrade using a generic win 10 pro key, then finally enter your actual win 10 kwy
magic
 
Maybe they do, maybe I'm just paranoid.
@Cerbrus yes, this has happened before to members in Node who spoke up for inclusivity. I don't recall room members being too worried about what Ashley or Rodd actually had to go through when we've had drama at Node.js
 
Dunno. I guess I'm not that up to speed on how drama works any more.
... Which isn't necessarly a bad thing
 
8:46 AM
It's not, if I hadn't volunteered to help with that I wouldn't be either.
 
I'm just very disappointed that they're making this room out to be some kind of s***hole that only discusses off-topic / vulgar subjects.
Extreme lack of context, as usual.
 
@Cerbrus That's why I don't use twitter in a line.
I've found it to be an extremely unthoughtful place that encourages bad communication.
 
It is, I still ask that for now, we avoid responding to anything on Twitter, despite SO's apparent stance on the matter.
 
I don't have twitter exactly so I don't get into those things.
The problem is - I totally understand why Abby wrote what she did on twitter for example - because she is genuinely concerned. She heard someone complain about something she cares about and she wants to do right by her community. It's unfortunate that she hasn't reached out to her fellow community managers first but it's not surprising.
 
@BenjaminGruenbaum I've seen some replies that are basically saying "Burn it down"... Yay mob mentality.
 
8:53 AM
@Cerbrus yes, the problem is the people writing these replies don't understand it goes both ways which is another reason I dislike twitter. Our best option is to make ourselves as approachable as possible which is why I like Kendall's PR for the culture repo.
 
@BenjaminGruenbaum
Can someone tell me what is URL_REQUEST_DELEGATE?
I have tampermonkey, uBlock Origin extension
suppose on this page "https://stackoverflow.com/questions/18157012/possible-to-list-external-resource‌​s-loaded-on-a-webpage-with-javascript"
I have turned them both off
now when I go to the page again.
chrome://net-internals/#events
shows
175966: URL_REQUEST
https://stackoverflow.com/questions/18157012/possible-to-list-external-resources-loaded-on-a-webpage-with-javascript
Start Time: 2018-04-30 12:24:02.702
 
@SurajJain Please don't ping people randomly in the room asking for help.
 
user1731387
hi all good afternoon... <!--#include file="header.html"--> this thing is not working in webpack. can anyone help me ?
 
It is inappropriate to ping me if you asked a question before and haven't gotten a response. Please read the rules.
 
@Cerbrus the worst part is that with every next person involved, less information is shared and the light of the situation shifts. Last person in the chain might as well be bashing Obama for that, wouldn't be very surprising.
 
8:57 AM
@MadaraUchiha @BenjaminGruenbaum Sorry
I thought you did not see it that is why I pinged
I am unable to understand URL_REQUEST_DELEGATE
 
9:10 AM
Also, I've gotten myself an ultimately cool wallpaper
 
damnit, I almost burned my mouth off while eating a pizza slice today
 
@Ikari Not quite postrock (more indie), but I think you'll still like it youtube.com/watch?v=eMw4hDIEQYw
 
seems pretty nice, thanks! ^^
 
hi since webpack 4 is out. What do you recommend webpack dev server or browsersync?
 
@KTWorks Welcome to the JavaScript chat! Please review the room 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.
 
9:20 AM
@KTWorks i like using webpack server, never used browsersync tho.
 
dont get it done with proxy
 
@BenjaminGruenbaum I just want to say that I applaud you for how you communicated and handled this in the way you did. As if I didn't have enough respect for you already
 
9:35 AM
^
 
^
 
I appreciate the kind words though I'm not happy with how I handled this to be fair, my discussion with mitzy was far from great (you can read it in the mod repo) and we obviously shouldn't have been in this position to begin with
 
This is a very large chat room to manage and they were obviously looking for something to attack.
They shifted the reason from the initial article to the onion one and then the comment
If that hadnt done the trick... wouldnt be surprised if they scroll through transcripts going back a long time
 
Oh, if they scroll the transcript they'd very likely find stuff they find objectionable - just look at how easily I've found objectionable stuff about mitzy.

What I wanted to communicate is that we prefer that if they have an issue they talk to us (through any medium) rather than write about it on reddit. My main concern is this at this point:
1 hour ago, by Benjamin Gruenbaum
The worst case scenario isn't "we get shut down and move to slack" it's that Sam Saffron, Shog or Chris get death threats and phone calls 24/7. That is quite horrible and exactly the outcome I'd like to avoid.
 
Oh..Is it possible you are getting ahead of yourself?
 
9:48 AM
The bit that riles me is that this 'real_ate' guy admits to only joining chat as an 'experiment'. He had no intention of contributing, just wanted to find something to take issue with. twitter.com/real_ate/status/990687960583598080
 
Getting ahead of myself?
 
@BenjaminGruenbaum as in getting worked up/worried over too remote a possibility?
 
Well, I've seen it happen before in similar circumstances, multiple times and it terrifies me.
 
@SurajRao nah, it doesn't take much for the internet to start throwing out death threats
 
@BenjaminGruenbaum I can totally understand your way of action there
 
9:51 AM
Joining the chat as an experiment doesn't imply that he had no intention of contributing - moreover this is more about how we prevent the next case rather than justify that particular user's experience . I think the proposal of having a user read a few lines when joining and "agree" to them would be good.

This can be something along the lines of:
- What the room rules are (we can rename it to code of conduct if we want).
- How to report issues.
- Expectations in a line or two (don't ask to ask, questions welcome, make MCVE).
 
I'm still unsure how we should handle this. People will not see how valuable this chat is for a lot of regulars here, Amaan even described it as "life changing" when he visited me in Austria
I for one will be more restrictive on some subjects being discussed I think
That itself will lead to some trouble, but at least within the room
 
@BenjaminGruenbaum I dunno man, after he was kicked he came back and said 'thank you' as if he'd just been given everything he needed to be able to make the twitter post that he'd already decided he was going to make. He just needed content for it.
 
I think this is pretty far fetched
 
I'm 100% OK with talking about things like politics, sex and drugs as long as we're calm and respectful about it - and when/if someone finds it objectionable to drop it or take it elsewhere. I actually like what our current policy says about it javascriptroom.github.io/rules/#etiquette
2
@david Or he was being sarcastic perhaps
 
that guy's tweets are really getting under my skin
 
9:56 AM
@BenjaminGruenbaum Stop being so unnervingly positive
it's weirding me out :D
 
I really don't think we are part of a conspiracy or a scheme here ;)
honestly, I think he's a good guy and trying to do the right thing
 
@GNi33 maybe you're not
 
tell that to my lizard overlords
 
@GNi33 I think he's just looking for a spotlight
 
Honestly? I'm not sure what real_ate thought when he came here I'm not a mind reader but I assume good intent generally.
 
9:59 AM
@GNi33 Yeah I'm pretty sure in his mind he thinks he's helping. But I don't believe for a second that he came to this chatroom wanting to talk about javascript.
 
road to hell paved with good intentions?
 
1 message moved to friendly bin
 

« first day (2753 days earlier)      last day (2178 days later) »