Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
Harry Manchanda
@IamManchanda
@khaduch Can you explain ??
Ken Haduch
@khaduch
@IamManchanda - do you know the array method .filter()? if you write a line of code y.filter( val => console.log(val)); - it doesn't really make sense, but it should display each of the values in the array y. It shows that the .filter() iterates over each of the array elements, so you see each one individually. Then instead of console.log(val); you need to devise a method to test that the slug of each element is contained in the x array.
Mois├ęs Man
@moigithub
mdn.io/includes might help too
Ken Haduch
@khaduch
@moigithub - good suggestion - I forget about .includes()... :)
Gulsvi
@gulsvi
I think a for...in loop would make this simpler. No need for any ES6-specific methods
const z = [];
for (const key in y) {
  if (y[key].slug == x[key]) {
    z.push({ 
      name: y[key].slug.toUpperCase(), 
      slug: y[key].slug 
    });
  }
}
but I guess you could start playing around Object.entries() ?
Ken Haduch
@khaduch
filter and includes is a one-liner... and he asked for an ES6 way.
Harry Manchanda
@IamManchanda
hey guys
I solved it
Thanks for help @khaduch
Ken Haduch
@khaduch
@IamManchanda - you're welcome, and const z = y.filter( obj => x.includes(obj.slug) ); is what I came up with.
Harry Manchanda
@IamManchanda
oh i see :) ... that's better I guess ... let me try in my orignal code i am working on ... :)
oh yeah works the same :)
Gulsvi
@gulsvi
The one line from @khaduch will be faster than yours @IamManchanda because .includes() is quicker than .find(). The for...in loop I wrote above is faster than both.
Harry Manchanda
@IamManchanda
cool using that :)
Gulsvi
@gulsvi
But sometimes faster code means more lines :)
here, two lines lol
const z = [];
for (const key in y) if (y[key].slug == x[key]) z.push(y[key]);
Ken Haduch
@khaduch
@gulsvi - but your code only works if the alphabetical ordering of the x and y values is preserved? I guess that isn't stated in the "problem" - just going by the data as given, it works.
Gulsvi
@gulsvi
@khaduch Correct, could make a less efficient version if we can't guarantee x will be ordered as needed:
const z = [];
for (const key in y) if (x.includes(y[key].slug)) z.push(y[key]);
Esteban Borai
@estebanborai
@gulsvi are you looking for mapping the keys of an object?
Gulsvi
@gulsvi
Iam was looking more at filtering them into another array @estebanborai
Esteban Borai
@estebanborai
Object.keys({ foo: 'bar' });
Ken Haduch
@khaduch
@gulsvi - so how does the efficiency of your less efficient version compare to the .filter() method?
Gulsvi
@gulsvi
@khaduch I think it depends on the browser implementation of .filter() - in theory though a for loop + push would be similar to a .filter() at O(n). I don't know the auxiliary space complexity though - maybe uses more/less memory.
Esteban Borai
@estebanborai
Mmm
creator0323
@Amasian

Hello! I am currently working on FCC Twitch API project. I am trying to bring information of freecodecamp channel from Twitch server. I am using my own client ID i made for the purpose. But it seems that the server can not recognize my client ID. Is my URL format is wrong? Any advice will be appreciated :) thank you for your time and attention!

https://codepen.io/Amasian/pen/RyPeNx?editors=0010

Esteban Borai
@estebanborai
Like filter the keys of an object into another object but through object keys then filter then a new object with the filtered keys?
Esteban Borai
@estebanborai
@Amasian looks like you are not specifying the clientId
Maybe you should check the URL syntax
Michael S
@Ohshi60
In the "My Expertise" section, the font-awesome icons have a custom css rule "large-icon" that doesnt get applied. But in my local copy of the website it DOES work. Any pointers? https://codepen.io/ohshi/pen/vRPPmv
kyle-kauzlarich
@kyle-kauzlarich
@Ohshi60
adding .large-icon { font-size: 32px !important; got it running on codepen for me
creator0323
@Amasian
@estebanborai thank you for your reply!
Esteban Borai
@estebanborai
You welcome!
Michael S
@Ohshi60
@gulsvi Hmm, but that defeats the point of me having a large-icon class. And im still confused about why it works locally :smile:
Gulsvi
@gulsvi
@Ohshi60 My apologies, I should have looked closer. Codepen requires your <head> content to go in settings -> HTML -> stuff for <head>
Put all your <head> content in there and it will work the same as it does for you locally
Esteban Borai
@estebanborai
@Ohshi60 maybe is your FA version.
Michael S
@Ohshi60
@gulsvi That did it, and no need to apologize. I appreciate it.
Gulsvi
@gulsvi
Glad it helped!
Michael S
@Ohshi60
Last thing i want to fix is the horizontal scroll. I have wrapped my body in a container class, which i thought i did to prevent this issue?
Michael S
@Ohshi60
I found the issue, i have to wrap my rows in either container or container-fluid for it to work properly
roxxlen
@roxxlen
@keyframes slide-in-out{
  0%{
    transform: translateY(0);
    opacity: 1;
  }
  40%{
    transform: translateY(-50%);
    opacity: 1;
  }
  60%{
    transform: translateY(0);
    opacity: 1;
  }
  90%{
    transform: translateY(100%);
    opacity: 0;
  }
  100%{
    transform: translateY(200%);
    opacity: 0;
  }
}
what does it mean?
LydaTech
@lydatech
@roxxlen its a css animation
roxxlen
@roxxlen
[ spot ] [ down 50% ] [ spot ] [ bottom/transparent ] [ out of bundary/transparent ]
is that the routine ?