« first day (3201 days earlier)      last day (1753 days later) » 
01:00 - 15:0015:00 - 23:00

1:18 AM
that's pretty hot towc
 
 
5 hours later…
6:32 AM
@towc congrats I guess :)
Do you get some of the royalties?
 
7:12 AM
> Paperback – August 9, 2019
🤔
 
@KarelG wait, what year do you think this is? You do know it's 2024, right?
 
it is? 😲
 
you feeling okay? I got worried after you told me about your head injury..
 
I just woke up and did my daily routine. Did I have been out of the loop? It was just a dream no?
 
@KarelG I don't know, you were bed-ridden for some time afterall
the doctors did say you might have momentary losses of memory
 
7:21 AM
The following is the callback of a promise and spec gets successful if I just test that onSearchInsuranceSuccess gets called but it fails if I test the props used inside the function
onSearchInsuranceSuccess(res: InsuranceSearchResponse) {
        console.log('passed', res);
        if (res.success) {
            this.showForm = false;
            this.plans = res.data;
            this.benefitsList = res.benefits;
        } else {
            this.message = res.message;
        }
    }
And the spec component.spec.ts:
fit('should send the success response to "onSearchInsuranceSuccess"', fakeAsync(() => {
        spyOn(component, 'onSearchInsuranceSuccess');
        insuranceServiceSpy.search.and.returnValue(Promise.resolve(insurance));

        component.travelPeriod = ['01-08-2019', '01-08-09'];
        component.destination = 'MY';
        component.tripType.individual = 'days';
        component.onContinue();
        fixture.detectChanges();

        tick();
        fixture.detectChanges();

        expect(component.plans[0].plan).toEqual(insurance.data[0].plan);
 
@MadaraUchiha nice
 
@BenFortune You didn't push your fix to the blue user names, by the way
I fixed it myself after the merge
 
7:37 AM
Morning :)
 
@MadaraUchiha I did?
It was working on my local
 
@BenFortune What was your solution?
 
What did you fix?
This was mine, which somehow worked
 
@BenFortune That doesn't work.
The :not():not():not() version does.
Also, it's not that the :not():not():not() necessarily works while the :not(a,b,c) doesn't
You merely forgot to add .signature
I suspect your comma solution affected way more than you intended.
 
7:53 AM
the chained :not didn't work for me for some reason, but the comma version works with SASS
 
@BenFortune Again, since your fix doesn't even include .signature which is the selector for the user names
I suspect that your fix, "fixed" way more than you intended.
 
Oh so my "fix" actually broke it, which in turn I thought fixed it?
😃
 
Pretty much 😛
 
Gonna need some e2e tests my boy
 
@MadaraUchiha fyi, CSS4 has now multi-arg :not
but its browser support is lacking 😬
 
8:11 AM
Now there's a curious bug w/ the sidebar scrolling
Chat automatically minimizes the "other rooms you're in", I'm guessing there's some funky height detection going on
 
 
1 hour later…
@ShrekOverflow that Felix' response is not correct
js has primitives
 
I still like the positive attempt
@KarelG I wish I had primitives
 
@MadaraUchiha but I have firefox 67 :c
@KarelG oooh is there CSS4 now? :o
 
@ShrekOverflow here, have a prime: 7
 
@Neoares So?
 
9:48 AM
your plugin is for firefox 1.0.0
:evil spanish laugh:
 
!!facepalm
 
That is rather disappointing.
 
10:01 AM
function* map(f, xs) {
    for (var x of xs) {
        yield f(x);
    }
}
I found this in my code from 2014
 
what is that doing
 
@Neoares It's a map function for generators
 
@MadaraUchiha which, AFAIR, still doesn't exist, or does it?
 
@BartekBanachewicz Nope.
 
10:03 AM
hi peeps
 
I had an idea to touch-up this repo and rewrite the UI to hooked react for shits and giggles
 
are javascript generators like python generators?
 
can someone help me with node.js
please
 
@Neoares Now that I think about it I can't remember ever using Python generators
at least consciously
 
!!welcome AbdulSadikYalcin
 
10:04 AM
@AbdulSadikYalcin 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.
 
anyway they're basically functions that return stuff piece-by-piece and are supported by the language
 
@BartekBanachewicz it's like an array but it's only accessible 1 time when you iterate over it
 
@Neoares yeah then
not sure which ES spec they landed in
 
actually to build a python generator you have to use also the yield instruction
 
just checked, ES6
 
10:05 AM
which, I didn't know it existed in JS
 
you're so 2014 then ;)
 
in python?
 
js
 
nah, in JS
 
ah
kind of xD
 
10:06 AM
first order of business for this repo will be setting up webpack/babel
it's my new shiniest toy
 
I'm doing GANs
to generate dog images xD
 
hm okay I have node 8.12
how ancient is that
 
how do I run a node app on a live environment?
 
> Node.js 8.12.0, Carbon, 2018-09-10,
 
@AbdulSadikYalcin what's a live environment
@Neoares passable
 
10:08 AM
you know, not a dead one
 
how do you run nodejs on a dead badger
 
@BartekBanachewicz ubuntu on an AWS instance
this is going to be noob question
node script.js
 
@AbdulSadikYalcin so like on any other ubuntu?
 
what is the URL
 
don't worry, we all were noobs
 
10:10 AM
what is what URL
 
mysite.com
 
ubuntu on AWS is still ubuntu
 
the URL to open the landing page, I guess
 
just a hint: if you can't set up a machine, maybe start with ready node deployments
 
var/www/mydir/index.html
var/www/mydir/script.js
 
10:10 AM
because if you can't launch it, you sure as heck can't secure it
 
@BartekBanachewicz I have older one :P
 
@Neoares yup
 
I don't think security is a problem here, it sounds like a toy project
 
PS C:\dev> node --version
v6.9.5
 
what is the domain to my index.html
it's not on the root
sub directory
 
10:11 AM
ew `C:\`
 
@AbdulSadikYalcin how are we supposed to know how you've set up your web server
 
aparently I forgot to format code
 
@Neoares must it be a D then? I rather prefer something else tho
@Neoares \\ escapes the characters
 
it depends on what it is
 
`C:\` oooh
/fail
 
10:12 AM
yeah it's weird
 
/c/ is unambiguous :P
 
aah back to my problem
 
@AbdulSadikYalcin if you're using AWS, use the endpoint that they give you
it's in the EC2 properties
 
@Neil 777777777
 
@ShrekOverflow is not a prime number
777 777 777 = dividable by 3
and obviously by 7 too
 
10:25 AM
@ShrekOverflow 777777777 divisible by 259259259
 
but I can say that the nearest 3 is a prime: 777777773 is a prime number I think
 
Ofcourse
it is also divisible by 7
and 11
probably
 
yup confirmed. that 777777773 is a prime
 
nvm not by 11
 
since when 777 777 777 is divisible by 11?
 
10:26 AM
not enough 7s
 
in shrek's math system
 
I overcounted the 7
 
definitely divisible by 111111111
 
TIL an even number of repeated digits is divisible by 11
I'm increasing my math skills
 
@Neoares (no joke)
11^2 = 121
111^2 = 12321
1111^2 = 1234321
oops corrected
 
10:31 AM
@Neoares s/skills/useless knowledge/
 
btw, mathematics SE has often interesting theories / answers that does not require high insight in maths
 
That is a debatable comment, isn't it?
 
@geisterfurz007 already removed
 
Ok :D
 
10:52 AM
sometimes mods are quicker than us, the peasants
 
I enjoy watching the math videos on youtube
sometimes very weird patterns emerge from seemingly no where
Word a watch if you're interested in that sort of thing
it also is a quite efficient random number generator as it turns out
 
that's how I became the ultimate math ninja
 
11:20 AM
!!> Array(10).fill(0).map((,i)=> +Array(i).fill(1).join('')).map(i => `${i}^2 = ${i ** 2})
 
@ShrekOverflow "SyntaxError: expected expression, got ','"
 
ugh lol
!!> Array(10).fill(0).map((_,i)=> +Array(i).fill(1).join('')).map(i => ${i}^2 = ${i ** 2}).join('\n')
 
@ShrekOverflow "0^2 = 0\n1^2 = 1\n11^2 = 121\n111^2 = 12321\n1111^2 = 1234321\n11111^2 = 123454321\n111111^2 = 12345654321\n1111111^2 = 1234567654321\n11111111^2 = 123456787654321\n111111111^2 = 12345678987654320"
 
Walks in shame
 
@ShrekOverflow the backticks isn't so obvious here
 
11:35 AM
HOW DO I MAKE IT PRINT NICE!!?
!!> Array(10).fill(0).map((_,i)=> +Array(i).fill(1).join('')).map(i => ` ${i}^2 = ${i ** 2}`).join('\n')
 
@ShrekOverflow " 0^2 = 0\n 1^2 = 1\n 11^2 = 121\n 111^2 = 12321\n 1111^2 = 1234321\n 11111^2 = 123454321\n 111111^2 = 12345654321\n 1111111^2 = 1234567654321\n 11111111^2 = 123456787654321\n 111111111^2 = 12345678987654320"
 
Nooooooooooo
meh ok I gives up
 
use br?
 
._Q you do it
 
eqeqwe <br> new line
pfft
 
11:38 AM
lel Newb
 
you have a lot mess in your code tho
 
That was on purpose
 
!!> Array.from({length: 9}, (_,k) => ++k).map(i => '1'.repeat(i)).map(v => ${v}^2 = ${(+v) ** 2})
 
@KarelG ["1^2 = 1","11^2 = 121","111^2 = 12321","1111^2 = 1234321","11111^2 = 123454321","111111^2 = 12345654321","1111111^2 = 1234567654321","11111111^2 = 123456787654321","111111111^2 = 12345678987654320"]
 
Could someone explain this:

const array = [1,2,3,4];
for(let i=0; i < array.length; i++) {
  setTimeout(function(){
    console.log('I am at index ' + i)
  }, 3000)
}

//output
I am at index 4
I am at index 4
I am at index 4
I am at index 4

const array = [1,2,3,4];
for(let i=0; i < array.length; i++) {
  setTimeout(function(){
    console.log('I am at index ' + i)
  }, 3000)
}

//output
I am at index 0
I am at index 1
I am at index 2
I am at index 3
I get why var will produce 4 four times. It's because setTimeout goes to API and waits there for 3 seconds , by the time it comes back the for loop has already executed 4 times and the value of i at that point is already 4. so it executes console.log four times with i=4
 
11:45 AM
@SamuraiJack I get the second output, never the first
 
there is no difference between the two, is there?
 
is that the same code twice?
 
@Neil my bad, let me correct it
can't edit it
the first code should have var instead of let
second code should have let
const array = [1,2,3,4];
for(var i=0; i < array.length; i++) {
  setTimeout(function(){
    console.log('I am at index ' + i)
  }, 3000)
}

//output
I am at index 4
I am at index 4
I am at index 4
I am at index 4

const array = [1,2,3,4];
for(let i=0; i < array.length; i++) {
  setTimeout(function(){
    console.log('I am at index ' + i)
  }, 3000)
}

//output
I am at index 0
I am at index 1
I am at index 2
I am at index 3
 
let is a lot tighter scoped and not global. I think that allows for a proper closure in setTimeout.
 
@SamuraiJack the loop using var basically creates 4 timeout events and i goes to 4
var doesn't go out of scope, so when the code is run, it uses i
let is better, but you could also accomplish the same by using a monad
 
11:51 AM
it's 2019 and JS scoping is still confusing people
 
so you basically pass a function which given the input, will when called give that as output
 
@Neil he said the m word everyone
 
@Neil I think i got why var works the way it does but i could not understand let here
 
is that a bannable offense?
 
(googling monad)
 
11:52 AM
@SamuraiJack don't
you've been warned
 
@BartekBanachewicz too late
Holy!
 
can't unsee
 
my eyes! my eyes!
 
@Neil when you say "a monad" this is vastly different to "the monad [abstraction]"
I don't know if it was intentional or not but sorta correct in this case
 
monoids and monads. mmhmm haskell
 
11:53 AM
♨_♨
 
the monad abstraction is just an interface
 
I guess I will just have to remember that that's how let works.
 
then you have "a" monads, so types implementing that interface
e.g. Option(al) might be used as a monad, and in a sense "is a" monad, just like a list "is a" Iterable/Foldable/Traversable/...
 
@Neil you said that var is creating 4 instances of setInterval
 
there's a lot of hate going around saying "IO Monad" for example, where people really just mean "IO", and not "IO as a Monad"
 
11:55 AM
@SamuraiJack 4 timeout events
 
what about let.. ?
yeah sorry *timeout
 
my main point being that it doesn't get executed right away
though even if you set time to 0, it would still not execute right away but only after the current code has finished
and since you incremented i to 4, you'll see it always at 4
 
@Neil i got that.. but doesnt same apply to let?
if i use let.. timeout will still execute after the current code has finised
finished *
 
@SamuraiJack let isn't around after loop ends
if you use it in an anonymous function, it uses its value at that moment
you have to imagine running the loop code 4 times, and defining all four times variable i, each with different values
whereas with var i, it remains in scope
var i in a loop = increment i.. let i in a loop, lets define variable i for each value from 0 to 3
does that make sense?
 
so there are four different i values stored somewhere in case of let
right?
0,1,2,3
as opposed to single var =4
 
12:06 PM
Basically yes. They are hammered in stone inside the anonymous function.
 
for let definition in a loop, in each iteration, a new instance of the let variable is created. For var declaration, its definition is hoisted so it is the same instance for each iteration.
 
@SamuraiJack yes you could think of it that way
as if you had four copies of the code inside the loops being run sequentially, with each block having its own definition of i
 
12:26 PM
Quick question
got some inputs with a focus css thing that also dispatches an action
however if u wanna switch to a different input u have to click 2x
once it leaves focus, then the other click selects it
how can i fix this?
 
unless you do something with the focus event, the other input should be focused with a single click
 
How do you detect which protocol something is following on top of HTTP
without any specific header
for eg. OAuth 2.0 / OIDC (esp painful because they are the same protocol ffs)
I thought of writing a tracker that is basically a list of requests, first check if the request is a response to any other tracked requests. If so, let that responder handle it remove the responder if everything is satisfied. If not check if the request is a starting request for one of the protocols and add it to the list of untracked.
 
are you writing your own protocol?
 
No a debugger instead
so far I can get it to work at POC stage, but I want it to be as modular as possible so each protocol can just be a plugin file
 
why would you take your age into account?
so if you realise it doesn't make sense to wait more years?
no, impossible since 5/20 < 6/21
 
12:39 PM
@Neoares because Kakarot it'll still grow
also 24.3 how old is this person? 9
 
don't wait more years. life is short
 
@ShrekOverflow or the item is very expired
 
can't be > their age
 
true
 
so 10/40 * 100 will be close to that
 
12:40 PM
then the age makes sense
 
now at 60 years
30/60 * 100
oh my 50! DAMN
I accept this formula
 
can you just write a function and brute-force it? xD
 
for ?
highest possible score?
 
I guess
just plot the results
 
no
its a straight line
actually no its not
s = curr - exp/age * 100
therer are 4 variables
 
12:42 PM
that's why you first plot it xD
 
THERE ARE 4 VARIABLES
 
no
 
h = (x-y)/z * 100
x - y < z
 
it's an optimization problem with a constraint
 
no
those are the 2 equations 😃
 
12:43 PM
or an optimization problem
with one constraint
at least if you want to minimize or maximize your score
 
simulated annealing boi
 
no its not the right plot
h is missing lol
I am not going to pretend, I have forgotten math to find out the actual result 😃
 
the result of what
 
of

`
h = (x-y)/z * 100
x - y < z`
Highest possible score
pretty sure it'll be a line per age (so a plane)
 
12:48 PM
well, with 2 equations but 4 variables you will have a tough time
 
yeah but you can come up with a plane
 
you can
 
@KarelG narrowed it down to having to do with a blur event
 
Where is @Oboecat when you need her
 
adjust x until you get highest value in range, then adjust y in the same manner
 
12:48 PM
thanks :)
 
then adjust z, etc.
repeat
 
looks neat
xDDD
 
that'll work if you don't have local peaks
 
@Oboecat is my math processor at this point
I am so dumb
 
12:51 PM
you can use stochastic gradient descend to find the solution :D
 
@Neil ah got it .. thanks
 
@Neoares you know I don't have a clue of what that means
and this is depressing me more
how have i become such a powerpoint douche
Resolution for 2020, re-learn math, starting from linear alzebra (if you don't get the alzebra ref: google it)
 
I used to be great at such problems
 
you also want to become the ultimate math ninja?
 
Once I realized that I could write a program to do it, then I've gotten lazy
 
12:56 PM
yeah that's the point of SGD and those optiimzation methods
 
getting an approximation to 99.9% is not as satisfying as mathematically determining the best answer
 
Actually just writing it down I solved the problem
 
yeah but sometimes it can't be done mathematically
for example, in optimization problems you can not solve it mathematically if you can't derivate the objective function
and you have to write gradient-based approaches
iterative approaches
this is why programming skills are so important :D
 
1:24 PM
why? doing backprop by hand is super fun
 
1:47 PM
hi , is there is a way to cancel all time setIntervals ?
like i want to cancel all setTimeout once the URL changes
window.location.href*
 
What have you tried?
 
    if(window.onhashchange === false){ // also if (window.onhashchange){}
    console.log('mama');
    }
 
@JRick That's logging 'mama' to the console, not trying to clear all intervals.
2
 
for all i know i will need to constantly check for the URL change then i can go ahead and use clearInterval(interval_var_here); @MadaraUchiha
 
smells like XY
to the power of 10
 
1:56 PM
huh?
 
1517
Q: What is the XY problem?

GnomeWhat is the XY problem? When asking questions, how do I recognize when I'm falling into it? How do I avoid it? Return to FAQ index

 
@MadaraUchiha he he he
 
so I have ended up with something awful :D
 
please tell me it's about the expiration date thing
 
@JRick you can cancel all setTimeout/setInterval things you create, by clearTimeout/clearInterval
 
2:00 PM
by the way @ShrekOverflow the best score is to buy something at the exact same moment you were born and check for the expiration date whenever you want
 
@BartekBanachewicz do i have to add variable between brackets for each variable ?
 
I have no idea what you've just asked me about
 
I think he's talking about an array?
 
This is the point where you stop, drop and roll. Erm, I mean, where you go back and learn how to code or somethinhg
How are people expecting to write code without knowing how to write code
do you like just type random stuff in and see what happens like every time
without ever pausing and thinking "what did I just write" or "what do I need to write" or even "what even am I trying to accomplish here"
so then the code you write just becomes its syntactical representation and you don't understand the semantics at all
you just know you need the "brackets" and "variables" but have no idea what they're for
kinda like a musician that only learns with muscle memory (khem khem me on the piano) and has little to no idea as to what they're playing
I mean it's sorta great if you treat code as art and then whatever comes out is like some result and you hang it on a wall or something I guess
but if you're actually trying to achieve some definite goal, then maybe, just mabe, a bit of planning ahead could work
 
:o
 
2:14 PM
> Weeks of coding can save you hours of planning.
 
the problem is @BartekBanachewicz

the function that checks on the URL is being activated in the very beganing
and calls for another function which includes the Setinterval function :
 
this is amazing, I missed this so much
 
missed what? :)
 
this kind of questions in the chat
 
2:32 PM
const isProtocol = SomeProtocolImpl.test(trace);

if (SomeProtocolImpl.isCallback(trace)) {
    if (SomeProtocolImp.listOfActiveRequests.some((x => x.match(trace)))) {
       return;
    }
}


const request = SomeProtocolHelper.parse(entry);

SomeProtocolImpl.listOfActiveRequests.push(request)
Is that ugly? I smell code stink here
 
@BartekBanachewicz lol , ok i didn't noticed your previous reply until now , and lol no don't worry .. i just have a very complicated system that I've built it from the ground up , i'm sorry if i come off as if i don't know what am i doing

but what i meant the only why i can find on stopping the interval is by calling it inside the brackets which is not as easy because i have multiple time interval across my code , i need to make sure that none of them is working and i have to basically restart them whenever the URL changes ... so you can see that some of them can easily be slipped off
so i'm not really stopping basically iam just restarting them
i was wondering if it's possible to just close all of them in one code without going through them one by one
that is it
 
@JRick nope
so I have a question of my own
I've moved my BEng project to webpack
and I'm getting an issue from a library about an undefined function
thing is, it works perfectly fine when called from console stopped in debugger in the place where it happens
the code is being ran in the jQuery $() callback
 
2:47 PM
@BartekBanachewicz arrgg .... but thanks for telling me <3
 
Hello, does anyone have any solid knowledge of React hooks? I'm trying to use the same constant from a custom hook which is passed to two different components using router (v4) but the state is resetting when the parent re-renders due to the URL/prop change. Does anyone know why this is happening? It's a two part form and I need the same data to be available on both routes.
 
oh there we go
import {x} and not import x. Sigh.
 
Guys, have you ever come across a situation in React, where one state of a component is dependent on second state of same component?
 
@RahulJain smells like bad design
 
For e.g. there is this form component, for each text field, I am setting a state. And I am keeping a state "formDisabled" which is true if any of those textfields is empty
@BartekBanachewicz Whats good practice for this?
 
2:55 PM
TIL the cosine distance the same as the euclidean distance then the space is normalized ._.
I thought my code was broken, and it turns out it was a mathematical property
when*
 
@MadaraUchiha I wonder if Madara will make a comeback in Boruto because ofcourse some re-animation jutsu or whatever fan-service
 
01:00 - 15:0015:00 - 23:00

« first day (3201 days earlier)      last day (1753 days later) »