These are chat archives for FreeCodeCamp/Help

22nd
Nov 2018
kinopotato
@kinopotato
Nov 22 2018 01:08

hello, can someone help clarify this with me? it's still basic dom manipulation

let lis = document.querySelectorAll("li");
for (let i = 0; i < lis.length; i++){
    lis[i].addEventListener("mouseover", ()=>{
        this.style.color="green";
    });
    lis[i].addEventListener("mouseout", ()=>{
        this.style.color = "black";
    });
}

so as I understand it, event listeners are triggers, but for loops end at a specified number of cycles. so how is this code running forever if it's inside a loop that ends unless event listeners function inside a loop and triggers that loop??

kinopotato
@kinopotato
Nov 22 2018 01:29
weird, this works on the tutorial video but not in codepen
Claudio Restifo
@Marmiz
Nov 22 2018 02:26
@kinopotato that code don't run forever. It's looping for as many li you have in page, and for each one is adding an event listener.
As the word suggest, a listener "wait" for an event to happen and fire a function.
kinopotato
@kinopotato
Nov 22 2018 02:26
ahhh, so it runs once and the event listener is added to each individual rather than you manually typing it
Claudio Restifo
@Marmiz
Nov 22 2018 02:27
exactly
kinopotato
@kinopotato
Nov 22 2018 02:27
well that makes more sense
Claudio Restifo
@Marmiz
Nov 22 2018 02:28
:)
but you said it's not working?
kinopotato
@kinopotato
Nov 22 2018 02:29
yes, that particular code isn't. I managed to rewrite the code though just now so I'll compare why it's not working
"this" isn't working, I have to use lis[i] instead, hmmm,
the this keyword will be a total mystery to me up until maybe 4 years from now
Claudio Restifo
@Marmiz
Nov 22 2018 02:39
@kinopotato well, depends a lot on how you run that function.
were you translating a tutorial from jquery?
kinopotato
@kinopotato
Nov 22 2018 02:41
no, it was vanilla js but it was on chrome and not on codepen, maybe that had something to do with it :|
Manish Giri
@Manish-Giri
Nov 22 2018 02:57
@kinopotato don't use the arrow syntax
let lis = document.querySelectorAll("li");
for (let i = 0; i < lis.length; i++){
    lis[i].addEventListener("mouseover", function() {
        this.style.color="red";
    });
    lis[i].addEventListener("mouseout", function() {
        this.style.color = "black";
    });
}
try this
Claudio Restifo
@Marmiz
Nov 22 2018 03:03
@Manish-Giri :wave:
Manish Giri
@Manish-Giri
Nov 22 2018 03:05
@Marmiz hola :wine_glass:
whats up
Claudio Restifo
@Marmiz
Nov 22 2018 03:07
pretty good... chilling and having fun with some vanilla lately at work :)
Manish Giri
@Manish-Giri
Nov 22 2018 03:08
oh man i hope you mean vanilla ice cream
lol
Claudio Restifo
@Marmiz
Nov 22 2018 03:11
nope, vanilla JS
i'd wish I have some decent ice cream here :cry:
Manish Giri
@Manish-Giri
Nov 22 2018 03:12
aw I feel ya
what's the nearest big city to your place
kinopotato
@kinopotato
Nov 22 2018 03:48
@Manish-Giri what was the arrow syntax doing? I thought it was just some kind of shorthand and doesn't really do anything
abraham anak agung
@padunk
Nov 22 2018 03:48
@kinopotato arrow syntax don't have its own this
kinopotato
@kinopotato
Nov 22 2018 03:49
alright I'll read up on it, thanks! :D
Aditya
@ezioda004
Nov 22 2018 03:50
@kinopotato Arrow syntax is not just shorthand, it doesnt have this binded to its lexical scope, doesnt have name property etc
Manish Giri
@Manish-Giri
Nov 22 2018 03:52
@kinopotato arrow syntax does a lot of things actually
some good, some weird
Aditya
@ezioda004
Nov 22 2018 03:53
Weird things such as?
Manish Giri
@Manish-Giri
Nov 22 2018 03:55
no arguments
Aditya
@ezioda004
Nov 22 2018 03:56
That should be avoided anyway now that we have rest parameter
Aditya
@ezioda004
Nov 22 2018 04:02
Online full VSC
abraham anak agung
@padunk
Nov 22 2018 04:12
Online full VSC Hey, this is cool...
Supra01
@Supra01
Nov 22 2018 04:40
I'm trying to get child 2's content to be contained in it's parent. Does anyone know how?
https://codepen.io/Supra_01/pen/PxEMza
image.png
Claudio Restifo
@Marmiz
Nov 22 2018 04:43
@Supra01 since you have have a fixed height, have you tried giving the child's a flexible height?
(like 100%)
Supra01
@Supra01
Nov 22 2018 04:44
@Marmiz no luck
@Marmiz Later I want to toggle .big and .small classes with JavaScript
@Marmiz but I can't seem to keep the lis with the .big class content contained
Claudio Restifo
@Marmiz
Nov 22 2018 04:54
@Supra01 you know that the content will always be an image with a ceratain ratio?
that's very important when working with images on the web.
You can't expect to have a consistent layout if one time you have a 1:1 picutre, and later a 16:9

anyway a

width: 100%
height: auto

makes an image responsive.
then you probably want to change the display property of your li

(the other way, height: 100% width: auto)
Supra01
@Supra01
Nov 22 2018 04:57
@Marmiz cool thank you I will give that a shot
Claudio Restifo
@Marmiz
Nov 22 2018 04:59
but if you want your li to be as big as their content you have to get rid of that fixed height
Darren
@DarrenfJ
Nov 22 2018 06:35
evening fCC
May Kittens Devour Your Soul
@diomed
Nov 22 2018 08:31
vanilla js is like opposite of favorite flavor of icecream.
Roko Medančić
@R0k0
Nov 22 2018 09:39
Fay Vor
@phavor
Nov 22 2018 10:36

How do I broadcast this to the client as I don't want the person typing to see that he is typing

// Someone is typing
  socket.on('isTyping', (data) => {
    let user = users.getUser(socket.id)

    socket.broadcast.to(user.room)
        .emit('userTyping', generateMessage(user.name, 'is typing...'))
  })

The socket.broadcast.to(user.room).emit(...) does not seem to work, but when I change it to io.to(user.room).emit(...) it sends the information. But the user who is typing gets the information as well.How do I fix this?

Jose Sanchez
@lifeisshort
Nov 22 2018 12:57
hi all. Does anybody know how to have a look at heat map of freecodecamp website?
ok, I got it, I was playing with the public/private options on my profile. My bad.
May Kittens Devour Your Soul
@diomed
Nov 22 2018 13:19
any1 have any good resource on Bootstrap 4 horizontal cards?
where image is on left, and text on right
May Kittens Devour Your Soul
@diomed
Nov 22 2018 13:27
Niraj Nandish
@Nirajn2311
Nov 22 2018 14:10
@diomed what happened
I did bootstrap in summer holidays
Travis Fantina
@tfantina
Nov 22 2018 14:19
@diomed I've got some Bootstrap 4 experience. Do you have something you've created that's not working?
May Kittens Devour Your Soul
@diomed
Nov 22 2018 15:28
@tfantina no. I just want card that's horizontal
with picture on the left
actually - what I really want it modal to be that card. if you get me
@Nirajn2311 make me vue color calculator
May Kittens Devour Your Soul
@diomed
Nov 22 2018 15:47
@kerenkalifa your twitter contact me leads to codeschool ._.
Keren Kalifa
@kerenkalifa
Nov 22 2018 15:50
I’m soyi don’t understand what you mean?
I’m sorry *
May Kittens Devour Your Soul
@diomed
Nov 22 2018 15:51
@kerenkalifa that's common happening
your link in footer does not lead to twitter page McCircuit
Aditya
@ezioda004
Nov 22 2018 15:52
Where do I sign up for :cat: reviews?
May Kittens Devour Your Soul
@diomed
Nov 22 2018 15:53
@ezioda004 you can't. you're too advanced for that
Keren Kalifa
@kerenkalifa
Nov 22 2018 15:53
@diomed so what do I need to do?
May Kittens Devour Your Soul
@diomed
Nov 22 2018 15:54
@kerenkalifa if you have proper twitter page, link to that page
@ezioda004 in your About me section, you have 2 dots and lack of p in scholarship
:yum:
there, happy now? :D
Aditya
@ezioda004
Nov 22 2018 15:56
@diomed Thanks - I had fixed that but forgot to push the code :D
May Kittens Devour Your Soul
@diomed
Nov 22 2018 15:56
@ezioda004 also - strengtheing that's not how one spells that word
btw. did anyone ever contact you via that form?
Aditya
@ezioda004
Nov 22 2018 15:58
@diomed Thanks, no its broken lol
May Kittens Devour Your Soul
@diomed
Nov 22 2018 15:59
@ezioda004 you used that great animation library that actually animates when user comes back, unlike animate.css :|
:cat: likes that a lot. also - fixed backgrounds - great stufff
Aditya
@ezioda004
Nov 22 2018 16:02
@diomed I wont use animation library now - but I'm too lazy to rewrite the whole thing. I've been migrating my old projects from jQuery to vanilla JS and you have no idea how many places I've used jQuery for animations lol
May Kittens Devour Your Soul
@diomed
Nov 22 2018 16:03
@ezioda004 you should try meddling with XSLT. I believe you have nerves for something like that
Aditya
@ezioda004
Nov 22 2018 16:04
Whats that?
May Kittens Devour Your Soul
@diomed
Nov 22 2018 16:08
it's a styling language for XML
Aditya
@ezioda004
Nov 22 2018 16:09
XML is dead - long live JSX
Niraj Nandish
@Nirajn2311
Nov 22 2018 16:34
@diomed color calculator?? what will the world think of next, a letter calculator
May Kittens Devour Your Soul
@diomed
Nov 22 2018 16:42
@Nirajn2311 what time is it?
J _ _ _ _
_ _ M _
:yum:
Niraj Nandish
@Nirajn2311
Nov 22 2018 16:43
@diomed I was just getting up for dinner
Just one and ill go
Jumbo Time
May Kittens Devour Your Soul
@diomed
Nov 22 2018 16:47
no
Smootimus
@Smootimus
Nov 22 2018 16:52
O.O
May Kittens Devour Your Soul
@diomed
Nov 22 2018 16:53
@Smootimus guess letters for my hangman game.
Aditya
@ezioda004
Nov 22 2018 16:55
@diomed I
May Kittens Devour Your Soul
@diomed
Nov 22 2018 16:59
J _ _ _ _
_ I M _
Aditya
@ezioda004
Nov 22 2018 17:00
So Time
May Kittens Devour Your Soul
@diomed
Nov 22 2018 17:00
J E _ _ _
T I M E
Aditya
@ezioda004
Nov 22 2018 17:01
L
Jelly?
May Kittens Devour Your Soul
@diomed
Nov 22 2018 17:06
correct! :congratulations: :tada:
@Nirajn2311 said that in private message- and yet failed to guess :P
Niraj Nandish
@Nirajn2311
Nov 22 2018 17:08
@diomed I didnt want to reveal the answer here yet :smirk_cat: :
May Kittens Devour Your Soul
@diomed
Nov 22 2018 17:12
haha, did you finish dinner
Niraj Nandish
@Nirajn2311
Nov 22 2018 17:14
Yup
You asked for a color calc
What exactly is that?
May Kittens Devour Your Soul
@diomed
Nov 22 2018 17:16
probably something that shows lighter color by a degree you enter
like 10-20-30...%
or darker, of course
May Kittens Devour Your Soul
@diomed
Nov 22 2018 17:22
_ R _ _ _ M
_ _ R T _ _
  • it's a person -
Aditya
@ezioda004
Nov 22 2018 17:23
Martin
May Kittens Devour Your Soul
@diomed
Nov 22 2018 17:24
you should guess letters, not words. lol
it ain't Martin
Niraj Nandish
@Nirajn2311
Nov 22 2018 17:24

probably something that shows lighter color by a degree you enter

You mean like the bakground should change colour according to the values I enter in some kind of color form

May Kittens Devour Your Soul
@diomed
Nov 22 2018 17:27
@Nirajn2311 yes
Niraj Nandish
@Nirajn2311
Nov 22 2018 17:27
@diomed ill see, but give me two weeks time
Busy with studies at the time
May Kittens Devour Your Soul
@diomed
Nov 22 2018 17:27
this should also be little electron app. chop chop! :D
Niraj Nandish
@Nirajn2311
Nov 22 2018 17:28
Organic Chemistry :tired_face: :tired_face:
May Kittens Devour Your Soul
@diomed
Nov 22 2018 17:28
oh the horrors
Niraj Nandish
@Nirajn2311
Nov 22 2018 17:28
Also next week we got 4 days holiday
National day celebrations
tarangwadekar
@tarangwadekar
Nov 22 2018 17:29
How can I run c program inn visual studio code?
May Kittens Devour Your Soul
@diomed
Nov 22 2018 17:30
@Nirajn2311 that's good news.
Niraj Nandish
@Nirajn2311
Nov 22 2018 17:32
@tarangwadekar do you have mingw installed? Also are you working in windows, mac or linux
Aditya
@ezioda004
Nov 22 2018 17:33
@tarangwadekar Can use code runner extension.
Niraj Nandish
@Nirajn2311
Nov 22 2018 17:34
@ezioda004 you need a compiler to compile the code, then only code runner works
Aditya
@ezioda004
Nov 22 2018 17:37
Yes - thats presuming he has gcc or any other compiler installed.
May Kittens Devour Your Soul
@diomed
Nov 22 2018 17:38
boo! no1 plays :disappointed:
Niraj Nandish
@Nirajn2311
Nov 22 2018 17:38
@diomed Graham martin
May Kittens Devour Your Soul
@diomed
Nov 22 2018 17:40
it's not martin. lol
Niraj Nandish
@Nirajn2311
Nov 22 2018 17:40
@diomed S
May Kittens Devour Your Soul
@diomed
Nov 22 2018 17:40
4 2nd time
no S
Niraj Nandish
@Nirajn2311
Nov 22 2018 17:40
A
Smootimus
@Smootimus
Nov 22 2018 17:40
LOL
We should make a bot to do that Diomed
May Kittens Devour Your Soul
@diomed
Nov 22 2018 17:41
no goddamn bot is gonna replace :cat:
_ R A _ A M
_ _ R T _ _
@Smootimus you could make a bot to guess it. lol
Niraj Nandish
@Nirajn2311
Nov 22 2018 17:43
@diomed the Graham Norton Show
diomed @diomed curses
May Kittens Devour Your Soul
@diomed
Nov 22 2018 17:43
I mean yes, but there's not show in hangman
therefore to the gallows with you!!! :smirk_cat:
Niraj Nandish
@Nirajn2311
Nov 22 2018 17:44
@diomed i still dont get it how you do that purple coloured text
diomed @diomed is magic :cat:
diomed @diomed used buefy. it was super efficient
Smootimus
@Smootimus
Nov 22 2018 17:45
LOL
G
Ah
Dang
Somone already guessed
Niraj Nandish
@Nirajn2311
Nov 22 2018 17:45
I was thinking of changing to buefy, it is small compared to vuefy
May Kittens Devour Your Soul
@diomed
Nov 22 2018 17:46
you should , if you like bulma. they're up to date now
@Nirajn2311 got some time now or are you doing that russian biology, or whatewer it's called
Niraj Nandish
@Nirajn2311
Nov 22 2018 17:52
@diomed I am free now
May Kittens Devour Your Soul
@diomed
Nov 22 2018 17:57
gonna send you some bootstrap thingie to troubleshoot
codeloopy
@codeloopy
Nov 22 2018 19:44
Hello first: Happy gobble gobble!
second: quick question: I think I’ve screwed up and not been documenting my JS exercises for future reference, some of these have literatelly made me sweat HAHA, is there a way to go back and get my answers?
I’m going through my exercises and they’re all empty without a solution (reset back)
tnx in advance
Aditya
@ezioda004
Nov 22 2018 20:38
@codeloopy I dont think so - fcc doesnt save solution anymore but theres an option to "download" when you submit a solution.
Fay Vor
@phavor
Nov 22 2018 21:29

Hi guys, am trying to achieve something like this with my mongoose schema, but am a little confused...

"bio": {
    "full name": "Your fullname",
    "age": 23,
    "lga": "somewhere in nigeria",
    "blood group": "0+",
    "genotype": "AA",
    "height": "234.2''",
    "residential_addr": "your street number"
  },
  "birth_records": {
    "dob": "02-8-1990",
    "time_of_birth": "2 am",
    "hospital_name": "Federal Medical Center",
    "hospital_address": "44b Zamlek Ave.",
    "doctor_in_charge": "Philip Stanley",
    "midwives": [
      "Stella Vicent", "Oluchi Bridget", "Kate Henshaw"
    ]
  },
  "medical_records": {
    "current_health_report": "some health data",
    "doctor": "Dully Brown",
    "health_history": "pull up a file"
  },

How do I translate this into a user model?