These are chat archives for FreeCodeCamp/Help

12th
Oct 2018
AK01993
@AK01993
Oct 12 2018 00:16
Can someone help me? This video is not showing up.
<iframe id="video" width="400" height="215" src="https://vimeo.com/292239937"frameborder="5" allow="autoplay;encrypted-media" allowfullscreen></iframe>
Fabien SHAN
@X140hu4
Oct 12 2018 00:41
@AK01993 You can't just use the link of the page of the video as source. Go into the share options of the video on that page, maybe there is a way to use that.
Matt
@matteprg
Oct 12 2018 02:33
Hey everyone I need some help creating tests for my react app. If there's anyone on that is good at writing the tests please I really need the help.
ehutchllew
@ehutchllew
Oct 12 2018 02:37
@matteprg I'm not amazing at it, but I have some experience using Jest.
Matt
@matteprg
Oct 12 2018 02:39
I want to write a test for this componenet and I am not finding a way to do it.
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { getBookWithReviewer, clearBookWithReviewer } from '../../actions';

export class BookView extends Component {
  componentWillMount = () => {
    this.props.dispatch(getBookWithReviewer(this.props.match.params.id));
  };
  componentWillUnmount = () => {
    this.props.dispatch(clearBookWithReviewer());
  };

  renderBook = books =>
    books.book ? (
      <div className="br_container">
        <div className="br_header">
          <h2>{books.book.name}</h2>
          <h5>{books.book.author}</h5>
          <div className="br_reviewer">
            <span>Review by:</span> {books.reviewer.name}{' '}
            {books.reviewer.lastname}
          </div>
        </div>
        <div className="br_review">{books.book.review}</div>
        <div className="br_box">
          <div className="left">
            <div>
              <span>Pages:</span> {books.book.pages}
            </div>
            <div>
              <span>Price:</span> {books.book.price}
            </div>
          </div>
          <div className="right">
            <span>Rating:</span>
            <div>
              {books.book.rating}
              /5
            </div>
          </div>
        </div>
      </div>
    ) : null;

  render() {
    let books = this.props.books;
    return <div>{this.renderBook(books)}</div>;
  }
}

function mapStateToProps(state) {
  return {
    books: state.books,
  };
}

export default connect(mapStateToProps)(BookView);
I have tried a shallow render of the component but it keeps failing
ehutchllew
@ehutchllew
Oct 12 2018 02:58
Okay so what have you done so far? Where's your test code? Talk through what's going through your mind of what needs to be tested.
Matt
@matteprg
Oct 12 2018 03:39
Here is what I have tried so far
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import React from 'react';
import toJson from 'enzyme-to-json';
import { shallow } from '../../../setupTests';

import { BookView } from '../../Books';

const middlewares = [thunk];
const mockStore = configureMockStore(middlewares);

describe('<BookView />', () => {
  test('should render <BookView />', () => {
    const wrapper = shallow(<BookView />);
    const component = wrapper.dive();
    console.log(wrapper.debug());
    expect(toJson(component)).toMatchSnapshot();
  });
});
I wanted to just check if the BookView would render I tried a shallow render but that gave me errors saying there was no store so I did some more research and now I am getting " TypeError: Cannot read property 'params' of undefined"
idris
@idris12
Oct 12 2018 04:10
hello
so am trying to build a calculator but when even i lick on the numbers it doesnt show on display of the pragraph i have saved what am a doing wrong
Fabien SHAN
@X140hu4
Oct 12 2018 04:18
@idris12 You are assigning the Click event on the tr not the td
idris
@idris12
Oct 12 2018 04:19
@X140hu4 so does that mean i have to give every single tr a class name
Fabien SHAN
@X140hu4
Oct 12 2018 04:20
Or you could select all tr, or select them when you are accessing the parent
idris
@idris12
Oct 12 2018 04:25
its not still working
after i gave the class names to the tr
Fabien SHAN
@X140hu4
Oct 12 2018 04:42
Try implementing the feature only on one button
Henry
@GitHub-Henry
Oct 12 2018 06:18
@idris12 You should use a frontend framework (like React for example) because this section is about learning frontend frameworks
i think the calculator project is supposed to be done with react for the new certs
Eunice Park
@eunicode
Oct 12 2018 06:28
I have a newbie question about virtual machines and Docker. I'd like to contribute to an open source project that has a CSS issue with Firefox in Windows 10. However, I'm on Mac OS. I know I could use a virtual machine, but the developer environment setup involves Docker. So would I have to run a virtual machine, install Docker there, and then run Docker there? So run a virtual machine running Docker? Will this work without problems? I have zero experience with Docker, but it seems like inception me
Henry
@GitHub-Henry
Oct 12 2018 06:44
like you, i have zero experience with docker. perhaps read a book about docker
Eunice Park
@eunicode
Oct 12 2018 06:47
Thanks for the book recommendation. I'm a scaredy cat (really cautious about experimenting with new things) so I think I'll just do this in an old Windows laptop.
Henry
@GitHub-Henry
Oct 12 2018 06:48
i think docker requires windows 10
or linux type of os
not sure about ios
Bjorn van de Peut
@bjorno43
Oct 12 2018 06:48
@eunicode A virtual machine is like a computer within a computer. The virtual machine doesn't have access to your real machine. Hence you normally need to install a new operating system on a virtual machine as well. So yes, you probably have to install Docker on the virtual machine
Eunice Park
@eunicode
Oct 12 2018 06:55
@Henry thank you for your reply, there is Docker for Mac now https://store.docker.com/editions/community/docker-ce-desktop-mac
@bjorn Thank you, I do have Windows 10 installed in Parallels. I'm just unsure of how a virtual machine running a virtual machine would work?
Bjorn van de Peut
@bjorno43
Oct 12 2018 06:58
@eunicode It depends on how much RAM the first virtual machine has. Lets say the real machine has 16 Gig RAM. You create a virtual machine and give it 8 Gig to run. If you want to install a virtual machine within that virtual machine, you can only use those 8 Gig. Of course some of that is used by the running VM. Leaving you like 3 or 4 Gig for the VM inside the VM
redix21
@redix21
Oct 12 2018 06:58
hi , i am completely new in java. Can anyone help me with a error? where it says "JavaFX controller method must have 0 or exactly 1 argument" i am getting this error while coding for javafx in eclipse, it's a fxml code
Bjorn van de Peut
@bjorno43
Oct 12 2018 07:02
@redix21 This is probably not the right place to ask. FCC doesn't teach Java. We don't have a Java help channel either. The error tells you that a method (function if you will) must have 0 or 1 arguments. Like controller(); or controller(argument);. Perhaps that'll help you a bit. But it's all the info I can give you
Eunice Park
@eunicode
Oct 12 2018 07:02
@bjorno43 thanks. I guess I'll have to look into how much RAM Docker uses? I'm still confused about what Docker is, but I'm under the impression that it's something similar to a virtual machine? I'll look more into it.
redix21
@redix21
Oct 12 2018 07:04
thanks, i will try to get from other places
Bjorn van de Peut
@bjorno43
Oct 12 2018 07:05
@eunicode I have no idea either. I've never worked with Docker and I don't use VMs. I've got several computers and laptops at my disposal should it be needed :P
Eunice Park
@eunicode
Oct 12 2018 07:09
Lucky for you, my spare is an ancient Windows laptop :sweat_smile:
Bjorn van de Peut
@bjorno43
Oct 12 2018 07:11
Ghehe well it's just what you gather over the years. I've had ppl dumping their "old" hardware at my doorstep all the time
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:19
@bjorno43 Give me some!
BTW, why didn't you put them on ebay?
May Kittens Devour Your Soul
@diomed
Oct 12 2018 07:24
@bjorno43 is just like - ok, ransomware, I got this...
throws pc in bathtub, takes another pc
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:25
@eunicode Docker is w a way to put your app into a "Container". A container is basically code, runtime and alldependencies. So you can develop, ship and deploy faster
Bjorn van de Peut
@bjorno43
Oct 12 2018 07:25
@anandpotukchi We have a saying here in my country. It basicly translates to something like: Those who save something, have something
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:26
@bjorno43 swedish? german?
Bjorn van de Peut
@bjorno43
Oct 12 2018 07:26
Netherlands
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:26
ah...
May Kittens Devour Your Soul
@diomed
Oct 12 2018 07:26
we also have a saying in my country.
it goes something like : You're a screw-up, :cat:
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:26
lol
Bjorn van de Peut
@bjorno43
Oct 12 2018 07:26
That's not a saying, that's just stating facts
Aditya
@ezioda004
Oct 12 2018 07:27
Never travel to Croatia :heavy_check_mark:
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:27
@bjorno43 Its english equivqlent is old is gold, i believe
May Kittens Devour Your Soul
@diomed
Oct 12 2018 07:29
@ezioda004 ummm.... that's where you're wrong
Bjorn van de Peut
@bjorno43
Oct 12 2018 07:29
@anandpotukchi No, in English it best translates to something said by Ben Franklin: Waste not, want not. - Or "saving it for a rainy day"
Eunice Park
@eunicode
Oct 12 2018 07:30
@anandpotukchi Thanks, according to lynda.com, my best friend, Docker is not virtual machines. Docker fetches and builds "containers" for you. And like you said, a container is a self contained sealed unit of software. It has everything in it that is needed to run that code: operating system, dependencies, networking, etc.
May Kittens Devour Your Soul
@diomed
Oct 12 2018 07:31
@ezioda004 people who travel to Croatia, usually come back, to revisit it.
however, you don't want to live here. :-|
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:32
@eunicode The guy who created it is a genius
Aditya
@ezioda004
Oct 12 2018 07:33
@diomed No wonder, nobody likes being reminded they are a screw up
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:33
/@diomed hmmm.. what's good about croatia
lol
Eunice Park
@eunicode
Oct 12 2018 07:33
@anandpotukchi as a newbie, everyone looks like a genius to me lol
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:33
every f ing day
May Kittens Devour Your Soul
@diomed
Oct 12 2018 07:33
@anandpotukchi what?
@eunicode looks can deceive. I may look as a genious, but I'm in fact a :cat:
how do you like ghost ?
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:35
@diomed I meant to say - whats good? what makes them visit
@eunicode Beneath the hood.,everyone's screwed. Just on another level .lol
Aditya
@ezioda004
Oct 12 2018 07:35
I've heard the cats there can talk
May Kittens Devour Your Soul
@diomed
Oct 12 2018 07:36
that's true.
7791_500f_large.gif
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:36
Look at me, working on the same project since 11. (its 1 now).
Bjorn van de Peut
@bjorno43
Oct 12 2018 07:37
I want to visit Japan. I've watched too much anime. My expectations are high :innocent:
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:37
@bjorno43 It's a cool place to visit. real clean and punctual.
May Kittens Devour Your Soul
@diomed
Oct 12 2018 07:37
@anandpotukchi better that than working on the same project since 11 years old
Eunice Park
@eunicode
Oct 12 2018 07:37
That's a plus then, I love cats. Also, don't know much about ghost. I only forked it bc I wanted to contribute to it, but that ended up being a dead end /shrugs
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:38
@diomed how old are you
Bjorn van de Peut
@bjorno43
Oct 12 2018 07:38
@anandpotukchi I know. Was ment as a joke. If you compare Japan with anime, you're gonna be disappointed.. a lot :laughing:
May Kittens Devour Your Soul
@diomed
Oct 12 2018 07:38
I'm like 12. [emotionally]
Aditya
@ezioda004
Oct 12 2018 07:39
Same, except I'm 13 this year
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:39
I'm like 6
too immature
May Kittens Devour Your Soul
@diomed
Oct 12 2018 07:40
damn toddler :stuck_out_tongue_closed_eyes:
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:40
lol
Bjorn van de Peut
@bjorno43
Oct 12 2018 07:40
I can be like 12.. depending on the opportunety for a troll :trollface:
May Kittens Devour Your Soul
@diomed
Oct 12 2018 07:40
why is everyone's link to page from their profile dead???
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:40
in terms of sex/porn fantasy = 17
May Kittens Devour Your Soul
@diomed
Oct 12 2018 07:41
well... the more we know...
the less we wanna know, I guess
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:41
true
Bjorn van de Peut
@bjorno43
Oct 12 2018 07:42
I remember developing a program several years ago. I told my users not to use it yet, as it wasn't ready and I was just testing stuff
But I knew they kept auto updating it everytime I rolled out another test
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:42
that quote makes me think you as mi-40s philosopher @diomed
Bjorn van de Peut
@bjorno43
Oct 12 2018 07:42
So eventually I build in a PC restart when the program was launched :trollface:
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:43
wicked @bjorno43
I guess it's called thug life
Bjorn van de Peut
@bjorno43
Oct 12 2018 07:44
Ghehe it was a harmless troll which served its purpose: They learned to listen when I said not to use it xD
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:44
YESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
May Kittens Devour Your Soul
@diomed
Oct 12 2018 07:44
@anandpotukchi people come to Croatia coz they've seen all those beautiful pics taken by professional photographers.
I think it's called tourism and advertising and stuff like that
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:45
i just completed my ds & algo cert
how do I claim
oops
May Kittens Devour Your Soul
@diomed
Oct 12 2018 07:45
@bjorno43 you are worse than Christian
Bjorn van de Peut
@bjorno43
Oct 12 2018 07:45
I could've just wrote a function to wipe the hard drive instead. Way too many ppl don't realise that anti-virus software does absolutely nothing against legitimate programs doing nasty stuff :P
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:46
one challenge left........... :-(
May Kittens Devour Your Soul
@diomed
Oct 12 2018 07:46
you should always turn that sad face into a smile. like this )-:
wait...
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:47
and Im gonna turn to @ezioda004 for help
please help
function truthCheck(collection, pre) {
   var counter = 0;

   for (var c in collection) {
    // If it has the same property or the same property value then add 1
    if (collection[c].hasOwnProperty(pre) || collection[c][pre] == pre) {
      counter++;
    }
  }

  if (counter == collection.length) {
    return true;
  } else
    return false;
}


truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy", "sex": "male"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex");
oh enlightened soul
May Kittens Devour Your Soul
@diomed
Oct 12 2018 07:48
it's hard going through life named as Dipsy.
and being a male
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:49
[SECRET] @ezioda004 helped me with 60% of these [SECRET]
@diomed hmm
please help someone....... I will get my cert
May Kittens Devour Your Soul
@diomed
Oct 12 2018 07:50
@anandpotukchi we got nice girls too
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:51
@diomed I prefer русский
Babes are too hot there
In fact just learnt the alphabet. completed today
@ezioda004
are you there
May Kittens Devour Your Soul
@diomed
Oct 12 2018 07:53
he's hiding
[behind the code]
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:53
someone
which callenge are you on @diomed @diomed
May Kittens Devour Your Soul
@diomed
Oct 12 2018 07:53
... once told me world is gonna...
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:53
@bjorno43
are you doing the curriculum
Bjorn van de Peut
@bjorno43
Oct 12 2018 07:54
@anandpotukchi Rarely. If I'm rly bored
Aditya
@ezioda004
Oct 12 2018 07:54
@anandpotukchi Whats the purpose of collection[c][pre] == pre?
May Kittens Devour Your Soul
@diomed
Oct 12 2018 07:55
I think the key to beauty of every country is to be a bird with a camera.
Aditya
@ezioda004
Oct 12 2018 07:55
Also, its a bad idea to use for ..in loop with Arrays because they also get enumerable properties, you should use for..of instead.
May Kittens Devour Your Soul
@diomed
Oct 12 2018 07:56
@ezioda004 teach me vue, you sexy metrosexual!
Eunice Park
@eunicode
Oct 12 2018 07:58
@anandpotukchi One problem might be that you're only checking if the property exists.
According to the instructions, the property's value also has to be truthy.
For example, this object has the property onBoat.
{"name": "FastFoward", "onBoat": null}
But the value is falsy (null). So you need to return false.
Aditya
@ezioda004
Oct 12 2018 07:58
Ok, easy 4 step guide
Step 1 Brainwash
Step 2 Learn React
Step 3 ????
Step 4 Enjoy
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:58
@ezioda004 step 3 is build a project
May Kittens Devour Your Soul
@diomed
Oct 12 2018 07:59
Eunice looks suspiciously knowledgeable for a beginner
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:59
indeed...
Aditya
@ezioda004
Oct 12 2018 07:59
I've seen him around, I remember he asked a closure question like 7-8 months ago
Eunice Park
@eunicode
Oct 12 2018 07:59
I've been coding for over a year, but I'm still a newbie orz
Anand Potukuchi
@anandpotukchi
Oct 12 2018 07:59
@ezioda004 uh.. eunice is a girl's name
correct? @eunicode ?
Aditya
@ezioda004
Oct 12 2018 08:00
Well, he/she
Eunice Park
@eunicode
Oct 12 2018 08:00
Yes, you can google it lol. And I remember you too. You told me about event loops
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:01
@ezioda004 is pretty knowledgeable
Aditya
@ezioda004
Oct 12 2018 08:01
Oh yeah I member
I'm just pretty
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:02
and you've been here since 2016
an year before me
@ezioda004 agreed
May Kittens Devour Your Soul
@diomed
Oct 12 2018 08:02
heck, I'm pretty :cat: too, but do I know JS? - no
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:03
lol
May Kittens Devour Your Soul
@diomed
Oct 12 2018 08:03
Aditya sure means humble
Aditya
@ezioda004
Oct 12 2018 08:03
Well yes and no, I started in 2016 but I stopped after a month because WoW needed me
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:03
\ @diomed you should stop putting up pictures of cats
May Kittens Devour Your Soul
@diomed
Oct 12 2018 08:03
so what now - hedgehogs?
Manish Giri
@Manish-Giri
Oct 12 2018 08:04
@diomed :cat:
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:04
how about you for a change
somebody give me a solution
want to see my cert
Eunice Park
@eunicode
Oct 12 2018 08:06

Can I ask a JS question?

This code creates an array with a range of numbers.

const arr = new Array(5);
const range = [...arr.keys()]; 
console.log(range); // [0,1,2,3,4]

But I don't understand how?
Bc arr.hasOwnProperty('0') returns false, etc.

Aditya
@ezioda004
Oct 12 2018 08:06
Then work for it, whats the point of getting certificate if you dont earn it?
May Kittens Devour Your Soul
@diomed
Oct 12 2018 08:06
@Manish-Giri :cat:
sigh he doesnt even say hi anymore
Niraj Nandish
@Nirajn2311
Oct 12 2018 08:07
@ezioda004 1 - 0 @anandpotukchi
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:07
@Nirajn2311 haha. nice one -__-
Manish Giri
@Manish-Giri
Oct 12 2018 08:07
@diomed who :thought_balloon:
Eunice Park
@eunicode
Oct 12 2018 08:08
@Manish-Giri woops, my bad. But arr.hasOwnProperty(0); still returns false.
console.log(arr);
[ <5 empty items> ]
May Kittens Devour Your Soul
@diomed
Oct 12 2018 08:08
@anandpotukchi here's one of me smiling. I think Peter Parker took that one
You, sir @Manish-Giri
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:09
@ezioda004 you are evil.......
one challenge
Manish Giri
@Manish-Giri
Oct 12 2018 08:09
@eunicode try in
see if it works
May Kittens Devour Your Soul
@diomed
Oct 12 2018 08:10
s t a t i s t i c a l l y b o r e d
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:10
collection[c] is undefined, can't access property "hasOwnProperty" of it
Manish Giri
@Manish-Giri
Oct 12 2018 08:10
@diomed says the one who doesn't even check pms
:smirk_cat:
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:11
@Manish-Giri you cook right
Manish Giri
@Manish-Giri
Oct 12 2018 08:11
yes sir
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:11
what did you make today
Aditya
@ezioda004
Oct 12 2018 08:11
@eunicode Its probably because empty items are not properties
@eunicode You cant iterate through them either
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:11
@ezioda004 help me first!!!!!!!!!!!!!!
Niraj Nandish
@Nirajn2311
Oct 12 2018 08:12
@anandpotukchi what is your code currently
Manish Giri
@Manish-Giri
Oct 12 2018 08:12
@anandpotukchi fried rice and egg burji
Aditya
@ezioda004
Oct 12 2018 08:12
@anandpotukchi Well, did you modify your code?
Manish Giri
@Manish-Giri
Oct 12 2018 08:12
not sure if i spelled that right
Aditya
@ezioda004
Oct 12 2018 08:12
Theres no right or wrong in Hinglish
Henry
@GitHub-Henry
Oct 12 2018 08:12
egg bhurji
Manish Giri
@Manish-Giri
Oct 12 2018 08:13
that
is prolly the right one
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:13
I changed the totoof`
May Kittens Devour Your Soul
@diomed
Oct 12 2018 08:13
@Manish-Giri u know Christian
and his shenannigans

Bjorn van de Peut
@bjorno43
Oct 12 2018 08:13

This is as far as I got, which should work imo:

function truthCheck(collection, pre) {
  for(let i = 0; i < collection.length; i++){
    if(collection[i].hasOwnProperty(pre)){
      if(collection[i].pre){
        continue;
      } else {
        return false;
      }
    } else {
      return false;
    }
  }
  return true;
}

But it returns false on everything..

May Kittens Devour Your Soul
@diomed
Oct 12 2018 08:14
how do I make eggs bhurji?
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:15
@GitHub-Henry where are you from
Henry
@GitHub-Henry
Oct 12 2018 08:15
usa
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:15
@GitHub-Henry where in usa
May Kittens Devour Your Soul
@diomed
Oct 12 2018 08:15
damn, u Indians sure love spices
Manish Giri
@Manish-Giri
Oct 12 2018 08:15
function truthCheck(collection, pre) {
  return collection.every(obj => obj.hasOwnProperty(pre) && obj[pre]);
}
@anandpotukchi
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:16
@GitHub-Henry city, state
should be 1 am
May Kittens Devour Your Soul
@diomed
Oct 12 2018 08:16
@Manish-Giri when u come in Croatia you should try Vegeta (spice)
Manish Giri
@Manish-Giri
Oct 12 2018 08:16
@bjorno43 too many lines Bob
Henry
@GitHub-Henry
Oct 12 2018 08:16
vegeta is in us
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:16
are your challenges getting saved
Bjorn van de Peut
@bjorno43
Oct 12 2018 08:17
@Manish-Giri lol
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:17
they aren't for me
Henry
@GitHub-Henry
Oct 12 2018 08:17
i don't think they get saved anymore, unless you specify that it does
Manish Giri
@Manish-Giri
Oct 12 2018 08:17
@diomed whats vegeta
:thought_balloon:
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:17
I think he means vagene
Manish Giri
@Manish-Giri
Oct 12 2018 08:18
uh
May Kittens Devour Your Soul
@diomed
Oct 12 2018 08:18
it's Croatian spice
yup. that one
Aditya
@ezioda004
Oct 12 2018 08:18
@eunicode Also,undefined != empty space
let arr = new Array(5);
const x = arr.forEach(y => console.log("doesnt iterate"));
arr.hasOwnProperty(0); //false
arr = [...arr.keys()];
arr.hasOwnProperty(0); //true
May Kittens Devour Your Soul
@diomed
Oct 12 2018 08:20
how do they scramble those eggs? they dont even look like eggs anymore
Manish Giri
@Manish-Giri
Oct 12 2018 08:20
just like js scrambles my brain
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:21
I GOT MY CERTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
*goes back to work
Bjorn van de Peut
@bjorno43
Oct 12 2018 08:22
@anandpotukchi Grats!
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:22
@bjorno43 thanks
Henry
@GitHub-Henry
Oct 12 2018 08:22
congrats
which one did you get?
Aditya
@ezioda004
Oct 12 2018 08:23
Nice, I hope you learned something from it
May Kittens Devour Your Soul
@diomed
Oct 12 2018 08:24
I just watched someone making Egg Bhurji on YT
OMG
Manish Giri
@Manish-Giri
Oct 12 2018 08:24
lol
mind blown
May Kittens Devour Your Soul
@diomed
Oct 12 2018 08:25
I obviously dont know how to cook
for me step one is putting the eggs and scrambling them
but they do everything before that. lol
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:26
@Manish-Giri mind = blown
Niraj Nandish
@Nirajn2311
Oct 12 2018 08:27
@diomed any 12 year old can do it, but sadly you’re 11 year old
Aditya
@ezioda004
Oct 12 2018 08:27
@diomed Its an easy dish and tastes good aswell
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:27
@GitHub-Henry DS & Algo
May Kittens Devour Your Soul
@diomed
Oct 12 2018 08:27
where do you get all those expensive spices, people?
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:27
I made bhindi sabzi
willmake biryani tomorrw night
May Kittens Devour Your Soul
@diomed
Oct 12 2018 08:27
@anandpotukchi is that like rizi-bizi
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:28
@diomed ?
Eunice Park
@eunicode
Oct 12 2018 08:28
@ezioda004 Sorry for the late reply. It takes me a while to organize my thoughts. That's what confuses me. If we have an array of empty items, or if we have an array that does not have the keys 0,1,2,3,4, how does this create an array of [0,1,2,3,4]?
let arr = new Array(5);

Object.keys(arr); // []

arr = [...arr.keys()];

console.log(arr);  // [0, 1, 2, 3, 4]
Aditya
@ezioda004
Oct 12 2018 08:28
Biryani at home? Arent you brave
Manish Giri
@Manish-Giri
Oct 12 2018 08:29
@anandpotukchi idk why fcc named that section 'algo and ds'
the challenges there are far from ds & algo
May Kittens Devour Your Soul
@diomed
Oct 12 2018 08:29
he obviously knows how to cook
and is saturday day of rest for you or? @anandpotukchi
Manish Giri
@Manish-Giri
Oct 12 2018 08:30
anyone watching the test match (india vs wi)
Aditya
@ezioda004
Oct 12 2018 08:30
@eunicode Good question, I suppose when you do new Array(5);the array stores like some internal property which isnt visible to us, but the key thing to remember is its not a functional array as of that moment.
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:31
@diomed yeah.. sat and sun is just fcc and you guys
Aditya
@ezioda004
Oct 12 2018 08:31
@Manish-Giri Yeah true, theres far better DS and Algo section in coding interview section
Manish Giri
@Manish-Giri
Oct 12 2018 08:32
those challenges there are the actual DS&A qs
Bjorn van de Peut
@bjorno43
Oct 12 2018 08:33
If you do not provide your own keys to an array, it'll automaticly assign a zero-based index to them. Thought that was common knowledge?
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:33
uh..cert isnt a pdf
do i save that
or convert
Henry
@GitHub-Henry
Oct 12 2018 08:34
you can copy the image, i suppose
Manish Giri
@Manish-Giri
Oct 12 2018 08:34
how do you assign "own keys" to an array
Bjorn van de Peut
@bjorno43
Oct 12 2018 08:34
["key" => "value"]
Anand Potukuchi
@anandpotukchi
Oct 12 2018 08:34
I just took a screens hot
I just took a screenshot
Manish Giri
@Manish-Giri
Oct 12 2018 08:35
idk what that is
Aditya
@ezioda004
Oct 12 2018 08:35

@eunicode Ah found it

If the only argument passed to the Array constructor is an integer between 0 and 232-1 (inclusive), this returns a new JavaScript array with its length property set to that number (Note: this implies an array of arrayLength empty slots, not slots with actual undefined values). If the argument is any other number, a RangeError exception is thrown.

So its just an object with length property, the .key() method is what adds property and value to it

Manish Giri
@Manish-Giri
Oct 12 2018 08:35
doesn't look like an array
Bjorn van de Peut
@bjorno43
Oct 12 2018 08:37
@bobsbotty
["key1" => "value1", "key2" => "value2"]
bobsbotty
@bobsbotty
Oct 12 2018 08:37
@bjorno43 There was an error with your Javascript code:
V8Js::compileString():2: SyntaxError: Unexpected string
Manish Giri
@Manish-Giri
Oct 12 2018 08:38
that looks like an object, except the { }
Bjorn van de Peut
@bjorno43
Oct 12 2018 08:39
Ah, appearently JS can't do it like that
Manish Giri
@Manish-Giri
Oct 12 2018 08:39
dude you're confusing me all the more
js does it as it is
psyperl
@psyperl
Oct 12 2018 08:40
@bobsbotty
[key1 => "value1", key2 => "value2"]
Bjorn van de Peut
@bjorno43
Oct 12 2018 08:40
@bobsbotty
var arr = new Array();'
arr['name'] = 'oscar';

arr;
psyperl
@psyperl
Oct 12 2018 08:40
KO-ed
Bjorn van de Peut
@bjorno43
Oct 12 2018 08:41
pff
@bobsbotty
var arr = new Array();'
arr['name'] = 'oscar';

arr;
Aditya
@ezioda004
Oct 12 2018 08:41
That a rebelling bot
Bjorn van de Peut
@bjorno43
Oct 12 2018 08:41
The hell is wrong with that thing?
Aditya
@ezioda004
Oct 12 2018 08:41
Smack it
Bjorn van de Peut
@bjorno43
Oct 12 2018 08:41
@bobsbotty help
bobsbotty
@bobsbotty
Oct 12 2018 08:41
@bjorno43 Available functions:
  • Parse Javascript code and output result (command: help javascript)
  • Do Javascript challenges (command: help challenges)
Bjorn van de Peut
@bjorno43
Oct 12 2018 08:41
@bobsbotty
var arr = new Array();
arr['name'] = 'oscar';

arr;
bobsbotty
@bobsbotty
Oct 12 2018 08:41
@bjorno43 The result of your Javascript code is:
Array
(
    [name] => oscar
)
Bjorn van de Peut
@bjorno43
Oct 12 2018 08:42
There we go
psyperl
@psyperl
Oct 12 2018 08:42
@bobsbotty
[key1 => "value1", key2 => "value2"]
bobsbotty
@bobsbotty
Oct 12 2018 08:42
@psyperl The result of your Javascript code is:
Array
(
    [0] => V8Function Object
        (
        )

    [1] => V8Function Object
        (
        )

)
alpox
@alpox
Oct 12 2018 08:42
@bjorno43 This should better not be done in js :D even though it can be done
Bjorn van de Peut
@bjorno43
Oct 12 2018 08:43
@alpox Why not? JS doesn't like using your own keys in arrays?
Eunice Park
@eunicode
Oct 12 2018 08:44
@ezioda004 It took me a while, but I think I understand what you're saying.
So "empty slots" are different from regular values, in that they don't have the index keys.
But then when you use the keys() method, JS will assign index keys to them?
Bjorn van de Peut
@bjorno43
Oct 12 2018 08:46
I mean, obviously you pretty much mess up any for loop on an array with your own keys, but asside from that..
alpox
@alpox
Oct 12 2018 08:46
@bjorno43 Thats what plain js objects are for. Arrays are made to hold only zero-based number indices. Adding keyed values to an array is about the same as adding keyed values to a function:
function foo() {}
foo['name'] = 'hello';
Aditya
@ezioda004
Oct 12 2018 08:46

@eunicode Yeah, empty slots are empty slots (not undefined),

The keys() method returns a new Array Iterator object that contains the keys for each index in the array.

Its creates a new iterator object from the length

alpox
@alpox
Oct 12 2018 08:48
@bjorno43 And yes, messing up loops is about the main reason why this should be avoided... I'd only ever use it for some metadata but never had a case where that would be needed
Bjorn van de Peut
@bjorno43
Oct 12 2018 08:48
@alpox Makes sense. Though I know other languages have no issues with it
Aditya
@ezioda004
Oct 12 2018 08:48
@bjorno43 I guess one of the main reason you shouldnt, because the property added that way wont have @@iterator property to it
Eunice Park
@eunicode
Oct 12 2018 08:48
@ezioda004 Woah, cool beans :thumbsup: learned something new about the keys() method.
alpox
@alpox
Oct 12 2018 08:49
@bjorno43 PHP is about the only language which has no issues with it
Aditya
@ezioda004
Oct 12 2018 08:49
Thats bob's whole universe
Bjorn van de Peut
@bjorno43
Oct 12 2018 08:49
@alpox I didn't want to say it..
:joy:
alpox
@alpox
Oct 12 2018 08:49
@bjorno43 No need to say it, I knew it :P
Aditya
@ezioda004
Oct 12 2018 08:49
@eunicode No problem, I learned something aswell :D
Eunice Park
@eunicode
Oct 12 2018 08:50
@ezioda004 well, thanks again for always helping me, and others, too :)
Bjorn van de Peut
@bjorno43
Oct 12 2018 08:50
I guess PHP spoiled me. A language that does what I want and doesn't care about conventions etc :innocent:
alpox
@alpox
Oct 12 2018 08:51
@bjorno43 Then you want weird things :laughing:
Bjorn van de Peut
@bjorno43
Oct 12 2018 08:51
@alpox You have no idea..
Aditya
@ezioda004
Oct 12 2018 08:53
@alpox Adding property to function has its use case though, the static field in classes utilize this I believe
function foo() {}
foo['name'] = 'hello';
//same as
class foo{
  static name = 'hello'
}
Bjorn van de Peut
@bjorno43
Oct 12 2018 08:54

Though it's true that even if you use your own key in PHP, using a zero-index instead will still work just fine. Like if you do:

$arr = array('key' => 'value');

Both of these will work:

$arr['key'];
$arr[0];

Guess that's why PHP has no issues with it

alpox
@alpox
Oct 12 2018 08:54
@ezioda004 True, its a bit more useful for functions even
Bjorn van de Peut
@bjorno43
Oct 12 2018 08:57
Ah well. Adding it to my JS list of "Just because you can, doesn't mean should" functions
Same as :innocent:
var num = 3;    
window["foo"+num] = "foobar";
Aditya
@ezioda004
Oct 12 2018 08:59
@bjorno43 Lol thats funny, I read this article about how some library called moo tools prevented adding Array.flatten()to JS
They had to change the name to Array.flat() because adding that method would break the web
Bjorn van de Peut
@bjorno43
Oct 12 2018 09:00
@ezioda004 Whaha ye just reading it :joy:
alpox
@alpox
Oct 12 2018 09:02
@ezioda004 That are the idiots because of which I have to write a new flatten utiltity in any of my projects!
alpox
@alpox
Oct 12 2018 09:06
@GitHub-Henry Still experimental
And no support in edge :/
Henry
@GitHub-Henry
Oct 12 2018 09:07
just fyi
Aditya
@ezioda004
Oct 12 2018 09:08
Its a stage 3 proposal, would probably be available in ES2019 (I hope)
May Kittens Devour Your Soul
@diomed
Oct 12 2018 09:10
is development of JS get things more easier to do, or more complicated?
Henry
@GitHub-Henry
Oct 12 2018 09:12
the more you add the more complicated it gets, but i think they add with the idea of making things 'better'
Aditya
@ezioda004
Oct 12 2018 09:13
Most of the stuff added is usually an abstraction layer over existing stuff, it makes dev life easier but you have to learn a new thing though
Henry
@GitHub-Henry
Oct 12 2018 09:13
i think that it applies to stuff like vs code, npm, node, etc.
especially when there is a make a change every month mentality these days
Anand Potukuchi
@anandpotukchi
Oct 12 2018 09:30
Have any of you noticed that your fcc protfolio doesn;t sepetae projects from challenges these days?
May Kittens Devour Your Soul
@diomed
Oct 12 2018 10:31
does anyone of you know why this page: https://s.codepen.io/diomed/debug/vRXaQN/bYrdyevbRmYA
comes only to it's half and doesn't wanna scroll down fully?
Aditya
@ezioda004
Oct 12 2018 10:44
Hmm something something Vue
May Kittens Devour Your Soul
@diomed
Oct 12 2018 10:48
face-screaming-in-fear_1f631.png
Nicolas Ramirez
@kamatheuska
Oct 12 2018 10:57
@diomed you have overflow: hidden all over the place haha
on your body, and your soul too, probably lol
it looks awesome, btw.
May Kittens Devour Your Soul
@diomed
Oct 12 2018 11:01
@kamatheuska yes, because creator of vuebar told me so:
to add Vuebar to whole page you need to set body overflow to hidden and wrap all content in another element.
Nicolas Ramirez
@kamatheuska
Oct 12 2018 11:27
you are using Bulma there too right?
hmm it looks like an interesting package. Always hated native scrollbars
Bjorn van de Peut
@bjorno43
Oct 12 2018 11:35
In the early days of the internet, browsers allowed you to change the layout of the native scrollbar. I believe Internet Explorer still allowes that (or at least was the last one that did allow it).
But since it's no longer allowed, the only solution is to have a body with 100% width / height and overflow hidden. That will prevent the browser scrollbar from ever showing up. After that you can just create your own scrollbar any way you like
Anand Potukuchi
@anandpotukchi
Oct 12 2018 11:45
anyone know the hex of the fcc header background
alpox
@alpox
Oct 12 2018 12:02
@anandpotukchi #006400
Anand Potukuchi
@anandpotukchi
Oct 12 2018 12:04
@alpox thnx
Anand Potukuchi
@anandpotukchi
Oct 12 2018 12:56
guys
how does this look
abraham anak agung
@padunk
Oct 12 2018 13:05
@anandpotukchi great work, but with smaller screen, your label is align to the right
Anand Potukuchi
@anandpotukchi
Oct 12 2018 13:43
Im trying to get images from unsplash but seems to have a problem
background: url("https://unsplash.com/photos/Vra_DPrrBlE");
hoping I haven't forgotten css
@padunk
any ideas
abraham anak agung
@padunk
Oct 12 2018 13:54
@anandpotukchi seems fine here, maybe your connection?
sorry didnt test your url, you copy the wrong url
Anand Potukuchi
@anandpotukchi
Oct 12 2018 14:01
@padunk oops
AK01993
@AK01993
Oct 12 2018 14:44
Thanks @X140hu4 got it!
psyperl
@psyperl
Oct 12 2018 14:56
hmm that must be a reply for a last year message?
May Kittens Devour Your Soul
@diomed
Oct 12 2018 15:11
bye Felicia!
psyperl
@psyperl
Oct 12 2018 15:38
that's what happen when the chat is too quiet.. people start loosing their mind
May Kittens Devour Your Soul
@diomed
Oct 12 2018 16:02
don't know about you, penguin, but I lost my mind long time ago
:penguin:
Aditya
@ezioda004
Oct 12 2018 16:05
:snowman: :sunny: :sweat_drops:
May Kittens Devour Your Soul
@diomed
Oct 12 2018 16:13
@ezioda004 what's that animal that looks like a cat wearing a mask?
Aditya
@ezioda004
Oct 12 2018 16:29
@diomed Um idk
Kyle Holm
@thekholm80
Oct 12 2018 16:33
raccoon?
aka trash panda?
May Kittens Devour Your Soul
@diomed
Oct 12 2018 16:34
correct :ballot_box_with_check:
trash panda FTW!!! :smiley_cat:
Aditya
@ezioda004
Oct 12 2018 16:37
Pfff ofcourse I knew that, I was testing if Kyle knows
Kyle Holm
@thekholm80
Oct 12 2018 16:37
i knew you knew, i just wanted to be a know-it-all
Aditya
@ezioda004
Oct 12 2018 16:39
I knew it!
my product landing page
May Kittens Devour Your Soul
@diomed
Oct 12 2018 16:48
damn, that's odd
Anand Potukuchi
@anandpotukchi
Oct 12 2018 16:48
what
Christopher McCormack
@cmccormack
Oct 12 2018 16:49
3
Anand Potukuchi
@anandpotukchi
Oct 12 2018 16:53
@cmccormack what
what 3
May Kittens Devour Your Soul
@diomed
Oct 12 2018 16:54
3 is odd
psyperl
@psyperl
Oct 12 2018 16:54
wew
May Kittens Devour Your Soul
@diomed
Oct 12 2018 16:54
Werld ef Wercraft
Anand Potukuchi
@anandpotukchi
Oct 12 2018 16:55
what is 3
where 3
May Kittens Devour Your Soul
@diomed
Oct 12 2018 16:56
:3
Aditya
@ezioda004
Oct 12 2018 16:56
:triangular_ruler:
May Kittens Devour Your Soul
@diomed
Oct 12 2018 16:56
<3
Anand Potukuchi
@anandpotukchi
Oct 12 2018 16:56
oh WoW
May Kittens Devour Your Soul
@diomed
Oct 12 2018 16:58
boy is that video unresponsive or what
Anand Potukuchi
@anandpotukchi
Oct 12 2018 18:30
@diomed @ezioda004 @psyperl @cmccormack @thekholm80
Please give me your opinion, do I can post in forums
Aditya
@ezioda004
Oct 12 2018 18:32
Button could use some love, could also add smooth scrolling
Anand Potukuchi
@anandpotukchi
Oct 12 2018 18:35
*so that
May Kittens Devour Your Soul
@diomed
Oct 12 2018 18:40
@anandpotukchi select looks strange. would be better if there was some button actually
then that video ain't responsive @ all
why is your navigation like that - did you intend it to not have full width when scrolling down?
Anand Potukuchi
@anandpotukchi
Oct 12 2018 18:41
Yeah
Need to change that
May Kittens Devour Your Soul
@diomed
Oct 12 2018 18:42
stop using that stupid Lobster font
Aditya
@ezioda004
Oct 12 2018 18:42
@thekholm80 Have you done drum machine?
Kyle Holm
@thekholm80
Oct 12 2018 18:42
yessir
Aditya
@ezioda004
Oct 12 2018 18:43
How do you find any particular element after getting the keypress? I cant think of React way of doing except using native selector methods
May Kittens Devour Your Soul
@diomed
Oct 12 2018 18:44
Kyle Holm
@thekholm80
Oct 12 2018 18:45
@ezioda004 i didn't
Aditya
@ezioda004
Oct 12 2018 18:46
@thekholm80 Then how did you do it?
May Kittens Devour Your Soul
@diomed
Oct 12 2018 18:46
@thekholm80 you missed cooking class this morning, with @Manish-Giri
Kyle Holm
@thekholm80
Oct 12 2018 18:46
looking through my code real quick
@ezioda004 this bit did the heavy lifting:
  componentDidMount() {
    document.addEventListener('keypress', event => {
      const regex = RegExp(this.props.trigger, 'i');
      if (regex.test(event.key)) {
        this.playSound();
      };
    });
  }

  playSound() {
    const sound = new Audio(this.props.url);
    sound.play();
    this.props.updateDisplay(this.props.label);
  }

  handleClick(event) {
    this.playSound();
  }
Aditya
@ezioda004
Oct 12 2018 18:47
Did you render <Audio> element?
Kyle Holm
@thekholm80
Oct 12 2018 18:47
with
const triggers = [
    {
      key: 'Q',
      url: 'https://s3.amazonaws.com/freecodecamp/drums/Heater-1.mp3',
      label: 'Heater 1'
    },
    ...
  ]
i did
<div
        className='drum-pad'
        id={ this.props.label }
        onClick={ this.handleClick }
      >
        { this.props.trigger }
        <audio
          src={ this.props.url }
          className='clip'
          id={ this.props.trigger }
        />
      </div>
that's easier lol
Aditya
@ezioda004
Oct 12 2018 18:49
But then you're making the Audio instance too!
Kyle Holm
@thekholm80
Oct 12 2018 18:49
the audio element is only there for the tests though
Aditya
@ezioda004
Oct 12 2018 18:49
Hmm, I feel like thats duplicate but certainly easier
Kyle Holm
@thekholm80
Oct 12 2018 18:49
i dislike their tests for this so i made it pass but didn't utilize their enforced method
react refs are dumb and i felt dumb using them
Christopher McCormack
@cmccormack
Oct 12 2018 18:50
@thekholm80 I agree
I used ref as well
I had another very reacty way of doing it but then the tests wouldn't pass
Aditya
@ezioda004
Oct 12 2018 18:51
@cmccormack How? I'm thinking of doing with ref aswell but would have to make 9 refs right?
Oh I could make a ref on the parent container and then traverse and find the audio tag
Christopher McCormack
@cmccormack
Oct 12 2018 18:54
@ezioda004 do you mean logically or actually write 9 refs?
:)
oh great it no longer passes the tests...
Kyle Holm
@thekholm80
Oct 12 2018 18:56
rip
borked
Aditya
@ezioda004
Oct 12 2018 18:57
@cmccormack No way I was gonna write all that lol and your app looks good!
@thekholm80 I like how the first 3 tiles of your app are barely visible, very minimalist
Kyle Holm
@thekholm80
Oct 12 2018 18:58
i was really going for a 'i hate building front ends' kind of vibe
the 1.0 was just a row of letters
Christopher McCormack
@cmccormack
Oct 12 2018 18:58
@ezioda004 the first 3 tiles?
Aditya
@ezioda004
Oct 12 2018 18:59
@cmccormack Of Kyles app
@thekholm80 I could tell
Christopher McCormack
@cmccormack
Oct 12 2018 18:59
ohh duh
Christopher McCormack
@cmccormack
Oct 12 2018 19:21
@thekholm80 why is it our code is so similar but my keypresses lag compared to yours
Kyle Holm
@thekholm80
Oct 12 2018 19:22
oh the things i've typed and deleted
Christopher McCormack
@cmccormack
Oct 12 2018 19:22
haha
Kyle Holm
@thekholm80
Oct 12 2018 19:22
how many event handlers do you have?
oh guess i could just look
it looks like you're mounting a separate event handler for every pad?
Christopher McCormack
@cmccormack
Oct 12 2018 19:24
yeah
Kyle Holm
@thekholm80
Oct 12 2018 19:24
if i remember right that creates a lot of overhead
you'll have to run through every handler even after the one you want fires
Christopher McCormack
@cmccormack
Oct 12 2018 19:26
ohh
that makes sense
doesn't explain why this used to pass but now doesn't but maybe I can clean that up at least
thanks
Doesn't yours do that too?
Kyle Holm
@thekholm80
Oct 12 2018 19:27
lemme look at mine again lol
oh you're right
well there goes that theory
Aditya
@ezioda004
Oct 12 2018 19:29
@thekholm80 @cmccormack I solved with 1 ref on the parent
 playSound(code){ //keycode from keyDown event
      [...this.myRef.current.children].forEach(pad => pad.id == code ? pad.children[0].play() : null);
  }
Kyle Holm
@thekholm80
Oct 12 2018 19:30
oww my eyes
Aditya
@ezioda004
Oct 12 2018 19:30
Its nice lil code
Christopher McCormack
@cmccormack
Oct 12 2018 19:31
no context makes this a bit confusing
Kyle Holm
@thekholm80
Oct 12 2018 19:32
@cmccormack you've got a setState() in your playAudio method. i wonder if react is batching those state updates when i spam a single key, making it seem like laggy behavior
Christopher McCormack
@cmccormack
Oct 12 2018 19:32
@thekholm80 nah I killed that to test and same behavior
Kyle Holm
@thekholm80
Oct 12 2018 19:32
err there's 2 setStates()
one with a timeout
Christopher McCormack
@cmccormack
Oct 12 2018 19:32
@thekholm80 and you have one in yours too
Kyle Holm
@thekholm80
Oct 12 2018 19:33
well i give up
maybe react likes me better
Christopher McCormack
@cmccormack
Oct 12 2018 19:33
me too!
haha
oh figured it out...

in your play audio:

    const sound = new Audio(this.props.url);
    sound.play();

in my play audio

this.audioRef.current.play()
apparently mine was laggy
Kyle Holm
@thekholm80
Oct 12 2018 19:35
interesting
Christopher McCormack
@cmccormack
Oct 12 2018 19:36
seems weird
why is a ref causing lag, should be an Audio element right? shouldn't even be changing
and the other way creates a new Audio element every time
Kyle Holm
@thekholm80
Oct 12 2018 19:38
i don't know how react refs work ... does it store information on how to find the dom element (ie lookup the element every time the ref is used) or store a copy and update the copy as needed?
Christopher McCormack
@cmccormack
Oct 12 2018 19:38
Maybe because this?
yeah not sure
I'm going to try the new method for refs
hmm maybe this isn't a bug at all
maybe it's because if the audio attribute is being referenced, it plays the whole mp3 and doesn't let you play again unless you force it to rewind
in your you basically create a new Audio instance each click so there can be overlap
Kyle Holm
@thekholm80
Oct 12 2018 19:43
could be
let's see how aditya's behaves
Christopher McCormack
@cmccormack
Oct 12 2018 19:44
yup that's it
    this.props.handlePlayed(this.props.id)
    this.audioRef.current.currentTime = 0
    this.audioRef.current.play()
What's dumb is I already knew that, implemented it before in other things haha
Henry
@GitHub-Henry
Oct 12 2018 20:01
@ezioda004 i did bubble event then used captured elements
just another way
didn't make an audio, just used what was captured, since i had an audio element because of requirements
Aditya
@ezioda004
Oct 12 2018 20:05
@GitHub-Henry So you used native method? Like getElementById() or something?
Henry
@GitHub-Henry
Oct 12 2018 20:06
queryselect
i like it because it returns an iterable
Aditya
@ezioda004
Oct 12 2018 20:06
Well yeah thats an option but I dont want to use that, its not very React-y way
Henry
@GitHub-Henry
Oct 12 2018 20:07
i'm a new comer to react. i used react, so perhaps it wasn't the most react way of doing it
Aditya
@ezioda004
Oct 12 2018 20:10
Its fine I guess, fcc also did the same way
Christopher McCormack
@cmccormack
Oct 12 2018 20:12
yeah but that doesn't make it right :)
@ezioda004 yours passing yet?
Aditya
@ezioda004
Oct 12 2018 20:18
@cmccormack Tests?
Christopher McCormack
@cmccormack
Oct 12 2018 20:19
yeah
Henry
@GitHub-Henry
Oct 12 2018 20:19
8 tests
Aditya
@ezioda004
Oct 12 2018 20:19
Yeah, just need to add some styles and I'll be done
Manish Giri
@Manish-Giri
Oct 12 2018 20:21
has anyone bought the new wes bos course yet
May Kittens Devour Your Soul
@diomed
Oct 12 2018 20:21
what is he boss of now?
Manish Giri
@Manish-Giri
Oct 12 2018 20:22
overpricing courses
:smirk_cat:
May Kittens Devour Your Soul
@diomed
Oct 12 2018 20:23
@Manish-Giri send me the mony I'll send you courses :)
Kyle Holm
@thekholm80
Oct 12 2018 20:23
i refuse
May Kittens Devour Your Soul
@diomed
Oct 12 2018 20:23
he supports PPP, I can get them cheaper
Kyle Holm
@thekholm80
Oct 12 2018 20:24
@diomed x
Manish Giri
@Manish-Giri
Oct 12 2018 20:25
john cena vs cat
May Kittens Devour Your Soul
@diomed
Oct 12 2018 20:26
what is that site where they put music over gifs?
@thekholm80 I'm so lit :cat:
Kyle Holm
@thekholm80
Oct 12 2018 20:27
that's horrifying
Manish Giri
@Manish-Giri
Oct 12 2018 20:35
@thekholm80 @diomed x
Kyle Holm
@thekholm80
Oct 12 2018 20:38
well that's enough internet for me for today
May Kittens Devour Your Soul
@diomed
Oct 12 2018 20:38
pft . amateur
Henry
@GitHub-Henry
Oct 12 2018 20:38
never thought about mass transportation and bed bugs
May Kittens Devour Your Soul
@diomed
Oct 12 2018 20:38
yeah. like where are the beds? I mean, come on
#fake news
now this is news to me
Manish Giri
@Manish-Giri
Oct 12 2018 20:45
most buses in my area have seats just like that
i never stopped to think there might be bed bugs there
gotta stop using buses
Henry
@GitHub-Henry
Oct 12 2018 20:46
it applies to any mass transport
May Kittens Devour Your Soul
@diomed
Oct 12 2018 20:46
use helicopter instead
Christopher McCormack
@cmccormack
Oct 12 2018 20:49
@ezioda004 is your test #6 passing?
Aditya
@ezioda004
Oct 12 2018 20:50
@cmccormack Yes
Christopher McCormack
@cmccormack
Oct 12 2018 20:51
Can you share? not sure why this used to pass but now doesn't for mine
Aditya
@ezioda004
Oct 12 2018 20:52
class Kit extends Component {
  constructor(props) {
    super(props);
    this.state = {
      name: ""
    };
    this.myRef = React.createRef();
  }
  componentWillReceiveProps(nextProps) {
    this.playSound(nextProps.keyPress.toUpperCase());
  }
  playSound(code) {
    [...this.myRef.current.children].forEach(pad => {
      let audio = pad.children[0];
      if (audio && audio.id === code) {
        this.setState({
          name: pad.id
        });
        audio.currentTime = 0;
        audio.play();
      }
    });
  }
  clickHandler = e => {
    this.playSound(e.target.children[0].id);
  };
  render() {
    let drumPads = sounds.map((pad, i) => (
      <div key={i} id={pad.id} className="drum-pad" onClick={this.clickHandler}>
        <audio className="clip" id={pad.key} src={pad.sound} />
        {pad.key}
      </div>
    ));
    return (
      <div id="drum-machine" ref={this.myRef}>
        {drumPads}
        <Display name  = {this.state.name}/>
      </div>
    );
  }
}
soundsis just an array with audio, keycode etc
And nextProps is getting the keycode of the keypressed from parent component
crorodriguezro
@crorodriguezro
Oct 12 2018 20:57
Hi. I’ve been trying to change the visual language of of freecodecamp without success
Do you know how can I achieve this?
May Kittens Devour Your Soul
@diomed
Oct 12 2018 20:58
das wahst tu gemach? @crorodriguezro
Aditya
@ezioda004
Oct 12 2018 20:59
I know I shouldnt use componentWillReceiveProps anymore but I'm too lazy to learn the new lifecycle methods
Kyle Holm
@thekholm80
Oct 12 2018 21:00
i hate learning a new api every few months
so annoying
Manish Giri
@Manish-Giri
Oct 12 2018 21:00
isn't that what JS is all about
every month a new Angular major release
Henry
@GitHub-Henry
Oct 12 2018 21:01
yeah didn't, JS announced they want to be like MS with a new release about every month
Aditya
@ezioda004
Oct 12 2018 21:01
Learning new API is fine but having what you've learned deprecated sucks
crorodriguezro
@crorodriguezro
Oct 12 2018 21:01
I don’t speak German May Kittens
Manish Giri
@Manish-Giri
Oct 12 2018 21:02
JS - deprecated
new - BS
Christopher McCormack
@cmccormack
Oct 12 2018 21:04
@ezioda004 I simulated yours and it still failed (might have missed something) - which testing library you using?
May Kittens Devour Your Soul
@diomed
Oct 12 2018 21:05
I simulated failing and I stil failed
alpox
@alpox
Oct 12 2018 21:05
@cmccormack This doesn't do something when I press q :D
May Kittens Devour Your Soul
@diomed
Oct 12 2018 21:06
why is noone ever talking about best library here, anymore
jQuery why have they forsaken thee?
this is the best library
Henry
@GitHub-Henry
Oct 12 2018 21:07
amazing how many like that project
Aditya
@ezioda004
Oct 12 2018 21:07
@cmccormack It was missing the App component, heres the fixed one
Henry
@GitHub-Henry
Oct 12 2018 21:07
i like comments like, won't compile
Manish Giri
@Manish-Giri
Oct 12 2018 21:08
By running the following command you can deploy your application absolutely nowhere.
:fire:
Henry
@GitHub-Henry
Oct 12 2018 21:08
creative stuff
alpox
@alpox
Oct 12 2018 21:09
@ezioda004 That passes for me
Aditya
@ezioda004
Oct 12 2018 21:09
Yep
Christopher McCormack
@cmccormack
Oct 12 2018 21:11
Thanks, had to guess at some of it @ezioda004 :)
Sultan
@Sultan2790
Oct 12 2018 21:11
Hello people how are u ?
Aditya
@ezioda004
Oct 12 2018 21:12
@cmccormack No problem, sorry didnt give the full code before
May Kittens Devour Your Soul
@diomed
Oct 12 2018 21:13
Apostle is out, if there is anyone interested
Christopher McCormack
@cmccormack
Oct 12 2018 21:13
@ezioda004 Interesting I think speed is the key, that test runs at about 850ms on your app, but the test has this.timeout(900); which I assume means it will fail after 900ms
Sultan
@Sultan2790
Oct 12 2018 21:13
I am running out of projects ! I have been wanting to create websites but I have no idea where to start !
Henry
@GitHub-Henry
Oct 12 2018 21:13
fcc has 30 you can do
May Kittens Devour Your Soul
@diomed
Oct 12 2018 21:13
@Sultan2790 what do you use to create websites?
Sultan
@Sultan2790
Oct 12 2018 21:13
I am a recent graduate so since I am out of school I really have no clue how to start on my own
@diomed PHP or JS ! or Ruby n rails
Henry
@GitHub-Henry
Oct 12 2018 21:14
@Sultan2790 a place to start https://learn.freecodecamp.org
Sultan
@Sultan2790
Oct 12 2018 21:15
@GitHub-Henry I know this website I have finished these challenges like second year of college
Henry
@GitHub-Henry
Oct 12 2018 21:15
it's all new
Aditya
@ezioda004
Oct 12 2018 21:16
@cmccormack Oh interesting, didnt know performance should also be taken into account. For reference the fcc completes test around 800ms as well
May Kittens Devour Your Soul
@diomed
Oct 12 2018 21:16
@Sultan2790 but what technologies do you use?
Aditya
@ezioda004
Oct 12 2018 21:17
I think I can make it faster, .forEach() is unnecessary, could use for loop and to stop the iteration when the key is found
Sultan
@Sultan2790
Oct 12 2018 21:17
I have created projects using PHP, JS, Simple HTML Css, small react applications, xcode , android studio, ruby n rails
May Kittens Devour Your Soul
@diomed
Oct 12 2018 21:17
@cmccormack seamless experience
Christopher McCormack
@cmccormack
Oct 12 2018 21:19
@ezioda004 I wasn't aware it was; I changed nothing in my code when I first checked it today and it failed, I wonder if they changed the test suite at all and left the same version number
May Kittens Devour Your Soul
@diomed
Oct 12 2018 21:19
@Sultan2790 laravel or smth?
Sultan
@Sultan2790
Oct 12 2018 21:19
@diomed I never did use any of these
May Kittens Devour Your Soul
@diomed
Oct 12 2018 21:20
nvm
Aditya
@ezioda004
Oct 12 2018 21:20
@cmccormack Is anyone else facing the same issue as you? I guess we can check the main repository, if they've made new commit
Christopher McCormack
@cmccormack
Oct 12 2018 21:21
I believe someone said they did as well above but I was having trouble finding it
and not sure if @thekholm80 's was working fine before either
May Kittens Devour Your Soul
@diomed
Oct 12 2018 21:21
@Sultan2790 ever used some static content generator?
Sultan
@Sultan2790
Oct 12 2018 21:23
@diomed No does Laravel do that ?
May Kittens Devour Your Soul
@diomed
Oct 12 2018 21:23
@Sultan2790 what CSS library?
Kyle Holm
@thekholm80
Oct 12 2018 21:23
@cmccormack mine passed all the tests when i finished it
Sultan
@Sultan2790
Oct 12 2018 21:23
@diomed Plain CSS or Bootstrap
May Kittens Devour Your Soul
@diomed
Oct 12 2018 21:24
@thekholm80 sđest me sm colr for dis
Aditya
@ezioda004
Oct 12 2018 21:24
@cmccormack Looks like they did update a months ago
May Kittens Devour Your Soul
@diomed
Oct 12 2018 21:24
@Sultan2790 I hoped you know bulma :stuck_out_tongue:
Aditya
@ezioda004
Oct 12 2018 21:25
Hmm, the last commit is just name changes as far as I can see
Christopher McCormack
@cmccormack
Oct 12 2018 21:26
yeah but the few before it are pretty big changes
May Kittens Devour Your Soul
@diomed
Oct 12 2018 21:27
heck, yes! Font Awesome now has axe!
Aditya
@ezioda004
Oct 12 2018 21:27
In that case mystery solved, next case!
Christopher McCormack
@cmccormack
Oct 12 2018 21:27
Strange they would update their CDN version in place
I am assuming that's what they did
Aditya
@ezioda004
Oct 12 2018 21:28
Maybe somebody forgot to update the version
Time to fire who made the commit
Christopher McCormack
@cmccormack
Oct 12 2018 21:28
@diomed I use RPG Awesome for that
do you think the bundle is built from these files?
Aditya
@ezioda004
Oct 12 2018 21:29
It has to be
May Kittens Devour Your Soul
@diomed
Oct 12 2018 21:39
@cmccormack damn, I should switch
Christopher McCormack
@cmccormack
Oct 12 2018 21:39
@diomed yeah!
Aditya
@ezioda004
Oct 12 2018 21:41
@thekholm80 coincidence?
Henry
@GitHub-Henry
Oct 12 2018 21:43
sooo, for the good of the planet, gotta get rid of JS?
seems to cause more problems than global warming
May Kittens Devour Your Soul
@diomed
Oct 12 2018 21:43
coincidence?
  • I THINK NOT!
Aditya
@ezioda004
Oct 12 2018 21:44
I'm sure theres an npm package to get rid of JS
Bjorn van de Peut
@bjorno43
Oct 12 2018 21:45
Evening :wave:
Henry
@GitHub-Henry
Oct 12 2018 21:46
:wave:
Kyle Holm
@thekholm80
Oct 12 2018 22:07
@ezioda004 i think you might be on to something
Bjorn van de Peut
@bjorno43
Oct 12 2018 22:29
I seriously would want this guy as my roommate :joy:
Henry
@GitHub-Henry
Oct 12 2018 22:35
lol
Bjorn van de Peut
@bjorno43
Oct 12 2018 22:43
That guy is just brilliant. He's got several vids on how he deals with spam mail and stuff like that. Just genius :joy:
Nicolas Ramirez
@kamatheuska
Oct 12 2018 22:45
quick question: what I am doing wrong here? Test for this Redux challenge
aren't passing!
const INCREMENT = 'INCREMENT';
const DECREMENT = 'DECREMENT';

const counterReducer = (state = 0, action) => {
  switch (action.type) {
    case INCREMENT:
      return Object.assign({}, {
        state: state + 1
      });
      break;
    case DECREMENT:
      return Object.assign({}, {
        state: state - 1
      });
      break;
    default:
      return state;
  }
}
function incAction () {
  return {
    type: INCREMENT,
    count: 0
  }
}

function decAction () {
  return {
    type: DECREMENT,
    count: 0
  }
}

const store = Redux.createStore(counterReducer)
From the logs:
Dispatching incAction on the Redux store should increment the state by 1.
Dispatching decAction on the Redux store should decrement the state by 1.
Bjorn van de Peut
@bjorno43
Oct 12 2018 22:49
@kamatheuska Don't know anything about that, but I do notice you're counting +1 on both INCREMENT and DECREMENT
Aditya
@ezioda004
Oct 12 2018 22:49

@kamatheuska After first increment/decrement, state will be an object, so

Object.assign({}, {
        state: state + 1
      });

state here is referring to an object and you're adding a number to it.

Nicolas Ramirez
@kamatheuska
Oct 12 2018 22:50
@bjorno43 oh my bad
same results :(
is late and I am half drunk, sorry
@ezioda004 oh
yeah, let me correct that
yep, that was it
thanks!
Aditya
@ezioda004
Oct 12 2018 22:52
:thumbsup:
Zane Burk
@zaneburk_twitter
Oct 12 2018 23:04
Hey all. I'm trying to make the input of these radio buttons required, but for whatever reason, I'm messing something up. Please let me know what I'm doing wrong:
<div id="yellowoption"> <label> <input id="yellow" type="radio" name="fav-color" required>Yellow </label></div>
<div id="blueoption"> <label> <input id="blue" type="radio" name="fav-color" required>Blue </label></div>
<div id="greenoption"> <label> <input id="green" type="radio" name="fav-color" required>Green </label></div>
<div id="redoption"> <label> <input id="red" type="radio" name="fav-color" required>Red </label></div>
Aditya
@ezioda004
Oct 12 2018 23:09
That looks fine - unless I'm missing something
Senkies
@Sensking
Oct 12 2018 23:11
help
Zane Burk
@zaneburk_twitter
Oct 12 2018 23:22
Nevermind, I got it figured out. I had to adjust my form element and action attributes but I worked it out. Thank you!
Bjorn van de Peut
@bjorno43
Oct 12 2018 23:22
@Sensking Should I be calling 911 or...? Perhaps something more than just "help", will help us help you