« first day (2846 days earlier)      last day (2327 days later) » 

14:11
I want to construct a class where the constructor return will always be 1 promise, regardless of if the developer returns a plain object, or a promise with a fetch inside
Imagine class A { constructor(foo) { return { a: foo } } }
And class B { connstructor(foo) { return fetch(foo) } }
but in a way that both return a promise, rather than just class B
I suppose I could make a class AlwaysPromise and have the constructor check the parameter passed in and if it's a promise return it, and if it's not return it wrapped in a promise, but is this the best way?
so you just want to wrap { a: foo } in a promise?
automagically?
kind of. But if they specify something that is already a promise I don't want to wrap it
fyi, if I would use a class, I do not expect it returning a promise
Unless promise resolution cascades, in which case I guess I could
but you can check if an object is a promise or not
if not, wrap as Promise.resolve(obj)
14:16
@KarelG yeah this is just because I'm following ngrx's redux implementation
But I'm not using effects is the main difference
So instead I'm having the actions perform the side-effects before passing the payload to the dispatch function to be distributed to the reducer.
dispatch(event) {
            event.then(action => {
                this._state = this._reducer(this.state, action);
                this._subscribers.forEach(sub => sub(this.state));
            });
}
That's basically the dispatch code, the event is actually the action..
if it isn't returning a class instance.. ever
why is it a class?
it always returns a promise. it's an async function.
Basically to keep more consistency with NgRx
but how is that useful to have a class constructor that doesn't ever return an instance of that class?
unless I'm missing a key point here
it doesn't make sense
I agree. Let's say these aren't classes anymore, they are functions
then that's easy
14:26
How so? I don't want the dev to have to write return Promise.resolve(<whatever>)
make the function async
Async functions become promises?
all returns from an async function are promises
That's super dope
async function foo(a) {
	return a;
}

foo(Promise.resolve(1)).then(v => console.log(v)); // 1
foo(2).then(v => console.log(v)); // 2
seems to be what you want
14:28
That's exactly what I want. I didn't know. Thanks man
What kind of diagram is this called usually? i.redd.it/li02cubsgo0z.png
So is await functionally equivalent to .then?
(that's probably a really poorly worded question)
@ndugger UML?
@Vap0r async/await abstracts promises.
they are promises, just cleaner.
Seems like it. Thanks, bruv
@rlemon nice! looks like support is basically similar too
so basically:
dispatch(actionable) {
    actionable.then(action => {
        this._state = this._reducer(this.state, action);
        this._subscribers.forEach(sub => sub(this.state));
    });
}
I would get rid of the .then
say const action = await actionable;
14:33
decorate the function as well
async dispatch(actionable) {...
^ yeah! what he said lol
yes
await can only exist in an async function
Ok that's super cool and makes my code look so much better
rlemon, I have a doubt that ndugger's image is UML
seems more a code flow diagram
I didn't read the cards
I just saw them and thought UML
yea, looks UML to me
a code flow is data/information flow
it fits
14:53
> I didn't read the cards
psychic -= 1
UML is a language standard itself
it consists of a lot diagrams. I do not use half of those lol
15:13
hi
oh hi
hi
🚽
15:40
I need help identifying holes
The ones on the right say data but I have never seen em,
this is going to take a while
@ShrekOverflow Speaking of those holes:
@ShrekOverflow ok I can help
there are two holes on the receptacle on the left.
yw
@towc Its from Star Trek
Tar Shrek
15:48
@jake but the question is ... can I put an ethernet port in it?
@towc this is the first funny joke I've seen from you :D
well done
Shrek is a Firangi
@rlemon what's funny about it ?
he pointed out the holes
it's punny
@ShrekOverflow In the empty holes? probably
15:49
oh wow.
on a serious note I have never seen the Data port on this wall
and the wifi here sucks because the walls are merciless even on 2.4 Ghz
5G or bust
@ShrekOverflow you can run ethernet through your power outlets
@rlemon 5G doesn't make it through the walls (5 of them)
15:52
@jake I know, I am wondering if I can use the ethernet port or do I need to run a wire.
and powerline adapters are crap for speed
@ShrekOverflow how do you know? hope into the second frequency range
@rlemon tested it
I'd run a wire if its your house
its rented
it gives ~2 megs on 2.4 GHz and 0.4 on 5Ghz (and it disconnects almost all the time)
@rlemon that's almost a compliment, great
15:54
my plan is to use these ports (if they can indeed carry data) to carry data on ethernet and have another wifi station
I grew up with shit internet, I know the pain.
so take it to the second range and rock 86Ghz
show those walls who is boss
86Ghz won't penetrate walls at all
(iirc)
the higher the frequency the less it penetrates
so ... the walls are the boss
ohh you're right. I had that backwards
then go into the first range and use .4Ghz
I want internet not 480p TV
The lower the frequency the less data you can carry
15:56
and no connection mean no data
which is worse?
Which is why I am asking wtf is this port
if I can use it, problem === solved
which one
The two on the right
Is this a house or an apartment
@Cereal Apartment*
15:57
right-right or right-left?
in my apartment the the ethernet inputs are right beside the router
So I have ethernet outs in the office and living room
These mark "Data" so I am hopeful but I have never seen this kind
I'd have guessed phone and ethernet, but I assume someone else guessed that too
but I don't see any other messages containing "phone" so
I mean plug something into it and see if it spits out internet
that's what I did. Carried my laptop around the apartment plugging into strange ports
@ShrekOverflow If I had to guess, some sort of fiber optic connection port.
But that is not from an expert opinion or anything, but the terse glance of a man eating the fattest tuna sandwich he could make
But it does look quasi-similar to the one in my living room.
16:01
it looks too short to be rj45
but maybe it is
16:17
I have no idea what it is it’s not an RJ 45 it’s too tiny for that
Probably some older port, I’ll goto Best Buy and check I guess
Why can you create and instance with an array but not an object?
user1596138
@ShrekOverflow in America?
user1596138
Just looks like your average cat 3 in the pic
user1596138
Like a phone line... DSL "data"
user1596138
Oh no they're wide af. Idk.
user1596138
16:31
I really like the -lack of- ports on the left
user1596138
I assume there's another wall with a port directly behind them. Since you have an empty cover already... Why not just pop it off and slide a Cat6 through to the other side
user1596138
That's what I did but I rent the house it's not an apartment
user1596138
Also who has 5 walls to penetrate in an apartment? Weirdest floor plan ever
16:59
in Angular 2, is it possible to inject parameters that are known at runtime to service constructor? something like: constructor(private something: string) {}
@LadyBird no idea, what they were thinking but definitely not 5GHz internet.
user1596138
Yea I have to use the 2.4 outside a few rooms
17:14
So I have a faulty page of nested tables
the best solution i have come up with is to open them in chrome and get the innerHTML and the save that as a new file
if it displays correctly the html will work in other browsers
any better ideas
using an html validator tells me what is wrong but not how to fix it
user1596138
wat
user1596138
> tells me what is wrong but not how to fix it
user1596138
What's wrong
I'm assuming you aren't talking to me ladybird
user1596138
If a validator can tell what's wrong it should be fixable.
user1596138
17:17
@William I even quoted you :P
sigh it is nested tables
hello all. i am using a promise to determine a value that is returned via php as boolval($d) where it could be 0 or 1. when it is returned as 1 i get no problem via normal XMLHttpRequest, but when it is 0 it throws an error in the console log of 404 failed to load resource - any ideas? when i go into the php and remove boolval() to simply return the 0 or the 1 the XMLHttpRequest works fine
my solutino is way faster and does the same
I guess I was looking for a library
user1596138
You will not find a library that fixes your broken HTML
well chrome does so I should make one
user1596138
17:18
But yea if you let Chrome decide how to render it and it was correct, guess that works
user1596138
Chrome does it's best to put something on the page
user1596138
You can leave off closing tags, put extra closing tags or just generally use completely broken HTML and Chrome will make a best guess at how to render something
sorry I read the quote and well assumed you would quote the whole line
user1596138
My point was just that who has any clue what you'll get from Chrome from malformed HTML. This time it might work, next time it might not
17:21
morn
user1596138
I bet if you show us the HTML we can help you understand how to fix it
user1596138
Then you'll have the knowledge to not need a framework since you can write proper HTML :P
it is 3 nested tables
tr, td everywhere
user1596138
!!s/deep//
@LadyBird it is 3 nested tables (source)
17:22
does a XMLHttpRequest fail if value returned is false?
hah bamboozled again
user1596138
@William I was sure it was full of tr and td when you said "table" yeah :P
yeah no classes though
no ids
just trs, and tds
user1596138
Makes it simpler
user1596138
You said you have malformed HTML
17:23
open it in an IDE @William
user1596138
So why would classes and such matter
@forresthopkinsa like?
apparently it does fail if the response is false. any ideas how to handle that so it doesnt throw a 404 error on the response reply?
I did also gets confused
17:24
it'll find the problems and suggest solutions
user1596138
You're making this as difficult as you can. But in reality, you have malformed HTML and validators are telling you what's wrong with it. Just fix it dude...
webstorm I'l try it
user1596138
I'll fix it if you post it (in a reasonable way)
I'm not wasting your time when its already fixe
if you don't have a Jetbrains license, it might be difficult to get
user1596138
17:25
You're wasting my time right now by asking for a fix and refusing to show info lmao
user1596138
You feel wrong about something and are hiding it.
user1596138
Glad Chrome was able to fix it for you tho :)
it has client info in it. I can't just post the whole page
Lady Bird and forresthopkins
user1596138
Right, because I want you to post a whole webpage
user1596138
17:26
Ah the absurdity...
HI Lady Bird and forresthopkins
Joined now
user1596138
Hey dude, I got meetings so I gotta run
user1596138
!!afk planning
what's up @AppleOrange
what time is it on the other side of the world
@AppleOrange my username was lime many moons ago
then became liam then william
even had a lime avatar
17:27
mmm
lol
forresthopkins: what time there?
10:30a in Arizona
here 10.55pm
how is that possible
How is going today?
don't timezones just alter the hour, not minutes
one of you can't read time
17:30
newfoundland is off by 30 minutes
There's a couple of other places
So is India
no kidding?
Maybe research before making statements, gawd
I had no idea
NO
@SterlingArcher you're on a roll today
17:31
Dude it's bad
I'm 3/3
impressive
do NOT tell michael
@Cereal they wanted to be different
Newfoundlanders are different without trying
17:46
Hey Minor
user7437719
hi
@oboecat say what ?
Oh yeah our visionary leaders foresaw our issues with time management, so they chose a timezone 30 minutes off so that we can complain about being late 30 minutes for meetings.
user7437719
if you are seeing starred messages from 2013, you know this room is kind of dead...
user7437719
https://chat.stackoverflow.com/transcript/message/43354874#43354874
also, whats all this about?
@TomMinor are you freaking kidding me?
17:49
hahahahahahah
You were just suspended for a week and you think the best thing to do is come back after and just jump right back into it?
user7437719
what do you mean?
user7437719
im on good chat behavior.
then drop the drama from weeks ago and move on
we have
No you're not. We voted you out of the room -- please come back in no less than 1 month, ready to contribute meaningful conversation to this room.
As of this moment, you will be kicked on sight.
17:51
damn son
Guys..Anyone know Angular4?
@AppleOrange Isn't Angular already at 6 ?
I don't know Angular <12
ok..Angular6?
!!welcome everyone
17:53
@everyone 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.
^ applies here
don't need to ask who knows what
I haven't used angular since 1.4
I haven't been abused by Angular since 1.4
@forresthopkinsa sterling no play, sterling scary
Lady Bird : when will you return?
meeting over ?
sterling protec, sterling attac
18:03
!!undo
she lags sometimes and doubles messages
@rlemon btw, last !!backup was in may
backups are so we don't lose commands
I haven't seen any useful commands learned in a while
and new people to the chat, right?
or is that stored somewhere else?
sure, but that's less of an issue
they might see the welcome message again. nbd
meh, sure
(and bans)
of which only 1 has been made in this room since the last backup, apparently
omg I might name a daughter "esquelle", with french pronunciation
18:08
hopefully your own daughter
elaborate
@Cereal your daughter's name has now been claimed
jokes on you, I'm not having children
that's only if I have 2 daughters or more. I'd like the first one to be called Arkady
I, too, want my children to be bullied
18:10
my chances of ending up as a cat collector are rising by the second though, so maybe that will be a cat's name
joke's on you, you're not having children
@Cereal great, let's make a club
I can vouch for collecting cats
If it wasn't for the fact they shed like they don't like fur, and poop inside the house
I'd have more
there's a really cool invention that helps with that
I'm currently living with a cat collector
18:12
it's called a uhhhhh litter box
it's fun
cleaning up is more tedious, but hey
I'm not the one who does most of it
can you use the es6 swap sintax inside a for loop
let array = [0, 1,0,1,1,1];
for (let i = 0; i < array.length; i++){

    if (array[i] === 0) {
        let k = i + 1;
[array[i],array[k]]=[array[k], array[i]]

}


}
what do you think?
@forresthopkinsa Such apain in the ass to clean
Both my cats eat this food for their bladder health
18:19
So they pee so fucking much
wow that's exciting
swap syntax?
I believe that's destructuring
@SterlingArcher objective is the same
@Rick should be fine
Well. With vars. Idk about array indicies
But I don't see why not
@rlemon it works outside the loop but not inside. So it will works with arrays without vars
18:26
const a = [1,2];
[a[0],a[1]] = [3,4];
a;
(2) [3, 4]
nah, works fine
I think it's how I am doing it with array[i+1]. because the evalution works from right to left or something like that
so you wanna loop an array and swap all 0's with their next value?
well, I know how to do it. but I was wondering if it could be done with less work using the destructuring syntax
I would normally just use a variable to hold the zero while I swap the values. But I figured this might make things cleaner.
Unfortunately, I just get heap out of memory with this approach
@rlemon huh, I actually expected it not to
one sec, I know the problem. just looking for a elegant solution
const arr = [0, 1, 1, 1, 0, 1]; // 1,0,1,1,1,0

for (let i = 0, l = 1; i < arr.length; i += l) {
  if (arr[i] == 0) {
    l = 2;
    [arr[i], arr[i + 1]] = [arr[i + 1], arr[i]];
  } else {
    l = 1;
  }
}

console.log(arr); // [1,0,1,1,1,0]
basically you need to step over the next value when you swap
can't think of a more elegant way than that
unless you can walk over an interation from an array iterator.
18:37
are you just swapping pairs?
@Rick does that make sense to you?
@rlemon ya it looks good. will it with more than just pairs?
there are two pairs in my example
ohh, more than just pairs.
yea
just walk over all the swaps
No that makes sense! @rlemon thanks!
o/
cool. enjoy
posted on August 01, 2018 by Michaël Zasso

Notable Changes deps: Upgrade npm to 6.2.0. #21592 npm has moved. This release updates various URLs to point to the right places for bugs, support, and PRs. Fix the regular expression matching in xcode_emulation in node-gyp to also handle version numbers with multiple-digit major versions which would otherwise break under use of XCode 10. The npm tree has been significantly flattened. Tarball

 
2 hours later…
20:51
I'd love a JS extension with a ton of new syntax features. Like a sweetjs bundle
with sugar for Object.assign, plucking, proxying, piping...
where libraries can add their own operators, so I'd get super nice syntax for http handling, knex
I think the thing I'm looking for is lisp
but I want it as free and non-sensical as JS
natural languages aren't successful semi-concise communication protocols because they're beautifully structured, but because the variability of those structures and the uniqueness of certain words allow for great golfing, when used correctly
a lot of the power is in the compiler, rather than the code itself
so let's have a language with an easily jit pluggable compiler
which is kind of like lisp macros, but it's still too structured
@KendallFrey maybe this can be a nice side project of ours?
Is it possible to make an object appear as though it were a string in the console

« first day (2846 days earlier)      last day (2327 days later) »