« first day (2762 days earlier)      last day (2409 days later) » 

14:00
@rlemon, i understand how the async <=> promise transpilation works - but i'm confused on the "pausing" part
await foo();
// same here
@johnmarinelli Are you familiar with generators?
@MadaraUchiha, ah, so the key is generators
@MadaraUchiha only superficially, not the implementation
@johnmarinelli well yes, and that's why I said think about it with a .then
the body of the .then call doesn't get run until the promise function resolves
function* infinite() {
  let i = 0;
  while (true) {
    yield i++;
  }
}
14:00
await does the same thing, but in the async function
user9674579
// I have a function to count length of arrays and strings
// but, it's unable to count empty values
// this code starts from Sizeof function skip Lastof function right now

// Lastof function :- read Sizeof before reading this
Lastof = function Lastof ( LastOf, Last ) {
	// change LastOf to "" if null, undefined
	LastOf = ( LastOf == null ) ? "" : LastOf ;
	// Last variable, if undefined/null change to 0
	Last = ( Last || 0 ) ;
	// buffer limit max loops
	Buffer = 1000 ;
	// isLast variable to check if "index" is last or not
A generator runs until the first yield, and then it pauses
It pauses until .next() is called on the iterator it creates, at which point the generator continues to run until the next time it hits yield
@MasterDarkNight what about sparse arrays
@MadaraUchiha really! that's interesting. the forever loop threw me off
user9674579
@rlemon I don't know about sparse arrays ? what are those ?
14:02
@johnmarinelli You can consume this generator like so:
@MasterDarkNight arrays with no values, but .length set
or rather, arrays with gaps
const a = [];
a[4] = 123;
a[22] = 456;
a.length; // 32
@rlemon i see. so await is analogous to .then
@MasterDarkNight you could simply create a count variable starting at 0, then check if the input is an array or string rather than check what it is NOT, and if a string convert it into an array, then loop the array and if the value inside that array is allowed in your count system, add 1 to the count. finally, return count. i think your function is over complicated.
@johnmarinelli yes
const iterator = infinite();
console.log(iterator.next()); // {value: 0, done: false}
console.log(iterator.next()); // {value: 1, done: false}
console.log(iterator.next()); // {value: 2, done: false}
Or, you can use the language support with for..of like so
for (const i of infinite()) {
  if (i > 10) { break; }
  console.log(i); // logs 1 through 10
}
Because it's an infinite iterator, you must specify your breaking condition in the consuming for..of loop, else you really get an infinite loop
14:04
@MadaraUchiha got it. i'm still confused about the "pausing" part though. does it mean that some callback doesn't get called until .next() is invoked?
@johnmarinelli No, it means that the function just suspends execution
user9674579
@George every value is allowed in my count system, but I'm not able to count empty values in an array
The first time .next() is called, the generator runs until it hits the first yield
The result of next() then becomes the value of whatever was yielded, in this case i++
It then pauses.
you can just do count ++ inside the loop without a condition then.
got it
and yeah, what is the while (true) there for then?
14:05
Next time .next() is called, it continues from the exact same spot
i thought that would be for network requests
OHHH
i see
user9674579
@George but I'll have to stop the infinite loop ?
so if the while (true) were not there, i would always be 0
Then it hits yield again, again with i++, but the value of i changed since the last iteration
I've never found a valid reason for an infinite loop in JS
14:06
So now you get 1
while true inside generator function just means it will always yield each time you call .next
@johnmarinelli If you didn't have the while (true)
The second next() and everything after that would have returned {value: undefined, done: true}
while true looks like madness anywhere else
Because the iterator reached the end and returned.
Here's a simpler version without a loop
user9674579
14:07
@MadaraUchiha ???
master why does it loop infinitely
function* magic() {
  yield 1;
  yield "hello";
  yield true;
}

for (const value of magic()) {
  console.log(value); // 1, 'hello', true
}
@MadaraUchiha ah, that makes things clearer
user9674579
@George You said me to remove the condition, then it'll be infinte
Now, a feature of JS generators (as opposed to generators in C# for example) is that you can push values back into the generator by passing an argument to next()
14:08
@George since the example with the loop is returning a sequence, it uses a loop
the condition INSIDE the loop
user9674579
// I have a function to count length of arrays and strings
// but, it's unable to count empty values
// this code starts from Sizeof function skip Lastof function right now

// Lastof function :- read Sizeof before reading this
Lastof = function Lastof ( LastOf, Last ) {
	// change LastOf to "" if null, undefined
	LastOf = ( LastOf == null ) ? "" : LastOf ;
	// Last variable, if undefined/null change to 0
	Last = ( Last || 0 ) ;
	// buffer limit max loops
	Buffer = 1000 ;
	// isLast variable to check if "index" is last or not
im not talking about your code
user9674579
which condition ?
read my english pseudo code at 15:02
14:10
function* realMagic() {
  const value = yield;
  console.log(value);
}

var iterator = realMagic();
iterator.next('hello');
// hello is logged
user9674579
@George Okay
@johnmarinelli with me so far?
you dont need a condition if you accept every value inside an array towards the count
Still never used generators
@George whoops, thought you were talking to @MadaraUchiha my bad
@MadaraUchiha yep :)
14:11
await is like yield, in that you yield a Promise, and when it returns, the value of the await expression is the value of the promise
That's how the pausing mechanic works
generators + streams is cool in theory, but I've never solved a problem with generators; I tend towards promises + async/await instead
@MasterDarkNight can you please put this on gist.github.com and stop reposting it
then you can just refer people to the updated gist
user9674579
@George I have condition because I need to stop the loop if it's the last character, but it considers the empty values as last character and exits, hence , I'm unable to count empty values in an array if those are at last
no problem im in 2 conversations concurrently so i can see how that happened.
much less intrusive to the page
user9674579
14:11
@rlemon okay, I'll not post it again
@ndugger That's because both generators and streams are low level primitives that aren't too useful on their own except in a few cases which are then generally used in examples.
@MadaraUchiha plz enable gist.guthib.com
make it something funny
@MadaraUchiha it'll take me a few minutes to digest that, but it makes sense
not that, funnier
@towc Not mine
14:12
Madara doesn't own it
but
@MasterDarkNight it's fine to post code you're talking about. but if it is longer code snippets something that you can link too is much easier to maintain.
user9674579
@towc Why funny ?
gut gid
im saying start from scratch
i wont repeat my english pseudocode though
14:13
My code doesn't work. Do I give up on life?
yes.
My life doesn't work
give up on code
good idea
we need pics of your dog btw
like, now
14:13
@towc Turns out that there's actually something on gust.guthib.com
dahell
@MadaraUchiha risky click of the day
@MadaraUchiha it's a wildcard towc.guthib.com
@MadaraUchiha when you say "the value of the promise", you mean the fulfilled value right?
or do you mean the promise object itself?
@johnmarinelli Correct
14:14
got it
i see what you mean actually because you dont want to use .length even inside a Array.forEach loop
No, one of the features of await is that it unwraps the Promise for you.
The expression returns the fulfilled value, and if you get a rejection, it throws
oh boy. It's time I left the office, but on the way to the exit, management is having a meeting
the office is pretty much just a corridor
14:15
since .forEach uses .length internally
await ( foo().then( a =>  b(a) ) );
is perfectly fine
if not a bit ugly.
a room for management at the entrance, another room for less management, then the bigger room for us devs at the end
@towc Make them a funny face while you're on your way out
@rlemon Eh, arguable.
I mean fine in the sense that it works
I think on friday I did actually leave while they were having a meeting
14:16
@rlemon It's fine in the same sense as nesting .then()s is
It works, but it ain't pretty. (And is arguably an antipattern)
I didn't realize they were having a meeting, the doors were closed
which I said
i suppose you could make a condition to break the loop which would be whether arr[iteration] throws an error?
I am using it as an example to show that await expression will take the promise object, from any point
By the way, my new interview question for people who say they know ES2015 is on the confusion between named exports and destructuring.
14:18
how do you mean?
@rlemon 👍
@BenjaminGruenbaum Named exports and destructuring are on two opposing ends of the spectrum
Did you mean named imports?
@towc import { f } from 'foo'; isn't destructuring
and doesn't follow the same rules, which can bite you in the ass
Whats destructuring?
@MadaraUchiha I know that you know that - but most people don't know that, now do they?
@BenCraig const {foo, bar} = objectWithFooAndBar;
14:19
@BenCraig lookin into an object/array and pulling out properties or indexes
huh, I figured it did something different internally, but what rules are different? You can still rename last time I checked. Let me try it
@towc But differently, and you can't nest.
oh, I guess you can't look further down into the objects
yeah
Zirak has a talk that outlines it
linky link plz
14:20
@MadaraUchiha but they look the same!
const {foo: {bar}} = objectWithBarWithinFoo; // works

import {foo: {bar}} from 'something'; // does not
I don't have the link. he probably does
@Zirak
@Zirak
Also, renaming is done with : in destructuring, and with as in imports
@MadaraUchiha huh, I would not have been able to answer that question
14:21
and * is replaced with rest, but I don't think it will handle all the same cases
but I think you could reasonably work around that
@rlemon Not exactly
You can't say "take, foo, bar, and the rest as baz"
It has to be (take foo, bar), (take everything as baz)
> but I don't think it will handle all the same cases
but I think you could reasonably work around that
i dont understand the advantages of import over require()
@George static code analysis
also, it's prettier in some cases
require isn't guaranteed to have a static path passed to it, as the argument
ok what is that about, dead code elim?
14:23
which can confuse IDEs, and also not allow the runtime to make as many assumptions
@George Static analysis enables tree shaking
Which is a poorer version of real dead code elimination
Did you guys had to work on complying with the GDPR for fully free websites ? I'll have work to do for Miaou, probably even have to have a "legal" page...
is there some sort of website that lets you see a house from an uploaded blueprint? preferably free?
obviously you'd need to specify the textures, but the walls and such
@Neil any cad service?
sketch3d (I think it's called) is free online
I was sort of hoping I didn't have to design it in one wall at a time
14:25
@DenysSéguret basically you need to implement unchecked checkboxes and clearly label what data you would be storing, right?
we used it to manage the hackerspace furniture and similar
@towc i'll look into it
@George no, there's much more than that
ok, and also to allow user to download their data within 30 days on request
user9674579
[codepen for my JS](https://codepen.io/dwij-bavisi/pen/LmQOdZ?editors=1010#0)
please take a look at it :(
14:26
and to delete it
@DenysSéguret I think it's much simpler doing something along the lines of "We can't serve users from Europe, click here to proceed, agreeing that you are not from Europe"
what else?
@MadaraUchiha This would be dishonest
@MadaraUchiha that wont work
@DenysSéguret Eh, the law is dumb, and you wouldn't be the only one who does that.
@George How so?
14:28
it is not possible to waive their rights if they are in the EU
@MadaraUchiha YOU BETRAYED THE LAW
Right now I think I need
- a "legal" page linked from my home page
- a mention on how to contact me
- a description of the procedure to get all Miaou messages you posted
- a description of the procedure to have your account anonymized
just by trying to loophole it through words like that
probably other things, but I don't know what yet
@DenysSéguret Ah right, you're from Europe
14:29
silly Europeans
are you over 18 ? [ ● ]
In fact the law seems good. But it might be painful for non commercial organizations...
@AndrasDeak 1v1 me irl
the law is meant to protect the user, so it can easily be a PITA for servers
I guess it's meant to be a PITA
I'm not here to argue you, but your edit didn't post a second post, and none of your posts start with a capital letter.
I call shenanigans on the mobile claim.
Yea i disabled auto capitalize. X
I have automatic capital letters disabled on my mobile
I, too, like making my life more difficult
exactly what a desktop user would say
14:38
:runs:
I'm on desktop btw
I want a chat app
SO mobile chat is not all that bad
@MasterDarkNight 404
can i get chrome extensions on android?
couldnt figure it out
adblock for youtube
where is computer science on that graph :(
user1596138
@AndrasDeak Are you in the beta
mobile chat is decent, still major rooms for improvement
and a few bugs
14:46
Discords mobile chat is on a whole nother level though
user1596138
Btw, Kendall and Towc helped me figure out this maths yesterday and I think it's super cool codesandbox.io/s/zryy6rpxjx You can change the pattern at the top of Grower.js
Holy shit, I wrote 50 lines of code and it just.. worked.
yea discord mobile is great.
but discord itself has a few things missing
That this chat has?
nahh
14:47
CV6IA-6K5CT-0VZ5G kerbal space program steam key
well, it does after I added it :D
just gonna have to mod discord
Only thing I like about this one over discord are the stars and it's also easier to @ people here for some reason
well, there is one thing this chat has discord doesn't
replies.
ah yeah replies are nice
BTWHH-XP49N-N5PI0 moon hunters steam key
14:49
flagged, so no one else gets it :)
discord always does @ in alphabetical order. SO prioritises the most recently active user
Ah yeah that's why it's annoying af on Discord
if it pisses me off enough, I'll fix it
but it'll have to really annoy me
@Cereal thanks for moon hunters bruh
I hunt moons all the time
14:50
@Loktar It's okay. Played through it a couple times
That actually looks like a decent game
@BartekBanachewicz hey man what's up?
@Cereal Thanks, been wanting to try this
don't give up if you don't get to space right away.
@Jhawins I have no idea, possible
14:53
but you people make everything in space seem so easy
I have "about the new mobile chat" in the sidebar, so probably yeah
it is once you are in space. once you are in orbit you are half way to anywhere
@Luggage I sure did
Couldn't get any research points or w/e
So gave up
there is enough research just around the lauinch site to get you started, but the very early game research for basic parts is kinda dumb
i suggest just using custom difficulty and giving yourself a couple hundred to start if you find that part boring
then you can at least do basic competent rockets
@DenysSéguret also, regarding gdpr, if you have already obtained users data such as name, age, address without an obvious opt in checkbox, you will need to ask them to opt in next time they visit, otherwise delete their data.
14:57
yes
some people disable research and use money only
(but that's not a problem for me)
@Luggage o/
ok :)

« first day (2762 days earlier)      last day (2409 days later) »