Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
  • 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
Stephen James
@YVeselovskyi You might need to use sort after filter. Putting exact first, then lower indexOf result next
Roman Struna
Hey everyone, I would love it if someone with a lot of experience would help me optimize this project :)
It works, but perhaps I complicated it a bit too much so I can apply the style it has ¯_(ツ)_/¯
@Marmiz So, it is just node.js trying to keep their way, that has nothing to with difference in es6 or es5?
anyone know ow to do this with JS?
Stephen James
@RomchyFCC One thing I would do is nest the channels getJSON in the streams getJSON callback.
Because you are subject to all sorts of out of order issues. Also, eliminate the
setTimeouts, they are also sensitive to network delays.
array = []
for each channel
     $getJSON for stream
          $getJSON for channel
               push data to array
               if (array.length == channels.length) process data from array // you have all the data
Roman Struna
wouldn't the code quit if the stream was offline then? stream is offline and the data is incomplete -> would never fire the call for channel if the channel was in the callback?
the problem is that i need the setTimeouts, because i need order, and if I omit the timeouts, the order gets mixed up and the design is ruined, this assignment would be super easy if i didn't care about order
Stephen James
@RomchyFCC You get the channel data for every channel already - regardless of online/offline
Roman Struna
that's true but the stream data is different than channel data, i need every channel data so i can display the channel info such as name and link
if i use stream data i don't get those 2
and the stream is offline, if the stream is online i get all the info
Stephen James
@RomchyFCC With the nest calls you have access to both stream and channel data for the same channel
@RomchyFCC And if you count responses then you don't have to use timers which are prone to error
Roman Struna
indeed but wouldn't it make more sense to nest stream JSON in channel JSON
Stephen James
@RomchyFCC Yes.
Roman Struna
actually no, i don't see any of these working, best bet would be if statement and error handling i assume..which i don't know how to do well, if stream data available use it if not use channel data, wouldn't that make the most sense?
actually nesting stream data would be fine too, about the same amount of calls
would have to try it and see how it orders things
Stephen James
@RomchyFCC If you nest them, then you will have all the data needed in the innermost response to process both stream and channel data.
And you order the data just like you do in the setTimeout.
Rohit kumar
I am working on freeCodeCamp redesign concept on my own. The first version will be complete until next week. It would be great if you review it. https://www.figma.com/file/cBad9b0LaMd1TM8Kcde7im1n/fcc https://www.figma.com/file/cBad9b0LaMd1TM8Kcde7im1n/fcc?node-id=26%3A2 https://www.figma.com/file/cBad9b0LaMd1TM8Kcde7im1n/fcc?node-id=15%3A4573
looks good @Rohitkrops
Roman Struna
i'll look into nesting them if i get any time off, will let you know how it goes, also, i didn't like the timeout sollution but nothing else i tried worked, thanks for the feedback @sjames1958gm i'll try to fix it asap
romchyfcc sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8971 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Stephen James
@RomchyFCC :+1:
Raghav Mundra
I am doing Pig Latin from intermediate code challenges. Can anyone please tell me what it wrong with this?
function translatePigLatin(str) {
  var temp;
  var cc;
  for (i = 0; i<str.length; i++){
    if (str[i] == ("a" | "e"| "i" | "o" | "u")){
      temp = i;
    var sub = str.substr(0,temp-1);
    var old = str.substr(temp);

    cc = old.concat(sub);

return cc; 
@Raghav17 Sorry, what is the goal for this exercise?
Raghav Mundra

Translate the provided string to pig latin.

Pig Latin takes the first consonant (or consonant cluster) of an English word, moves it to the end of the word and suffixes an "ay".

If a word begins with a vowel you just add "way" to the end.

I have not completed it and doing it in parts , I was trying to make the cononant move at the end but it isnt working
@Raghav17 try pushing letters to a new array until you hit a vowel
or string instead of array, sorry.
Raghav Mundra
Okay, i will try that.
Can anyone tell me why this isn't working please?

var centerX = mouseX;
var centerY = mouseY;
var bodyLength = 118;
var bodyHeight = 74;
var bodyColor = color(162, 0, 255);
var drawFish = function() {
    background(89, 216, 255);
    // body
    ellipse(centerX, centerY, bodyLength, bodyHeight);
    // tail
    var tailWidth = bodyLength/4;
    var tailHeight = bodyHeight/2;
    triangle(centerX-bodyLength/2, centerY,
         centerX-bodyLength/2-tailWidth, centerY-tailHeight,
         centerX-bodyLength/2-tailWidth, centerY+tailHeight);
    // eye
    fill(33, 33, 33);
    ellipse(centerX+bodyLength/4, centerY, bodyHeight/5, bodyHeight/5);
@MuhammedKarim what are you trying to get it to do?
and are you getting any errors when running it?
when i put it in the drawFish function like above it comes out blank canvas
I'm seeing a fish when I go to that link and putting the code into the editor
do you have ad blockers on?
Ian Gracia
Anyone keen to help me implement an OCR on codepen?
Stephen James
@MuhammedKarim When do you call drawFish? Looking at this code the centerX, centerY will be set once to some random mouse X.Y
@cjlynch12 ad blockers are off
@sjames1958gm yeah silly me, it works now lol i forgot to call the function!
Alan Price

hey guys, would anyone here mind running this in the latest chrome and tell me if the audio loops like it should or breaks after playing once (like it does for me)


Sweet Coding :)
@alanpaulprice Chrome v64 has that issue
Alan Price
ah right, is there any work around or do you think i should just wait until they sort it out?
Sweet Coding :)
As of now I have v63 and it's working for me
but I ran into similar issue on work machine that has v64
Alan Price
ah okay, thanks for clearing that up