« first day (3866 days earlier)      last day (1065 days later) » 

12:17 AM
Can we somehow train James to detect bad stars and sends a message about star spam?
Train it on all previous stars and messages that weren't stared
 
 
2 hours later…
2:45 AM
@JBis Yeah I guess if it doesn't break apart in a very short period of time. I hear that though. Apple does their thing, im just grifting
I realized I had to sign up for a developer account
ohhh $199 per year. Alright. Guess my app wont have apple sign in for a while.
guess its just Google sign in for now. Thats for free ¯_(ツ)_/¯
Damn I was considering becoming an iOS developer too. I'm not rich enough for that. AWS bill plus dreamhost bill now Apple wants $199 so I can... develop on their platform?
My bad for grifting on here lol. I'm just impressed and deeply bothered with Apple at the same time
 
 
3 hours later…
6:20 AM
is there some neat way to set a class on a component, but only if a value is true? What I'm doing now is for example: <Foo className={foo ${bar ? "yes" : ""} />. However this leaves me with a className "foo " when bar is false. no big deal, but a but ugly.
 
 
2 hours later…
8:07 AM
I urgently need a help. Here is my question : stackoverflow.com/questions/67561809/…
 
8:40 AM
@Markus handle it in the controller (assume that you're using React)
or use an utility function. TMK there is one for class names and integrates seamlessly with React.js
 
 
@Ooker 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.
 
Does anyone know what is this?
 
@Ooker JSON, more specific that is what firefox shows when the response content type is json (application/json), press the Raw Data tab and you get the real content
 
 
2 hours later…
10:55 AM
Hey guys
I have a quick question about integration testing a express rest api using jest and supertest
I have user model which written using mongoose and this user model's schema has custom methods for example, userSchema.methods.leftDiskSpace() to check user's left disk space on uploads folder.
In one of my route handlers, I call this userDocument.leftDiskSpace() method but I dont know how can I mock this method in jest
 
11:09 AM
@KarelG Ok thanks.
 
@makadev do you know why it doesn't show the real content at the first place? I need to clear the cache to access the site
 
I'm developing a component (a button), that can be held down for a couple of seconds. So far no problems, but this is for iOS (iPad), and when I press the control the text is selected. So i read up some, and found the css property -webkit-user-select: none. Well that kind of works. The problem is that instead of selecting the text on the control, it actually selects the closest text...
 
@Ooker that json string is that "real" content ... the server has replied with that.
you need to check at the server why it did that.
 
if i have a javascript map with key as a string and value as another map, it is showing that a particular key exists using .has() but .get() returns undefined, why is it so
async function process () {

	let cdict = await counter();

	console.log(cdict);

	let baseHandle = "kool";
	console.log(typeof(cdict));
	console.log(cdict.has(baseHandle));
}
counter returns map that maps string to map, and .has returns true but .get returns undefined
 
11:27 AM
@jeea i cannot see what happens in counter() but it is probable that the value is undefined when you did .set on your map
basically map_in_counterFx.set('kool', something_got_undefined)
 
sorry here it is but i used async await
function sleep(ms) {
	return new Promise(resolve => setTimeout(resolve, ms));
}

const cbegin = 1450;
const ccount = 5;

async function counter() {
	// Sleep in loop

	let cdict = await getusers();
	console.log("counter", cdict);
	for (let i = cbegin; i < cbegin+ccount; i++) {
		await sleep(400);
		let cidn = i;
		let cid = cidn.toString();
		console.log(cid);
		let curl = u1+cid+u2;

		fetch(curl)
		.then(res => res.json())
		.then(data => {

			for (const obj of data.result.rows) {
				let handle = obj.party.members[0].handle;
 
> console.log("counter", cdict);
did you check it? is de entry at 'kool' being undefined?
this line, cdict.get(handle).set(cidn, 1) should throw exception if cdict.get(handle) returned undefined. Also, you've commented out the error logging. Did you not got an exception?
time to debug it 🙂
 
here i created a fiddle for the error
it shows no exception
 
12:00 PM
@jeea when did you got true when console.log(cdict.has(baseHandle)); is executed?
 
sorry please change baseHandle to "kevin"
 
I ran through the map and it is not present, at both locations
- after: let cdict = await getusers();
- at: console.log(cdict.get(baseHandle));
 
let baseHandle = "kevin";
 
let baseHandle = "kevin";
console.log(cdict.has(baseHandle)); // gives "true"
console.log(cdict.get(baseHandle)); // gives Map(0)
 
@KarelG yes this has different value map than cdict
 
12:03 PM
I checked the result from getuser, it does.
idk what happens in that loop. As said, you have to debug
your counter is giving a map<str, map> as far I see
 
yes that loop waits for some time after each request so it gets all the map entries
even in process function all entries are present
but when i use .get, only some entries show up
when all entries are present in cdict in process function then i think problem should not be there in counter() ? because cdict is present properly in process() function
 
I need your help urgently. Here is the link : stackoverflow.com/questions/67568945/…
 
1:02 PM
@TonyBrand the question is not clear
 
1:27 PM
Hello
Do you have experience with momentJS ?
How can I take the previous two dates from today ?
 
"previous"?
you mean yesterday and that day before that?
 
Yes
and today also
so, I need 3 days
today, yesterday and day before yesterday
 
...
tomorrow: moment().add(1, 'days');
today: moment();
yesterday: moment().subtract(1, 'days');
...
see the pattern? :)
 
No
that's not what I want
 
huh?
 
1:40 PM
yesterday and day before yesterday
not tomorrow
So, today , yesterday and day before yesterday
 
I thought it was clear 😐
today: moment();
yesterday: moment().subtract(1, 'days');
day before yesterday: moment().subtract(2, 'days');
 
Ok , thanks
 
if you want another day before that day, just subtract more
 
I need to check if date is greater than moment().subtract(2, 'days');
 
2:04 PM
Was about to implement momentJS. Now I dont even have to read the docs lol its all here
 
@SagarV How can I show each information of slider in javascript?
 
2:36 PM
@MileMijatović hmm yes? RTFM -> momentjs.com/docs/#/query/is-after
that library has almost all basic functions you could use
 
Why do I see a lot of apis which -instead of providing an object in json- provide the data in an array format like:
[{
    key: 'key1',
    val: 'value1'
}, {
    key: 'ke2',
    value: 'value2'
}]
instead of just:
 
consistency
 
should that first character not be an [?
 
{
    key1: value1
    ke2: value2
}
 
or, potentially even they're using an api builder and didn't bother to make the output better
 
2:39 PM
It happens really a lot, hell I see above structure more often than direct dictionary data
Up to the point where I am thinking "this must be the way"
 
ha, if I see that, I would send in a ticket
 
what you mean?
 
those objects aren't consistent at all, when you look at the key names. That is a bug.
 
-.-
Hm I am actually thinking: but is this possible to catch in await async:
for (let i=0; i < 1e12; i+=1) {
    somePromise(i).then((results) => console.log(`Result promise ${i.toString(10}: `, results);
}
Using naive await would make it half on each execution.
On the other hand making a table:
const promises = [];

for (let i=0; i < 1e12; i+=1) {
    promises.push(somePromise(i));
}

const res = await Promise.all(promises);

for (const res of results) {
    console.log(`Result promise ${i.toString(10}: `, res);
}
Has major memory (and stack) problems. Not only would there be all resulting data in memory -twice- . But worst of all each promise captures it's surroundings (variables, this etc) and hence can only be freed after Promise.all() has finished executing all promises.
 
2:57 PM
wut
${i.toString(10} typo
?
what would i even be there
 
${i.toString(10)}
oh second time, well you get the idea we coudl even remove it :P
problem is that all promises stay in memory and cannot be garbage collected until Promise.all has finished executing
 
I don't see where the promises would be capturing surrounding variables either
 
oh wait I indeed am mixing up things again
 
@TonyBrand I don't have experience with .net. If you're sending something like
{
   SliderId: <id>,
   SliderName: <name>,
   SliderImageURL: <url>
}
to front end, then you can store the response in a variable, for example data and access it as data.SliderId and so
 
 
3 hours later…
6:22 PM
Again, I was given this code and asked if I could convert it...i don't know anything else outside these parameters as to why this is being done. All I'm looking for is the javascript equivalent of that code. — ACanadianCoder 47 secs ago
 
6:33 PM
!!jquery
 
@KevinB Uh, that's definitely a SNES controller at the top of the screen. xD
 
 
2 hours later…
8:28 PM
 
 
2 hours later…
10:20 PM
!!shrug
 
¯\_(ツ)_/¯
 
11:19 PM
Anyone here use Husky >= 5?
 
@Cooper 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.
 
I'm confused with how the hooks are supposed to be installed in the husky.sh when someone clones a repo for the first time and does yarn install. I have the husky prepare but what tells husky how to create the husky.sh file with pre-configured hook commands?
When you first run the husky add hook command, it just seems to add it directly to the husky.sh file, so am I suppose to commit the .husky directory?
 

« first day (3866 days earlier)      last day (1065 days later) »