« first day (2831 days earlier)      last day (2111 days later) » 

12:47 AM
!!> Array(1e8).fill(0).map( () => Math.random() > 0.5 ).reduce((num, curr) => num += curr ? 1 : -1)
 
@ShrekOverflow Maximum execution time exceeded
 
12:57 AM
why no work?
{`testing
mathematica1
blah`:0}
a={};
a[`testing
abc`] = 23;
yes work?
silly answer here
no because no
 
Considering the chair is made in India
This makes no sense to me 😃
 
Yeah its why I only by electronics from china and maybe boks
 
@William lol
 
1:42 AM
morn
 
1:58 AM
Mam!
 
2:17 AM
trying to use flow and import types from a separate file. i'm getting "flow Cannot resolve module"
i checked that the file path is correct, and i'm using flow's import syntax properly
ugh i was using webpack aliased url to import the flow type's so i guess that don't work
thanks for nothing internet
 
 
3 hours later…
4:55 AM
Anyone familiar with a decent pattern for layering multiple filter methods over a dataset?
 
 
1 hour later…
6:07 AM
I am trying to install nodebb on aws but it is throwing this socket error
can anyone suggest how to solve it ?
 
6:27 AM
@monners template method pattern?
 
@monners Chain of responsibility pattern?
 
S.D
Hi,
I have a query.
I have a table with large no of rows and columns as well. I just want to fixed the header on scrolling vertically but allow the header to scroll horizontally.
 
@S.D 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.
 
76
Q: Freeze the top row for an html table only (Fixed Table Header Scrolling)

Davis DimitriovI want to make an html table with the top row frozen (so when you scroll down vertically you can always see it). Is there a clever way to make this happen without javascript? Note that I do NOT need the left column frozen.

@S.D Turns out if it must work with multiple browsers, it's not as straightforward as you'd think
 
6:47 AM
just use an approach with js
 
S.D
Thanks @Neil fro your respond but all of these are sticking header and not allowing the header to scroll horizontally
@KarelG yes @KarelG, please suggest?
 
@S.D Have you tried them all?
The header would naturally scroll horizontally
If by adding support for a frozen row, it prevented it from scrolling horizontally, I'd think that'd be a bug
 
S.D
7:11 AM
@Neil I tried with some of them.....an looking into it
 
7:37 AM
@hilli_micha You fucking what
 
Oh boy! Appears your typical tea drinker is not really amused.
 
8:06 AM
duck
 
duck
go
@geisterfurz007 he is far from a typical brittish boy
he did not vote for brexit.
 
Good!
At least from what I heard from German media it was mostly the older people voting for brexit anyway, no?
 
are you calling ben a youngling?
 
A question, suppose we create a variable in our html document called greenPlanet, relevant code and html:
<!doctype html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<title>Planets</title>
		<style type="text/css">
			.red {
				color: red;
			};
		</style>
		<script type="text/javascript">
			window.onload = function() {
				var greenPlanet = document.getElementById("greenplanet");
				greenPlanet.innerHTML = "Red Alert: hit by phaser fire!";
				greenPlanet.setAttribute("class", "red");
			}

		</script>
	</head>
	<body>
		<p id="greenplanet">All is well</p>
		<p id="redplanet">Nothing to report</p>
Why does console not have the variable greenPlanet ?
 
I was having a discussion with some of my friends at work the other day
 
8:20 AM
@geisterfurz007 yes
 
@Neil damn. Congrats
 
There clearly seems to be a.. hesitation to leave the european union
why can't they just hold another vote?
 
Because that would be insanely embarassing :')
 
@Neil the first vote wasn't even binding. A lot of people didn't vote because of that, and some protest-voted. It comes down to politicians being stupid
 
Yeah, well.. exiting the european union when they don't want to is a bit more embarassing imho
that's like saying, "Well, my pants fell down, so I might as well pretend I like it down"
 
8:22 AM
Wait you don't do that?
 
@towc Oh I know, the politicians were trying to make the public essentially show that they mostly do want to remain in the european union
But that's the risk they took
@geisterfurz007 My pants haven't fallen down yet, so I still have the luxury of saying that I don't :P
 
@Neil well, after that, even more stupid politicians came up
 
@Neil Heh! You're right tho...
I didn't know the first vote wasn't binding!
 
I think the story was that the PM who sent the referendum resigned after the results came in, and then theresa may was sent in without much of a vote, because she represents that majority. I'm not sure about the details there
 
It's the difference between admitting you made a mistake and pretending you wanted to do that the whole time
 
8:24 AM
and then theresa may had no interest in getting another referendum done, because it would make her lose power
 
My thoughts are that it isn't that admitting you made a mistake makes it real somehow.. it is already a mistake whether they admit to it or not
They just need to say, "Listen, things might have changed since the last vote, so we're giving it another shot.. We promise we're not redoing this one! This is for keeps!"
heck, they can even save face by saying that things might have changed
 
the populus can't just start a binding referendum with the current laws
unless there's a gvt takeover
 
Britain stands to suffer some financial clouds hanging overhead from this. Seems reasonable to be sure first
 
theresa may knows that people don't want to leave the EU
she doesn't care that they'll suffer
which is part of why so many people heavily dislike her
she's still going to earn a lot of money and power
 
Though it is admittedly a very British thing to not stand down in the face of such things
 
8:28 AM
well, the previous PM did exactly that. After the referendum, he stood down
 
woaaaaaaaaah! I just took a look at your website @towc Those pens are awesome
 
this is an issue of politicians who don't give shits about humans
and the humans who voted for them
 
s/politicians who.*/politicians/
 
not really
there are some good politicians out there
can I name any? not really
 
nah, I don't believe that
 
8:30 AM
but I'd hate to undermine the work of people who actually care
they should keep going. I'm not going to hate them just because they're politicians
 
I think they'll look after the country, but only after they've looked after their seat in Parliament
sometimes it's the same
Often it's the same
But that doesn't mean they care
 
hi
 
hello guys stackoverflow.com/questions/51269489/… please, bounty also offered
 
@GiamPy I think it is only a suggestion, not a guarantee
Browser can completely disregard caching
 
it adds too much overhead to my requests though
 
8:43 AM
Depends on the browser and/or client
 
because it's ~150ms approx. for the OPTIONS + whatever request
that's like 350ms/400ms for each request
which is way too much
 
hmm, you could always cache it backend
couldn't you?
 
what? the data?
 
yeah
What data are you returning?
 
it's just JSON data, it's basically an API
if the access control headers are just "suggestions" how do other sites use those headers properly preventing multiple OPTIONS?
 
8:47 AM
well if they're using your client, I suppose it'd be disregarded for them as well
default should be 5 seconds.. have you tested to see that it isn't requested for requests within 5 seconds?
 
yes
 
If so, then for whatever reason, you're not setting the header value properly
 
every single time the options request is triggered
 
hmm, then it seems disabled, not even the default 5 seconds
 
does chrome devtools disable cache disable also CORS caching?
 
8:49 AM
I haven't considered that, but it could be
you could give that a try
 
on it
 
@Neil on short term it is damaging. Long term not. Dependent of the approaches the next governments would take, the country would benefit from brexit
 
@KarelG I think that's what's being evaluated
I don't think it's a given that they would benefit long term
 
> Dependent of the approaches
that research contains some scenarios
but politics and researches does not go well together often
 
Honestly it would have been better had Britain not joined at all
I feel the same about Italy joining, though leaving at this point would be disastrous
 
8:54 AM
@Neil well that was actually the case
 
be careful with that
the EU brought many good things
 
fucking devtools disables also CORS origin cache
nice way to waste 50 points in bounties LOL
 
@GiamPy hah :)
 
but it's very good to know
 
Well, if you'd pay 50 points to solve your problem, they're still 50 points well spent
 
8:56 AM
yeah but it was just like the rubberduck effect ahah
 
9:07 AM
interesting: trailing commas aren't allowed after rest elements
a = { b: 1, c: 2, d: 3};
let { b, ...e, } = a // SyntaxError
makes sense. It's weird that I haven't ran into it before
 
I have a global array
above a function
var numbers = [];
function myFunction() {
    var fruits = ["Banana", "Orange", "Apple", "Mango"];
    numbers.push(fruits);
    fruits.push("pepsi");
why I get output with pepsi as well when I try to get numbers?
 
you're pushing a reference to the fruits array
you might want to do numbers.push([...fruits]) instead
this pushes a new array with the items of fruits at that moment, instead
 
ah
that clears a big doubt thank you @towc
 
also, please keep in mind that fruits aren't numbers
 
haha
 
9:14 AM
and pepsi isn't a fruit
 
I thought it was
 
bepis
 
kidding
@towc your website is amazing! :O
jesus how come some people are so awesome
 
@towc uhm
re-read it :)
 
huh, fairly ambiguous
 
9:29 AM
yeah
found it funny
 
@Breathing I meant that the reference is to the fruits array, and you're pushing it to the numbers. Just to be clear
 
@KarelG just look at his website
 
lol, he knows
 
yeah I get it xD
wanted to clear my concept
 
I'm not that amazing compared to a few people here, btw
 
9:30 AM
...
all super saiyan gods
my life would be fulfilled if I reach anywhere near you guys
 
oh man
if you think like that, you'll always want more and end up being so arrogant
life is not a competition for skills or money
it's about self-fulfillment. Do what you enjoy
 
btw
about that rest elements
I have been using that to slice my array if the starting index is small
 
don't blame you
 
like let [,,,...newArr] = arr
 
oh
I blame you
 
9:35 AM
hmmm
 
I was curious if someone would accept that through coderev
 
I tend to use it for "splicing" if I want to keep a reference to all things, but separately
 
one did another not. I applaud him for daring to go against me
the fact that i am a team lead does not make me invulnerable for coding errors or questionable code
 
const pascalToCamel = (pascal) => {
  const [firstChar, ...otherChars] = pascal.split('');
  return `${firstChar.toLowerCase()}${otherChars.join('')}`;
}
this can also be done with splicing/substringing, but this seems slightly cleaner to me
 
that is not correct
you forgot a $ there
 
9:37 AM
@KarelG when reading this, I'm not sure if that's slicing after the 3rd or 4th, without testing it out. Which isn't a completely bad thing, but urgh. Also, I have to count
@KarelG right
 
@towc ofc it is bad code. hard to read if you have a bad font :P
 
(and yes, I'm aware I don't need to split pascal, but this makes it slightly more readable. Also, more easily findable errors, in case I pass in an actual array instead of a string. Ok, typescript might have helped here)
 
Wait, you could just do const [firstChar, ...otherChars] = pascal ?
JS is an absolutely mad language :D
 
array destructuring works on any iterable (afaik), and strings are iterables
 
^
 
9:40 AM
Daamn.
 
wait for object destructuring :)
 
I know object destructuring (at least the concept. very certainly not to the extent of everything it is capable of) but that array stuff... It scares me ;)
 
fair
 
I probably don't even want to know the full extent either :D
 
hi can i return a promise in a nodejs Server?
 
9:47 AM
1 message moved to Trash can
@KTWorks 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
 
@KTWorks return it to what?
 
var rp = require('request-promise');
var express = require('express'),
    app = express(),
    port = process.env.PORT || 3000;
var options = {
    method: 'POST',
    uri: 'http://api.posttestserver.com/post',
    body: {
        some: 'payload'
    },
    json: true // Automatically stringifies the body to JSON
};
app.get('/', function (req, res) {
    res.send(
        rp(options)
            .then(function (parsedBody) {

            })
            .catch(function (err) {
                // POST failed...
i want to route a request. So i thought i could send a promise from a webserver
 
not really
 
This is the browser Side
axios.get("http://localhost:3000/").then((res)=>{
    console.log('================res====================');
    console.log(res);
    console.log('====================================');
})
 
but you can res.send from within your then/catch
app.get('/', function (req, res) {
        rp(options)
            .then(function (parsedBody) {
				res.send(parsedBody);
            })
            .catch(function (err) {
                // POST failed...
				res.send(err);
            }));
});
 
9:49 AM
it works. But i dont really know what os happening here
 
you might want to read up on promises
 
 
1 hour later…
10:52 AM
Anyone with good Angular + Karma knowledge? I'm trying to include a JavaScript library in one of tests and can't figure out how to. Been trawling the net for half an hour and found zilch. Some stuff for AngularJS, but doesn't seem to apply to Angular. :/
I include the library in my Service by importing and declaring as follows: import * as StellarSdk from 'stellar-sdk/dist/stellar-sdk.min.js'; declare const StellarSdk: any;. Karma of course needs something similar to be done for the unit test, but I can't figure out what. Gives the error: StellarSdk is not defined
 
11:20 AM
@RichardDunn try checking the karma conf 'files' property to see where it's looking for files
I'm having issues with my question: stackoverflow.com/q/51367089/1075247
I can't recreate my problem in the snippet without manually retyping half the webapp
(n.b. it's a button on the item, and then that makes a modal, and it traipses through half a dozen more files before getting back to the code I've written) in the snippet
any suggestions for either a) what does my problem sound like? or b) how to better recreate the issue?
 
12:16 PM
@Pureferret Thanks, but that doesn't seem to be the solution. At least not in full.
 
I just spent about 2 hours digging through proxy bugs, express-session's source code and github issues, making independent apps for testing stuff, just to find that it was all irrelevant to my bug, and I had changed a parameter in another function to quickly change something, but nothing had a reason to error out
so it's now 2pm and I haven't gotten around to lunch yet
the upside is that I learnt an ok amount about the internals of things I use fairly often
morn
 
"mourn" would suit ya more
 
12:32 PM
oh absolutely
I got so stressed by how many things I was trying to keep track of, and how what was happening was defying a lot of what I knew, but was still plausible
I feel like I've just finished a long very intensive run, but without having eaten all day
someone cuddle me
 
*shivers* at the thought to cuddle towc.
😛
 
just because my skin is poisonous, my arm hair is made of sharp blades, and if you look me in the eyes you burst into flames, is not a good reason to discriminate against me :/
well, now I need to decide what to eat at this time
aaaand it just started pouring rain with no non-internet indication
isn't life amazing
I'm in shorts and sandals, at the office
 
just checked the weather in bratislavia
cloudy with chance for rain and you went with shorts and sandals?
 
it's been very sunny the past few days
a few minutes before it started raining it was sunny af
 
do not look at the past
it is about today
those are for sunny weather. Go with large pants and moccasins if the weather is cloudy / going to rain
 
12:44 PM
point was, I was used to shorts and sandals
didn't think I'd have to change up today. I hadn't in the past 2 weeks
 
o.O
2 weeks in same cloths?
or just clothing style
 
well, style
 
do not be the guy who wears sandals at work
you will be ripped a new one behind your back
 
well, it's not really work
it's not really an office
neat visualizations of AI types in movies: scifiinterfaces.com/2018/07/17/untold-ai-sadowski-visualization
 
1:13 PM
@SterlingArcher We have someone here who actually wears their badge attached to the sandal :D
 
@ThiefMaster that is disgusting and I hate them
 
I find it hilarious, since it's a great way to protest a stupid "wear your badge visibly" policy
 
in what other profession are mistakes something you do every 10 minutes (if not more often), and it's completely ok to do them?
 
Pilot.
On a more serious note: Politicians!
My educator.
 
1:32 PM
@SterlingArcher worse: wearing sandals but not clipping the toe nails
saw it multiple times here at work D:
fortunately nobody dared to come in sandals and white socks
fuck just no
 
1:48 PM
Hello

I have a question regarding CORS: Why does (only) the requested Server make the descision about allowed origins by setting "Access-Control-Allow-Origin" in the header?

E.g. 1) Original Request goes to trusted.example.com. 2) We assume the site is infected (XSS) 3) Evil Script send Request to evil.example.com 4) Server from evil.example.com set the "Access-Control-Allow-Origin" Header to *. 4) XSS send data successful to evil.example.com

If the original server (additionaly) would need to define the allowed origins, then the above case wouldn't be possible. Or do I interprete somethi
 
if your site is infected, you are screwed anyway
even with CORS taking this into account, they could just embed an img tag with a src containing the data
 
@ThiefMaster No, this wouldn't work if my server defines the allowed origins, because the img src attribute with a different source wouldn't work either.
 
ah you mean as an opt-in feature... why not just use a CSP to prevent XSS?
 
Ahh by CSP you can define which sources / domains are allowed. Cool.
 
caution: IE does not support it very well
 
1:57 PM
But what is the benefit of CORS? Except to forbid someone using my API over JS in Browsers?
 
it does the opposite
 

« first day (2831 days earlier)      last day (2111 days later) »