These are chat archives for FreeCodeCamp/HelpFrontEnd

23rd
Nov 2017
AbrisM
@AbrisM
Nov 23 2017 01:03
Hello all
Does anyone know what the .Paper does in CSS? I know it's some sort of style effect but I believe it displays a different color of backdrops on letters?
Ben Line
@Benwebdev
Nov 23 2017 01:04
Hello :)
Tom
@moT01
Nov 23 2017 01:05
do you have the code to show us? is it referring to a class?
Ben Line
@Benwebdev
Nov 23 2017 01:05
There isn’t a default class called paper......
AbrisM
@AbrisM
Nov 23 2017 01:16
Hmm not that one hahaha
I will upload the code here
Here we are
I am trying to understand that .paper is purely a CSS effect and what does it effect? I think it changes the backdrop of letters
Tom
@moT01
Nov 23 2017 01:19
.paper is the class of the <p> in the html
it just gives the element a way to target it in the css for things like style
or js for some actions or something
AbrisM
@AbrisM
Nov 23 2017 01:20
Interesting, taking away the "paper" renders entering text useless
Tom
@moT01
Nov 23 2017 01:22
line 68 in the js
appendTo(.paper)
AbrisM
@AbrisM
Nov 23 2017 01:24
Thanks
Wow putting this in messed it all up!
<html lang="en">
<head>
<title>Ransom Note Page</title>
<meta charset="utf-8">
</head>
<body>
<h1> Ransome Note Page</h1>
<p class="paper">
</p>
</body>
</html>
This went into the HTML section
The text goes everywhere, the backdrop for the letters now though
juni
@junipberry
Nov 23 2017 01:53
hey guys, can someone help me. I have a simple website I am working on where I’ve changed the video background to a simple full screen image instead. The problem with the change, however is that the text content within the background image shifted to the far right. I’ve double checked everything, and it seems right. I have 100% width and 100vh. Is there any way the dimensions of the replaced image is affecting the text-context inside the image?
I’ve tried flex and justify-content css properties, and they don’t seem to be doing anything
Christopher Susi
@chrisandsuch
Nov 23 2017 02:09
@Fullmight Thank you for the great feedback!
CamperBot
@camperbot
Nov 23 2017 02:09
chrisandsuch sends brownie points to @fullmight :sparkles: :thumbsup: :sparkles:
:cookie: 102 | @fullmight |http://www.freecodecamp.org/fullmight
Tom
@moT01
Nov 23 2017 02:34
@junipberry have a pen? 100vh what
imemoje
@imemoje
Nov 23 2017 02:37
hello
help please

FirstLine
\SecondLine\
ThirdLine

why i need \r to be correct way

?

myStr="FirstLine\n\SecondLine\\nThirdLine";

why cant i do this

imemoje
@imemoje
Nov 23 2017 02:44
anyone?
Tom
@moT01
Nov 23 2017 02:49
that's just how it is
i dont know
imemoje
@imemoje
Nov 23 2017 02:50
but isnt that wrong
\n goes to the new line right?on begining of new line?corect?
two quick questions for you guys, have any of you read the book mastering responsive web design by ricardo zea and is it worth the 50 bucks for it, and are any of you taking the courses through the front end masters site?
imemoje
@imemoje
Nov 23 2017 02:59
no it does not help much
i have still unanswerd qustion

is it
myStr="FirstLine\n\SecondLine\\rThirdLine";

will write SecondLine and then with \r go back to the begining of same line?

do \r go back to the begin of same line or new line?
Daniel
@DanJP2016
Nov 23 2017 03:02
hang on a sec let me double check my notes on escape chars
imemoje
@imemoje
Nov 23 2017 03:03
ok thank you
Ken Haduch
@khaduch
Nov 23 2017 03:04
@imemoje - the only way to properly display the escape sequences that you have in your string is to use Markdown quoting for the code - put a backtick, which is the ` character (usually on the upper left of the keyboard) before and after your single code extract, or if you have a block of code three backticks ``` on a line all by themselves at the beginning of your code block and another line with ``` after your code block.
imemoje
@imemoje
Nov 23 2017 03:06
@khaduch what that has to do with my question and problem ? :smile:
i do not understand
Ken Haduch
@khaduch
Nov 23 2017 03:08

In that challenge, take the original string, and replace each highlighted sequence of text by the escape sequence, so newline would be \n, carriage-return would be \r, tab would be \t, etc.

When you are posting strings with these special character in them, the string printed in the chat will interpret the characters and won't show the actual code that was input. So if you want to write the quoted backslash, which is \\ but only write it as a "bare" \, it will not show the two backslashes (if I remember how this works, it's been a while.)

It did show what I meant - only a single backslash after the word "bare" - when I really wrote two - the quoting of the inputted text preserves the special sequences from interpretation by the browser.
imemoje
@imemoje
Nov 23 2017 03:09
no no i understand that, that is not problem
Daniel
@DanJP2016
Nov 23 2017 03:09
thats right use the double backslash \ so it will show up in the string, \r and \n basically do the same thing according to my old notes
Ken Haduch
@khaduch
Nov 23 2017 03:11
@imemoje - my point is that with putting the code in there just as a string, we cannot really see what was entered as far as all of the special characters. I wasn't sure if that was a problem...
imemoje
@imemoje
Nov 23 2017 03:11

problem is why \r MUST BE in correct answer?

\r return to the begining of same line

if i go back to begin of same line i overwrite that line and i need to go to the new line not same

and that is done with \n and not with \r

do you see problem now? :)

Ken Haduch
@khaduch
Nov 23 2017 03:12
@imemoje - I think that the concern is not so much how it is interpreted, but for the purposes of this exercise that you duplicate the string and replace the characters that are named. The output of it isn't really important - you'll never actually see the output in the browser when you run the test.

@imemoje - but in a windows command shell, under "node", I ran those lines, and did a console.log(myStr); and the output looks like this:

C:\Users\Ken\go\src\hello>node
> var myStr = "FirstLine\n\\SecondLine\\\rThirdLine"; // Change this line
undefined
> myStr
'FirstLine\n\\SecondLine\\\rThirdLine'
> console.log(myStr);
FirstLine
ThirdLinene\
undefined
>

If that output makes sense. It appears to interpret the \r as only a return and not a new line, so it overwrites the output \SecondLine - so if that is what you wanted to see, then there is one place where it works as you were indicating.

Ken Haduch
@khaduch
Nov 23 2017 03:18
But I still think that the intent of this lesson is how to insert the special escaped characters into a javascript string, and not necessarily if it is truly a useful type of output to generate...
imemoje
@imemoje
Nov 23 2017 03:18

but it is pure logic

if i want to pass that exercise i must use \r
\r is wrong because it is not his purpose to go to the new(in this ex third line)
i want to know if freecodecamp learns me wrong or not
if i put \r just to pass and do not understand why then what is the point of that

i think \r is bug and should be \n but it only pass with \r so it is little strange but ok
in one sentence-i want to know is it bug,wrong answer or correct answer which i do not undestand
imemoje
@imemoje
Nov 23 2017 03:23
maybe i do not see why that is correct answer but i want just to know why.if there is something to see...
Ken Haduch
@khaduch
Nov 23 2017 03:25

@imemoje - yes, you are correct, at least in my understanding of how the carriage-return used to work on hardcopy output terminals. I think that it is somewhat of a moot point in this particular exercise. I tried the same thing in the Opera browser devtools console, and got output like this:

console.log(myStr)
FirstLine
\SecondLine\
ThirdLine

And actually it didn't look like that in the devtools, but when I copied and pasted, it puts "ThirdLine" on the third line... so it could just be that someone isn't aware of the historic functioning of carriage return because I'm thinking that there aren't too many hardcopy terminals these days... I could be wrong... I think that your point is valid - you can file a bug if you or read the forum discussion and see if anyone else brought this point up. https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-escape-sequences-in-strings/17567/26

imemoje
@imemoje
Nov 23 2017 03:27
i feel litle stupid when i pass the exercise just because i wrote what they ask me to even if i do not understand why i did that.
ok
Ken Haduch
@khaduch
Nov 23 2017 03:27
@imemoje - and discussion of this same question on stackoverflow.com: https://stackoverflow.com/questions/3451147/difference-between-r-and-n/3451192
imemoje
@imemoje
Nov 23 2017 03:27
in any case thank you @khaduch and thank you @DanJP2016
CamperBot
@camperbot
Nov 23 2017 03:27
imemoje sends brownie points to @khaduch and @danjp2016 :sparkles: :thumbsup: :sparkles:
:cookie: 297 | @danjp2016 |http://www.freecodecamp.org/danjp2016
:star2: 3522 | @khaduch |http://www.freecodecamp.org/khaduch
Daniel
@DanJP2016
Nov 23 2017 03:28
Ken Haduch
@khaduch
Nov 23 2017 03:29
@imemoje - I wouldn't say that you should feel stupid - this is really a very subtle point and I can see how you are interpreting it - it is definitely something that could be a long topic for discussion (maybe some of it covering the history and the myriad of operating systems over the decades and how it was used...)
Daniel
@DanJP2016
Nov 23 2017 03:29
i think ken is right though that the point of the exercise is to learn how to put them in strings, ive never seen anyone use them
Richard
@rylew0925
Nov 23 2017 03:31
Would someone please tell me how I can move the buttons into the center of the box?
*red box?
Ken Haduch
@khaduch
Nov 23 2017 03:34
@DanJP2016 @imemoje - more verbosity on the newline question from Wikipedia - thanks for the interesting discussion! extremely detailed discussion on the Newline and history of typography, etc. in that Wikipedia article
CamperBot
@camperbot
Nov 23 2017 03:34
khaduch sends brownie points to @danjp2016 and @imemoje :sparkles: :thumbsup: :sparkles:
api offline
:cookie: 298 | @danjp2016 |http://www.freecodecamp.org/danjp2016
imemoje
@imemoje
Nov 23 2017 03:36
and when you can use it
@khaduch thank you
CamperBot
@camperbot
Nov 23 2017 03:37
imemoje sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
api offline
Daniel
@DanJP2016
Nov 23 2017 03:38
@rylew0925 it looks like your trying to use bootstrap for this right? if so you need to go into settings and under the css tab look for quick add at the bottom and add bootstrap 3. then check out this page its got all the info on the buttons https://getbootstrap.com/docs/3.3/css/#buttons
ah yes, regular expressions...my mortal enemy lol.
imemoje
@imemoje
Nov 23 2017 03:40
:)
mine too
Richard
@rylew0925
Nov 23 2017 03:40
@DanJP2016 Thanks!
CamperBot
@camperbot
Nov 23 2017 03:40
rylew0925 sends brownie points to @danjp2016 :sparkles: :thumbsup: :sparkles:
:cookie: 299 | @danjp2016 |http://www.freecodecamp.org/danjp2016
Daniel
@DanJP2016
Nov 23 2017 03:40
@rylew0925 your welcome
Ken Haduch
@khaduch
Nov 23 2017 03:41
I couldn't resist one more article - this was referenced at the end of the Wikipedia article... - possible historical reason for the carriage return. http://www.oualline.com/practical.programmer/eol.html (Extra points if you've ever used a Teletype Model 33... I have. :older_man: )
imemoje
@imemoje
Nov 23 2017 03:41
in every programming language in escape regular exp :smile:
Richard
@rylew0925
Nov 23 2017 03:43
What would I do if I want to add in three buttons to the middle of the red box?
Ken Haduch
@khaduch
Nov 23 2017 03:44
@rylew0925 - I'm going to say "flexbox", before looking at the code...
@rylew0925 - right now you only have one huge button?
Richard
@rylew0925
Nov 23 2017 03:46
yes but I would like to place two additional buttons into the center of the red box
Ken Haduch
@khaduch
Nov 23 2017 03:48
@rylew0925 - so you want to have a red box with three buttons in it, right?
Richard
@rylew0925
Nov 23 2017 03:48
right
Ken Haduch
@khaduch
Nov 23 2017 03:50
@rylew0925 - three buttons on the same line, or just three buttons stacked on top of each other?
Richard
@rylew0925
Nov 23 2017 03:50
on the same line
Richard
@rylew0925
Nov 23 2017 03:54
@khaduch Excellent. Thanks!
CamperBot
@camperbot
Nov 23 2017 03:54
rylew0925 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3523 | @khaduch |http://www.freecodecamp.org/khaduch
Daniel
@DanJP2016
Nov 23 2017 03:56
ken beat me to it, but here is another example of how to do it in bootstrap 3 https://codepen.io/bones211/pen/eerVwY
Richard
@rylew0925
Nov 23 2017 03:56
@DanJP2016 Neat. Thanks!
CamperBot
@camperbot
Nov 23 2017 03:56
rylew0925 sends brownie points to @danjp2016 :sparkles: :thumbsup: :sparkles:
api offline
Ken Haduch
@khaduch
Nov 23 2017 04:00
@rylew0925 - if you take the "btn-block" class off of your buttons, it will not try to fill the entire row...
Richard
@rylew0925
Nov 23 2017 04:14
gotcha. thanks!
Zachary
@Bazill03
Nov 23 2017 04:15
In javascript is it possible for a function to retain it's previous arguments during a second call? I have a function with two arguments and when I call the function again it's running for the first arguments I called it with, and the second at the same time.
Ken Haduch
@khaduch
Nov 23 2017 04:17
@Bazill03 - what does your function look like? If you have variables declared within your function, but didn't use the "var" keyword to declare them, then they are declared in the global space, so that is one situation where they might be retaining the values - if it's the actual function arguments, then I don't think they would be retained? What does your function look like?
Daniel
@DanJP2016
Nov 23 2017 04:19
@Bazill03 yes, its called memoization. I don't really know off the top of my head how to implement it though, maybe this article can help https://medium.freecodecamp.org/understanding-memoize-in-javascript-51d07d19430e
Zachary
@Bazill03
Nov 23 2017 04:21
Well, I don't want them to retain their values. Right now I'm trying to debug this dialogue system and I have several functions that work together to make it work. When the player interacts with the second actor it will print responses for both.
    function conversation(actor, player){
      //handles click events for player response buttons
      $(".conversationMenu").on("click", ".convoButton", function(){
        //prints out actor response to player
        printActorResponse(actor, player, this.id);
        console.log("Actor " + actor + " " + player + this.id);
        //removes player response buttons
        deleteButtons();
        //prints out player repsonse buttons
        conversationOptions(actor, player);

      });
      //prints out greeting
      printActorResponse(actor, player);
      conversationOptions(actor, player);
    }

    function printActorResponse(actor, player, response){
      combatPrint(Dialogue.interact(actor, player, response).text);
    }

    function conversationOptions(actor, player){
      let responses = Dialogue.interact(actor, player).responses;

      for(var i = 0; i < responses.length; i++){
        console.log(responses[i].text);
        $(".conversationMenu").append("<button class='convoButton' id='" + responses[i].id + "'>" + responses[i].text + "</button>")
        $(".conversationMenu").append("<br>");
      }
    }

    function deleteButtons(){
      $(".conversationMenu").html(" ");
    }
As far as I can tell there aren't any global values getting kept.
Ken Haduch
@khaduch
Nov 23 2017 04:24
@Bazill03 - where are values getting stored? Like, what is an example of what's happening that you have values stored? Things could be stored in the DOM, perhaps?
Zachary
@Bazill03
Nov 23 2017 04:28

Well, I'm using a library that allows for branching dialogue: https://github.com/scottbw/dialoguejs

But I don't think the library itself is broken. That console log at the top shows what Dialogue.interact I'm submitting to the library. It's format is Dialogue.interact(actor, player, responseid)

So I might have ("Some guy", "player", 1) and that would tell the library what the player is responding with. However on the second conversation I'm telling the library

("some guy", "player", 1)
("another guy", "player", 1)

Ken Haduch
@khaduch
Nov 23 2017 04:28
@Bazill03 - I was wondering what the "Dialogue" object was - it must be declared "globally" somewhere in the code?
Daniel
@DanJP2016
Nov 23 2017 04:30
are you using a another engine like phaser or bablyon for the gameplay? maybe there is a naming conflict?
Zachary
@Bazill03
Nov 23 2017 04:30
Nope, just jQuery and Javascript
The Dialogue object is global.
Ken Haduch
@khaduch
Nov 23 2017 04:31
@Bazill03 - Dialogue itself is a global object, so I'm thinking that it will be "remembering" something?
Zachary
@Bazill03
Nov 23 2017 04:31
Well, it kind of has to I'd think.
In face, given that I'm using a script tag in the HTML to include the script I'm not sure how I could make it not global.
Daniel
@DanJP2016
Nov 23 2017 04:33
do you have it on codepen or github?
Ken Haduch
@khaduch
Nov 23 2017 04:34
@Bazill03 - I think that the idea is that it would be global so you can refer to it anywhere in your code, otherwise, there would be some complication passing a handle to that object around to any function that needed to access it. So I can see the utility of that. But I don't really understand how it is used - I just tried to look at their readme file, and it doesn't really make sense to me at first glance.
Zachary
@Bazill03
Nov 23 2017 04:35
@khaduch Yeah, the readme file isn't the best. Hasn't been updated since 2015 anyway.
@DanJP2016 github
Daniel
@DanJP2016
Nov 23 2017 04:36
you could try moving the click handler out of the conversation function, that is creating a closure that might be making its output private. maybe?
Zachary
@Bazill03
Nov 23 2017 04:36
@DanJP2016 I can certainly try it.
Ken Haduch
@khaduch
Nov 23 2017 04:38
@DanJP2016 - ooooh - good point, Dan - I've seen problems in the past where a situation like that caused multiple click handlers to be placed on an element. That might be what's going on here! Not exactly sure if it's a closure situation, it might be, but I've definitely seen where multiple click handler calls were made as the click handlers built up in number.
Zachary
@Bazill03
Nov 23 2017 04:39
Is there a way to delete click handlers as they aren't needed?
Daniel
@DanJP2016
Nov 23 2017 04:39
i don't remember, I think so. give me a sec and i'll check my notes
Zachary
@Bazill03
Nov 23 2017 04:40
Yeah, off()
Ken Haduch
@khaduch
Nov 23 2017 04:40
yes there is... but I think that the best way is to not bind too many of them. :)
Zachary
@Bazill03
Nov 23 2017 04:40
Well then my code wouldn't scale very well I don't think.
Ken Haduch
@khaduch
Nov 23 2017 04:41
I mean don't bind more than one on the same button or element... in case that was confusing?
ANd I think that @DanJP2016 was right about closure - each time you declared a click handler function, the values would be enclosed in the scope of the new handler.
Zachary
@Bazill03
Nov 23 2017 04:44
Yeah I think that was the problem.
Or, I'm not sure. I destroyed the handlers as the player exits a conversation and it worked great.
Daniel
@DanJP2016
Nov 23 2017 04:45
i think the handler will still be in memory, not sure how that works in jquery
in vanilla js you can reattach it when its needed again
Zachary
@Bazill03
Nov 23 2017 04:47
@DanJP2016 I'm not really sure either to be honest. But, my code works now. My hours of torture are over and I don't really even know why. Thanks!
CamperBot
@camperbot
Nov 23 2017 04:47
bazill03 sends brownie points to @danjp2016 :sparkles: :thumbsup: :sparkles:
:cookie: 300 | @danjp2016 |http://www.freecodecamp.org/danjp2016
Daniel
@DanJP2016
Nov 23 2017 04:47
your welcome
all I had written in my notes about event listeners was to use addEventListener and don't make them iff you don't need them lol. should probably update my notes some lol
Zachary
@Bazill03
Nov 23 2017 04:55
Well I mean, those are some good points.
Oh, I get it now. When I create the click event for the button I'm setting a function for actor response. Since I never got rid of those events, as soon as the player spoke to the second actor the click events had multiple values stored.
Daniel
@DanJP2016
Nov 23 2017 05:00
yeah i think that is what was happening. the closure that was being created was holding those first values and since the eventlistener keep going they were never destroyed
closures are weird and beautiful lmao
Ken Haduch
@khaduch
Nov 23 2017 05:01
@Bazill03 - that's the "closure" - each time you created a new function for the click handler, the values for the current input are saved there, and when they are all invoked they will each output the values that are stored. @DanJP2016 - fun stuff, for sure!
Daniel
@DanJP2016
Nov 23 2017 05:02
its not actually a feature built into javascript but a side effect of how scoping works if im not mistaken
Zachary
@Bazill03
Nov 23 2017 05:04
@khaduch I've yet to even learn about closures. I'll definitely look them up! This project has taught me a lot.
Ken Haduch
@khaduch
Nov 23 2017 05:06
@Bazill03 - here is a good article: http://javascriptissexy.com/understand-javascript-closures-with-ease/ - at least one that I used when trying to get the hang of them...
and I'd say "with ease" advisedly... :)
Zachary
@Bazill03
Nov 23 2017 05:07
@khaduch Ha! Thanks, I'll give that a read.
CamperBot
@camperbot
Nov 23 2017 05:07
bazill03 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3524 | @khaduch |http://www.freecodecamp.org/khaduch
Daniel
@DanJP2016
Nov 23 2017 05:08
if you guys get the chance, you should check out secrets of the javascript ninja, its a really good book that explores the strengths and nuances of the language
Ken Haduch
@khaduch
Nov 23 2017 05:09
@DanJP2016 - I think that that is one of the books that I started reading... I'll have to pick that up again...
Daniel
@DanJP2016
Nov 23 2017 05:10
I have not read the first version but I learned a lot from the second one. read it twice lol
Zachary
@Bazill03
Nov 23 2017 05:13
@DanJP2016 I'll definitely have to pick that up.
Daniel
@DanJP2016
Nov 23 2017 05:16
its a really good book. goes over techniques for using built in array methods as custom object methods so you don't have to rewrite something thats already there, how to use object.defineProperty, the event loop, and all kinds of awesome stuff
Richard
@rylew0925
Nov 23 2017 06:12
How would I move my h1 and h2 headings towards the right?
I tried align: right but nothing seemed to happen for the h1 heading
text-align: right also did nothing
Johnny
@jtan3
Nov 23 2017 06:26
@rylew0925 you're missing some opening and closing div tags .
Johnny
@jtan3
Nov 23 2017 06:34
@rylew0925 https://codepen.io/anon/pen/xPjzKe you should compare this version to yours
Richard
@rylew0925
Nov 23 2017 06:40
@jtan3 thanks!
CamperBot
@camperbot
Nov 23 2017 06:40
rylew0925 sends brownie points to @jtan3 :sparkles: :thumbsup: :sparkles:
:cookie: 465 | @jtan3 |http://www.freecodecamp.org/jtan3
Johnny
@jtan3
Nov 23 2017 06:47
@rylew0925 your img tag has no picture in it.
primuscovenant
@primuscovenant
Nov 23 2017 09:40
@heroiczero tx
CamperBot
@camperbot
Nov 23 2017 09:40
primuscovenant sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 2070 | @heroiczero |http://www.freecodecamp.org/heroiczero
Ben Line
@Benwebdev
Nov 23 2017 11:40
Hey All 🤟🏼
Markus Kiili
@Masd925
Nov 23 2017 11:40
@Benwebdev Hi.
Ben Line
@Benwebdev
Nov 23 2017 11:41
How are we all ?
Markus Kiili
@Masd925
Nov 23 2017 11:41
@Benwebdev Waiting for a :coffee: break.
Ben Line
@Benwebdev
Nov 23 2017 11:41
Anyone needs support, tag me. here for about 2 hours
I’ve got a coffee 🤤
dinesh
@1532j0004kg
Nov 23 2017 12:11
how to write carousel text in js?
Bilal Mahmood Malik
@BilalMalik10
Nov 23 2017 12:16
Hi i need Help . Here is link to my code pen --> https://codepen.io/bilalmalik/full/WXJmwP/
I am new to front end web development. currently i am developing a responsive website for learning purpose, and i got stuck in margins.
Problem that i am facing is that, When i change view to small devices then there is no margin between my menu-Item(with heading chicken) and browser.
even if i set margin in media query it doesn't change.
dinesh
@1532j0004kg
Nov 23 2017 12:21
its working good.
Tiago Correia
@tiagocorreiaalmeida
Nov 23 2017 12:22
@BilalMalik10 btw if you want the grey color to cover the entire text even at responsive you have to remove the height from the backgrou
the div that has the backgroubnd-color
this way the color will adapt based on content size
Bilal Mahmood Malik
@BilalMalik10
Nov 23 2017 12:27
@tiagocorreiaalmeida Thanks
CamperBot
@camperbot
Nov 23 2017 12:27
bilalmalik10 sends brownie points to @tiagocorreiaalmeida :sparkles: :thumbsup: :sparkles:
:cookie: 450 | @tiagocorreiaalmeida |http://www.freecodecamp.org/tiagocorreiaalmeida
Ruben Abraham
@BuBBRBbr1
Nov 23 2017 13:04
Guys I don't remember anything I learned in the coding lessons. Is there like a cheat sheet or soemthing available.
alpox
@alpox
Nov 23 2017 13:05
@BuBBRBbr1 Best is to just go and use it so it stays at your fingertips
@BuBBRBbr1 Maybe something like https://www.codementor.io/johnnyb/javascript-cheatsheet-fb54lz08k could be what you're looking for though
imemoje
@imemoje
Nov 23 2017 13:06
@BuBBRBbr1 you can always see and review your code solutions. Just click on your profile icon in top right corner.
Alvaro
@minutazos
Nov 23 2017 14:41
Hi, anyone have any idea why the same site with the same sitemap and the same code, hosted in localhost, all works fine, but hosted on a server (dinahosting) there is a javascript function (and only that function) that doesn't works? Maybe is because I do a get with js?
Tiago Correia
@tiagocorreiaalmeida
Nov 23 2017 14:55
can I see your function?=
Tom
@moT01
Nov 23 2017 14:55
that's not a lot to go on @minutazos
is it linking or trying to get something from somewhere local?
Alvaro
@minutazos
Nov 23 2017 15:01
var carga = function(categ) { $("#more").click(function() { var content = $.get("/assets/include/load-second-"+categ+".php" , function(htmlexterno) { $("#more").remove(); $("#portfolio2").addClass("portfolio masonry"); $("#portfolio2").append(htmlexterno); //Aplicamos arreglos altura("#portfolio2"); hover("#portfolio2"); }); }); };
var carga = function(categ) {
$("#more").click(function() {
var content = $.get("/assets/include/load-second-"+categ+".php"
, function(htmlexterno) {
$("#more").remove();
$("#portfolio2").addClass("portfolio masonry");
$("#portfolio2").append(htmlexterno);
//Aplicamos arreglos
altura("#portfolio2");
hover("#portfolio2");
});
});
};
sorry to duplicate
Tom
@moT01
Nov 23 2017 15:02
@Luomint that will put myVar in an array - not sure convert is the right word
Alvaro
@minutazos
Nov 23 2017 15:03
before without passing parameters to the function, it worked, and after modifying to pass parameters, i think it worked during a time, but now nothing....
Tom
@moT01
Nov 23 2017 15:04
three ticks (`) + new line (shift+enter) + code + new line + three more ticks
makes code readable
Alvaro
@minutazos
Nov 23 2017 15:06
`
var carga = function(categ) {
$("#more").click(function() {
var content = $.get("/assets/include/load-second-"+categ+".php"
, function(htmlexterno) {$("#more").remove();
$("#portfolio2").addClass("portfolio masonry");
$("#portfolio2").append(htmlexterno);
//Aplicamos arreglos
altura("#portfolio2");
hover("#portfolio2");
});
});
};
woops, sorrry.....
Tom
@moT01
Nov 23 2017 15:24
there's a button at the bottom right, with an M
and a arrow
Marc
@MWBauer
Nov 23 2017 16:50
Hi everyone!
Anas Abdennaim
@Aka-Dev
Nov 23 2017 17:09
Hi
hensn5250
@hensn5250
Nov 23 2017 17:13
hey
anyone here?
AbrisM
@AbrisM
Nov 23 2017 17:47
@hensn5250 Yes
Ian Gracia
@iangracia
Nov 23 2017 17:55
someone wants to help me with css?
why is the X fucking up the first square's postition? And why is it not centered with the text-align?
Niloy513
@Niloy513
Nov 23 2017 18:13
I'll try it might take a minute though, it's probably a nesting issue though.
AbrisM
@AbrisM
Nov 23 2017 18:15
the paragraph doesn't recongnize it needs to be positioned in a div element
Ian Gracia
@iangracia
Nov 23 2017 18:38
@AbrisM how do i make the paragraph recognize then?
its the same problem if i change to a h3 element instead
i just forked it to show you, I was trying to organize the code without messing it up, and eventually I got it.
Good rule of thumb with css, try to avoid fix units (px) and becareful with nesting
I'll delete your pen from my fork by later tonight at the latest
Ian Gracia
@iangracia
Nov 23 2017 18:45
hmm yes
how did you make it work?4
The columns and general square size is still rly messed up tho
Niloy513
@Niloy513
Nov 23 2017 18:47
yah I was trying to fix that as well. honestly it just came together when I organized it. I made it work by using nesting, and responsive units really.
Amadeusz
@AmekxOne
Nov 23 2017 20:12
Guys, do you think that this code for the "Diff Two Arrays" algorithm is acceptable? It passes, but I just want to make sure it's ok to solve the problem this way...

function diffArray(arr1, arr2) {
  var newArr = arr1.concat(arr2);
  var result = [];

  for(var i=0;i<newArr.length;i++){
    if(!arr1.includes(newArr[i]) || !arr2.includes(newArr[i])){
      result.push(newArr[i]);
    }
  }

  return result;
}

diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]);
DecisiveIndecisive
@DecisiveIndecisive
Nov 23 2017 20:26
Hey guys, can someone help me understand how to execute code after an API has loaded some dta
I'm having a hard time understanding the .load function
Abdullah-Al-Zubair
@a2-zubair
Nov 23 2017 20:28
Hello guys, need help about my "Local weather app". My local machine result is fine. In codepen the weather icon doesn't show. I'm using: http://weathericons.io/ for icons. How can i add weather icon css and fonts to codepen. Here is my codepen link: https://codepen.io/a2-zubair/pen/aVGgWB
Markus Kiili
@Masd925
Nov 23 2017 20:50
@AmekxOne That is a fine solution. With the loop and result array you are implementing same that the built-in array method filter does, so using filter would make the code more compact.
Onome Sotu
@onomesotu
Nov 23 2017 20:52
@DecisiveIndecisive after the API loads data, you can execute with a callback success function
Hey guys, any feedback on my weather app? https://onomesotu.github.io/weather/
@a2-zubair Zubair, looking at the weather app documentation, I don't think you can use it on codepen
Marc
@MWBauer
Nov 23 2017 21:02
@iangracia still here? need help?
CamperBot
@camperbot
Nov 23 2017 21:02
mwbauer sends brownie points to @iangracia :sparkles: :thumbsup: :sparkles:
:cookie: 378 | @iangracia |http://www.freecodecamp.org/iangracia
Marc
@MWBauer
Nov 23 2017 21:02
@onomesotu I'm working on the weather app too
or maybe not.
Ya'll have a good day
Abdullah-Al-Zubair
@a2-zubair
Nov 23 2017 21:07
@onomesotu At first i also think that is not in codepen editor. but now it works fine. using the cdn links into css settings.
Ian Gracia
@iangracia
Nov 23 2017 21:10
@MWBauer yes i still need help, you are welcome to show me a solution even if i'm not at the computer
ill check when i return
Daria Doronina
@Skidle
Nov 23 2017 21:55
@onomesotu it looks very fancy! great work :+1:
hey guys, how do you arrange your finished projects in github? Do you create a separate repo for each and every project?
Tiago Correia
@tiagocorreiaalmeida
Nov 23 2017 22:01
Yeah I did that @Skidle
Daria Doronina
@Skidle
Nov 23 2017 22:01
do you test your projects? Or do you have package.json for them? @tiagocorreiaalmeida
Tiago Correia
@tiagocorreiaalmeida
Nov 23 2017 22:02
what do you mean by test?and yes the ones I used node on do have a package.json
Daria Doronina
@Skidle
Nov 23 2017 22:02
cause right now I'm trying to start with tests and it's getting weird, cause I have one package.json in that repo and now I don't know how to set up mocha. Like, should I create separate test files for every projects?
Tiago Correia
@tiagocorreiaalmeida
Nov 23 2017 22:03
you wont be testing the same on every project I would say
Daria Doronina
@Skidle
Nov 23 2017 22:04
that's what I'm thinking too
Tiago Correia
@tiagocorreiaalmeida
Nov 23 2017 22:04
I used mocha during a course but the last time was like 1 month and half or two around can't be a great on an help on that subject I think
ago*
Daria Doronina
@Skidle
Nov 23 2017 22:04
well I just wanted to write a path for mocha in package.json
but I guess I can't really do that if all my tests will look different and be in different directories
@tiagocorreiaalmeida it's fine, thank you I guess I won't bother with this package.json for now :D
CamperBot
@camperbot
Nov 23 2017 22:05
skidle sends brownie points to @tiagocorreiaalmeida :sparkles: :thumbsup: :sparkles:
:cookie: 451 | @tiagocorreiaalmeida |http://www.freecodecamp.org/tiagocorreiaalmeida
Tiago Correia
@tiagocorreiaalmeida
Nov 23 2017 22:05
you mean a path to start the task?
Daria Doronina
@Skidle
Nov 23 2017 22:05
yeah to start testing
like I wanted to automate it, so I could run test with just "npm test"
Tiago Correia
@tiagocorreiaalmeida
Nov 23 2017 22:06
its pointing to all your .test.js file? just an example of name
the path can be the same in all your package file
Daria Doronina
@Skidle
Nov 23 2017 22:08
yes it's pointing to test.js but I wanted for every project to have each own. So all test.js will be in different directories
Tiago Correia
@tiagocorreiaalmeida
Nov 23 2017 22:08
oh then you have to set up a path per package
but set it up on the start of it
Daria Doronina
@Skidle
Nov 23 2017 22:08
per project you mean?
Tiago Correia
@tiagocorreiaalmeida
Nov 23 2017 22:08
yeah sorry
:D
Daria Doronina
@Skidle
Nov 23 2017 22:09
okay but one package.json for the whole repo, right?
Tiago Correia
@tiagocorreiaalmeida
Nov 23 2017 22:10
normally its a package.json for an entire project, the package.json contains info about the project and the packages you installed to work with, so normally makes sense 1 package for repo, one repo = one project normally
Daria Doronina
@Skidle
Nov 23 2017 22:10
shit :D
Tiago Correia
@tiagocorreiaalmeida
Nov 23 2017 22:10
what?:D
Daria Doronina
@Skidle
Nov 23 2017 22:11
well then it's best to separate all those projects even if they are super small like random quote generator?)
Tiago Correia
@tiagocorreiaalmeida
Nov 23 2017 22:11
oh wait
you can group those in a frontend repo
I tough about project like the ones in backend
for those 1 for project is the correct way
Daria Doronina
@Skidle
Nov 23 2017 22:12
nah, I'm only on advanced frontend projects, long way to go to backend))
okay
Tiago Correia
@tiagocorreiaalmeida
Nov 23 2017 22:16
in that caswe makes sense 1 repository with the name of frrontned I would say and group all those project, and sorry if I made you get confused
Daria Doronina
@Skidle
Nov 23 2017 22:18
nono, you definitely didn't get me confused, you actually helped me a lot, thank you :) I found a way how to add multiple paths into this scripts tag in package.json
scripts: {
   buildAll: 'grunt jsBuild & grunt cssBuild'
}
so I can only specify paths for those advanced projects e.g.