These are chat archives for FreeCodeCamp/Help

15th
Nov 2017
Ken Haduch
@khaduch
Nov 15 2017 00:00
@daddycardona - this is the blog post about it https://medium.com/p1xts-blog/lets-make-november-suck-less-at-css-month-7fa7c80b5387 and http://speedrunchallenge.com that is the link to the page. They are small and (in my opinion) difficult CSS-based challenges to create various animations. Crazy stuff, that CSS animation!
@daddycardona - what does all of your code look like for that .reduce() ? You have to put things into the array if you want them to be there, I think?
Albert Cardona II
@daddycardona
Nov 15 2017 00:01
function sym(args) {
    var argsArray = Array.prototype.slice.call(arguments);
    const flatten = function(xarr) {
        //console.log("input is " + xarr)
        if (!Array.isArray(xarr)) {
            return [xarr];
        }
        return xarr.reduce(function(a, b) {
            if (Array.isArray(a) && a.length === 0) {
                return flatten(b);
            }

            return flatten(a).concat(flatten(b));
        }, [])
    };

    let flat = flatten(argsArray);

    let al = flat.reduce((y, z) => {
        if (y === z) {
            return;
        } else {
            return z;
        }


    }, [])
    console.log(al)

}

sym([1, 2, 3], [5, 2, 1, 4]);
and I get just 4
I am trying to finish this symetric value and I feel if I just flatten out the arguments and see what is not equal to to something now I am seeing maybe I need a function in this reduce function to work dammit
Ken Haduch
@khaduch
Nov 15 2017 00:05

@daddycardona - they have an example of doing that on the documentation page:

var flattened = [[0, 1], [2, 3], [4, 5]].reduce(
  function(a, b) {
    return a.concat(b);
  },
  []
);
// flattened is [0, 1, 2, 3, 4, 5]

So the accumulator variable a is used and the new array in the variable b is concatenated to it, and a is returned. You need to use a and add something to it and return it. Then you are accumulating new data in that array.

Dylan
@dhcodes
Nov 15 2017 00:06
was looking at the same thing @khaduch
lol
Ken Haduch
@khaduch
Nov 15 2017 00:07
@dhcodes :+1: :)
Albert Cardona II
@daddycardona
Nov 15 2017 00:07
yeah mine works well because I have 2 arrays so i flatten the whole thing so that works with no problem it is the second reduce part or are you showing me this would work too?
like this would complete the challenge?
btw this was my flatten code for the steam roller challenge @khaduch
so it worked just in case they had [1,[2]], etc.. lol
Ken Haduch
@khaduch
Nov 15 2017 00:10
@daddycardona - the second part, where you just do return; will make your accumulator value be undefined, I think? If it hits that condition.
Moisés Man
@moigithub
Nov 15 2017 00:10
function somePromise(){
  return new Promise((resolve, reject)=>{
     resolve("boooooooo");
  })
}


async function doAsyncStuff(){ 
   let resultOfPromise = await somePromise();
   console.log(resultOfPromise);
}

doAsyncStuff();
@dhcodes
Albert Cardona II
@daddycardona
Nov 15 2017 00:11
@khaduch I am thinking the same thing and that is what confuses me because I don't want it to return anything if it is equal lol but if I don't return anything like you said it is undefine
Ken Haduch
@khaduch
Nov 15 2017 00:14
@daddycardona - in the second .reduce(), y is initially going to be the empty array. So you either want to add a value to it, and return it, or you don't want to add a value to it, and still return it. Other wise you lose what you accumulated up to that point. You might want to use something like .indexOf and test to see if you already have the value that is coming in stored in the array, so you don't store a duplicate?
Albert Cardona II
@daddycardona
Nov 15 2017 00:14
I want to understand this so bad but when I was reading the article from the hints section, it basically gave the answer however the answer was just as confusing as the problem to me so I am tryign to figure it out with out their version of the answer lol
oh yeah is that is a good point @khaduch
Moisés Man
@moigithub
Nov 15 2017 00:16
function getData(){
  return fetch('https://jsonplaceholder.typicode.com/users')
                     .then(res=>res.json());
}
async function stuff(){ 
   let resultOfPromise = await getData();   // treat stuff like sync
   console.log(resultOfPromise); /// access data of promise call
}
stuff();
@dhcodes
Code School is free for this weekend
Albert Cardona II
@daddycardona
Nov 15 2017 00:30
@khaduch why would I use indexof? maybe i am confuse?
Hammad
@newnewb
Nov 15 2017 00:32
@daddycardona just a heads up for when you get to the challenge, got 2 more issues that I solved regarding the timing in the game
Albert Cardona II
@daddycardona
Nov 15 2017 00:33
@newnewb I seen some people in here with all the same issues lol so I am taking my time so I don't get upset and frustrated
Hammad
@newnewb
Nov 15 2017 00:33
@daddycardona Firstly, disabling all inputs until the sounds are finished playing, and changing the buttons colors to correspond to which button is being currently pressed
Albert Cardona II
@daddycardona
Nov 15 2017 00:34
LOL I am not ready LOL
Hammad
@newnewb
Nov 15 2017 00:34
it's almost the same code, just added like 20 lines
https://codepen.io/newnewb/pen/POjrxe check out the changes if you have time
Albert Cardona II
@daddycardona
Nov 15 2017 00:35
yeah I am like this is very confusing I saw the challenge very briefly and am like nooo LOL
Hammad
@newnewb
Nov 15 2017 00:36
@daddycardona I was the same, but i tried it and found out it's not as hard as it seems
Albert Cardona II
@daddycardona
Nov 15 2017 00:37
yeah but this challenge is kicking my ass I am how am I suppose to know that if they didn't teach that or anything like that it is annoying the hell out of me lol
Hammad
@newnewb
Nov 15 2017 00:38
@daddycardona well, it's actually because coding is all about self learning, you shouldn't expect everything to be stuff that you know
Albert Cardona II
@daddycardona
Nov 15 2017 00:39
oh I know that but I saw the answer to this challenge and was like wth is that not even a entry level on that method that I never saw used like that lol
Hammad
@newnewb
Nov 15 2017 00:39
@daddycardona the answer is too sophisticated, it checked it out because i wanted to see what sounds he was making but all i found out was sin equations
they wanted to bind the Hold to keep making the sound until you let go,
Albert Cardona II
@daddycardona
Nov 15 2017 00:40
i am talking about the symatric difference equation I am like wth lol
and the only reason I even look because they give you a link in the hints to help you understand reduce more and it had the answer to this
Hammad
@newnewb
Nov 15 2017 00:41
The answer isn't supposed to help you write the same code, they polish it so you can understand what it's supposed to look like... ( if what i just said makes any sense )
Albert Cardona II
@daddycardona
Nov 15 2017 00:44
no I understand that but the answer was more confusing then the challlenge for me lol
Hammad
@newnewb
Nov 15 2017 00:46
@daddycardona the answer isn't meant to guide you or allow you to copy anything from it, anyways you have only a bit left so you can finish the front end cert
some how i'm having issues with the calculator more than the simon game Q_Q
Albert Cardona II
@daddycardona
Nov 15 2017 00:46
I know I just hope I can pass the test
LOL I probably have a lot of issues with it too and I have done a calculator in vb back in the day like in 98
Hammad
@newnewb
Nov 15 2017 00:49
I've actually done the calc logically using the stack on paper many times before, now i forgot how to do it xD
Albert Cardona II
@daddycardona
Nov 15 2017 00:49
lmao
yeah I totally have no idea either lol
Hammad
@newnewb
Nov 15 2017 00:50
I think i'm gonna use some logic like this
Suppose we have this infix expression Q:

         5 * ( 6 + 2 ) - 12 / 4
The equivalent postfix expression P is:

         5 6 2 + * 12 4 / -
Albert Cardona II
@daddycardona
Nov 15 2017 00:50
I am going to make an array of numbers and buttons and asign the value to each array at the same time lol
Hammad
@newnewb
Nov 15 2017 00:51
oh wait... we don't need to do something like what i just mentioned... it' s a simple calc!
Albert Cardona II
@daddycardona
Nov 15 2017 00:51
yeah now you had me all nervous talk to you all later ;)
have to go get my daughter :)
Hammad
@newnewb
Nov 15 2017 00:51
ttyl
good luck!
Ken Haduch
@khaduch
Nov 15 2017 00:51
@daddycardona - I️ think that what you are trying to do is make sure that you don’t have a duplicate value in the accumulation? The if you use .indexOf() you can test for a value already in the accumulator.
Stephen James
@sjames1958gm
Nov 15 2017 01:11
With the calculator mapping out the states and state transitions prior to coding might be a better path to success
Henry
@GitHub-Henry
Nov 15 2017 01:33
@daddycardona perhaps consider reading and going through each example of YDKJS; it would really up your front end web dev game. :shipit: :dizzy:
Darren
@DarrenfJ
Nov 15 2017 06:30
evening fCC
@kbaig congrats on jumping right into the CSS challenges :D
@thekholm80 if you like to bake it's definitely worth it
Manish Giri
@Manish-Giri
Nov 15 2017 06:33
@DarrenfJ :wave:
Darren
@DarrenfJ
Nov 15 2017 06:33
@Manish-Giri buddy! :D
new icon?
Manish Giri
@Manish-Giri
Nov 15 2017 06:34
si senor
Darren
@DarrenfJ
Nov 15 2017 06:34
noice
Manish Giri
@Manish-Giri
Nov 15 2017 06:34
how goes it
Darren
@DarrenfJ
Nov 15 2017 06:35
oh you know.. hanging out.. chatting.. watching net ninja CSS vids and reading medium articles on blockchain
Manish Giri
@Manish-Giri
Nov 15 2017 06:35
cool
Darren
@DarrenfJ
Nov 15 2017 06:35
and saying thanks @Manish-Giri to people who help out on a more one on one basis ;)
CamperBot
@camperbot
Nov 15 2017 06:35
darrenfj sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6786 | @manish-giri |http://www.freecodecamp.org/manish-giri
Manish Giri
@Manish-Giri
Nov 15 2017 06:35
haha
@DarrenfJ ty too
CamperBot
@camperbot
Nov 15 2017 06:36
manish-giri sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2273 | @darrenfj |http://www.freecodecamp.org/darrenfj
Darren
@DarrenfJ
Nov 15 2017 06:36
you know how they say every time a bell rings an angel get's it's wings?
Manish Giri
@Manish-Giri
Nov 15 2017 06:36
lol
yea
Darren
@DarrenfJ
Nov 15 2017 06:36
everytime a thanks goes out dotdotdot
i've been doing this course
i'm on the last week now, week 6
Darren
@DarrenfJ
Nov 15 2017 06:37
cool
i hear coursera is getting serious offering master's
in CS and data science
so very cool
Manish Giri
@Manish-Giri
Nov 15 2017 06:37
yea
that course has some very heavy data structures usage
phew
linked lists, binary search trees, tries...
Darren
@DarrenfJ
Nov 15 2017 06:39
dang just the kind of stuff I need to focus on more
sort of in the midst of tackling making my front end stuff tighter tbh
Manish Giri
@Manish-Giri
Nov 15 2017 06:40
@DarrenfJ
Screenshot-2017-11-15 Spell Checking and Autocomplete Coursera.png
requirements for week 5's assignment
so much stuff
Nazar
@IsaakNazar
Nov 15 2017 06:41
wassup guys, need help
how to move two buttons under(below) input text when screen size is less than X pixels ?
https://codepen.io/NazarIsaak/pen/rYwEjg
Darren
@DarrenfJ
Nov 15 2017 06:43
brb gonna read this thang
jeebus that looks detailed!
Manish Giri
@Manish-Giri
Nov 15 2017 06:45
yup
worst part is they have tests that test your code for all possible inputs
so just your code working for one input isn't enough
Screenshot-2017-11-15 Spell Checking and Autocomplete Coursera(1).png
like this
Darren
@DarrenfJ
Nov 15 2017 06:47
oh yah they have a JUnit test suite they supply you with.. haven;t done any java but sounds like fun (air quotes)
@IsaakNazar hey man :wave:
you want it to break so the Search and Random both go under at once and stay in that order (search left of radom) right?
@IsaakNazar what you got yer media query doing now?
Nazar
@IsaakNazar
Nov 15 2017 06:51
@DarrenfJ yes , when screen is less than 600px I want to move both buttons below input text
media is making search results mutable, flexible when screen is less 600px
Darren
@DarrenfJ
Nov 15 2017 06:57
@IsaakNazar jeebus I love the layout and the font
and yer weather is very nicely CSS'd too
Nazar
@IsaakNazar
Nov 15 2017 07:00
@DarrenfJ :smile:
Darren
@DarrenfJ
Nov 15 2017 07:02
@IsaakNazar i'm not sure it can be done cause i don't have enough brain cells to rub together at this late.. but I would want to do something where when it's under 600 it's like 2 divs and the search and random are in one.. below the other and when it's greater than 600 it flips to be inline... i see a container class and the media query only makes it 80%
yer not using any bootstrap or anything there that i can see in the settings
Nazar
@IsaakNazar
Nov 15 2017 07:03
@DarrenfJ ok thanx man :+1:
CamperBot
@camperbot
Nov 15 2017 07:03
isaaknazar sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2274 | @darrenfj |http://www.freecodecamp.org/darrenfj
Darren
@DarrenfJ
Nov 15 2017 07:04
oh don't thank me yet.. i'm not sure even how to do it tbh.. my CSS-fu needs brushing up...
one tip i remember from treeHouse in the CSS section way back when i first started taking this all more seriously was to design for the smaller screen first then figure out how to make it change when it expanded.. rather than what most people do which is design for the larger and make it change when it shrinks...
@IsaakNazar found this which does what I'm hinting at; http://jsfiddle.net/fmm5p/4/
Darren
@DarrenfJ
Nov 15 2017 07:09
which might give you a bit of stuff to play around with
Nazar
@IsaakNazar
Nov 15 2017 07:10
@DarrenfJ appreciate, thanx man :+1:
CamperBot
@camperbot
Nov 15 2017 07:10
isaaknazar sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
api offline
Darren
@DarrenfJ
Nov 15 2017 07:12
yah check out the fiddle.. i think it does what you are trying to do
ok fCCpeeps I am off.to.bed
have fun codin etc etc
Marc
@MWBauer
Nov 15 2017 14:17
Morning folks@
!
:wave:
:coffee:
Stephen James
@sjames1958gm
Nov 15 2017 14:17
@MWBauer :wave:
Marc
@MWBauer
Nov 15 2017 14:18
How's everyone
?
Stephen James
@sjames1958gm
Nov 15 2017 14:18
Just getting started
Marc
@MWBauer
Nov 15 2017 14:20
Yep. I hear ya'.
Had a great trip to Arkansas to see family, then St. Louis to get some incredible beer. Stopped to see some friends on the way home and we are back.
Marc
@MWBauer
Nov 15 2017 14:26
Just picked up a deep freeze so we can store some deer. Black friday I'm supposed to hook up with some friends and go get some cheap meat.
Cheap in that for 75 dollars I can feed my fam for a few months as compared to maybe a couple of weeks.
But, back to business. How do I get the very first letter of a string to capitalize like the rest of the title cased string?
```
function titleCase(str) {
var lowerCase = str.toLowerCase();
var title = lowerCase.replace(/(c^| )[a-z]/g, function(subStr) {
return subStr.toUpperCase();
});
return title;
}

function titleCase(str) {
var lowerCase = str.toLowerCase();
var title = lowerCase.replace(/(c^| )[a-z]/g, function(subStr) {
  return subStr.toUpperCase();
});
  return title;
}
Ken Haduch
@khaduch
Nov 15 2017 14:33
@MWBauer - I just took the first letter of the word and upper-cased it, then concatenate that with a slice that got the remainder of the word. I don't know if there is a better way?
I came up with a slick little (could be a ) one-liner to do it, chaining methods together. But the heart of it is taking the first letter, using .toUpperCase() and then .slice() to get the remainder of the word.
Marc
@MWBauer
Nov 15 2017 14:41
could you post please? would like to see that
Marc
@MWBauer
Nov 15 2017 14:53
But I still need to see how to get the very first character
gishy1
@gishy1
Nov 15 2017 14:56
@DarrenfJ bro i had to look at youtube tutorials and i felt so bad doing it by the way why cant you use a for loop instead of a while loop ?
Ken Haduch
@khaduch
Nov 15 2017 15:27
@MWBauer - here is my Title Case solution(s), if you want to see it. If anyone doesn't want to see it, ignore it... :) here is the link to a gist I stored my two solutions into
Marc
@MWBauer
Nov 15 2017 15:29
Thanks. And I just figured out my issue. When i hand wrote my code the first time, my ( looked like a C.
I was wondering what C does and it turns out it looks for a character C
lol
function titleCase(str) {
var lowerCase = str.toLowerCase();
var title = lowerCase.replace(/(^| )[a-z]/g, function(subStr) {
  return subStr.toUpperCase();
});
  return title;
}
This works.
DOes it work to lay it out vertically instead of horizontally??
Ken Haduch
@khaduch
Nov 15 2017 15:32
@MWBauer - you mean the way I posted my solution - putting each new method on a different line? Yes, it works just fine. It makes it easier to sort out what's going on.
Marc
@MWBauer
Nov 15 2017 15:34
I like that very much
Thank you for showing me.
I can follow the second better than the first. I haven't gotten into arrows yet so i'm not wholly certain of what's going on.
It's interesting the way you used the for loop.
Stephen James
@sjames1958gm
Nov 15 2017 15:42
@MWBauer Your replace should have the () around the [a-z] not the other part.
here \b is word boundary - includes ^
"this is a test".match(/\b([a-z])/g)
Maybe it works differently for replace
Marc
@MWBauer
Nov 15 2017 16:12
@sjames1958gm What's the difference between the word boundary \b and ^?\
Kaz Baig
@kbaig
Nov 15 2017 16:19
Anyone know how I could go about replicate the sun animation in http://speedrunchallenge.com/challenge/3 using just divs and keyframes?
Stephen James
@sjames1958gm
Nov 15 2017 16:21
@MWBauer \b matches space before word and start of line before word - just simplifies (^| )
Travis Boss
@travisboss
Nov 15 2017 16:45
@kbaig I would think this would be a svg animation to create this affect. i looked at the backend of it and it looks like there is some jquery. I like this challenge and have signed myself up.
Ahmad Abdolsaheb
@ahmadabdolsaheb
Nov 15 2017 16:47
@sjames1958gm Thanks for helping us learn how to code :), I started to like Chelsea because of you
CamperBot
@camperbot
Nov 15 2017 16:47
ahmadabdolsaheb sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8690 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Kaz Baig
@kbaig
Nov 15 2017 16:48
@travisboss Just got it working using css only if you want to check it out
Travis Boss
@travisboss
Nov 15 2017 16:49
@kbaig do you submit the code on the code line than submit your codpen below on the site?
@kbaig do you use pug in a work environment?
Kaz Baig
@kbaig
Nov 15 2017 16:54
@travisboss I'm not submitting them but that's probably what I do and yes I am using pug
Stephen James
@sjames1958gm
Nov 15 2017 16:56
@ahmadabdolsaheb :+1:
Mantas Antanaitis
@mantaselk
Nov 15 2017 21:24

Hello, can someone help me out with this?

I was trying to figure out Chunky Monkey algorithm, and whole page frozen. Now when ever I try to re-enter the same page it freezes after like 2 seconds. I tried to wait, it seems like its not working.

What could I do to fix this?

Thanks.

Ken Haduch
@khaduch
Nov 15 2017 21:36
@mantaselk - there is a way to open the page without the autorun kicking in. Look at this post: https://forum.freecodecamp.com/t/disable-code-auto-run-on-free-code-camp/19511
Basically, you get the URL and add run=disabled as a parameter. The forum post shows it, @mantaselk
Mantas Antanaitis
@mantaselk
Nov 15 2017 21:38
@khaduch Thank you very much, you might saved my life :smile:
CamperBot
@camperbot
Nov 15 2017 21:38
mantaselk sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3503 | @khaduch |http://www.freecodecamp.org/khaduch
Ken Haduch
@khaduch
Nov 15 2017 21:39
@mantaselk - you're welcome. If you want to have some other eyes look at your code, please post again here with questions... good luck!
Mantas Antanaitis
@mantaselk
Nov 15 2017 21:39
@khaduch OK, thanks !
CamperBot
@camperbot
Nov 15 2017 21:39
mantaselk sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
api offline