These are chat archives for FreeCodeCamp/HelpFrontEnd

26th
Nov 2017
out of flour
Om Prakash Singh
@omps
Nov 26 2017 02:40 UTC
From last one year not able to give time to finish the codepen assignment will do today.. proud to be part of such active initiative
Nicholas Orochena
@NOrochena
Nov 26 2017 03:00 UTC
If you and a friend work on a project together. Do we submit the same codepen and we both get credit?
Micah M.
@mcmxl22
Nov 26 2017 03:03 UTC
How do I get buttons in the same row with an <h1>? https://codepen.io/mcmxl22/pen/ooMBbL?editors=1000
@mcmxl22 got it?
@NOrochena i believe you can do it like that, yes
Micah M.
@mcmxl22
Nov 26 2017 03:07 UTC
@moT01 got what?
Fabien SHAN
@X140hu4
Nov 26 2017 03:09 UTC
@mcmxl22 Can you explain your problem? we see the social buttons aligned and your h1 below
Micah M.
@mcmxl22
Nov 26 2017 03:10 UTC
I want the h1 in the header with the buttons.
in the same row as the buttons.
Fabien SHAN
@X140hu4
Nov 26 2017 03:12 UTC
At the moment the buttons and the title are in different div
you have to try putting it in your header
Micah M.
@mcmxl22
Nov 26 2017 03:14 UTC
I tried putting it in the header but it doesn't line up with the buttons. I tried d-inline and d-inline-block and others.
Fabien SHAN
@X140hu4
Nov 26 2017 03:17 UTC
You should read about the display property
Your h1 element is a block element.
David Belmares
@DavidBelmares
Nov 26 2017 03:27 UTC
I'm having a bug with the bottom few lines of code on challenges recently
It won't let me put my cursor to type past the first few characters on a line
Micah M.
@mcmxl22
Nov 26 2017 03:28 UTC
@DavidBelmares I got around it by pressing Enter then backspacing. After that it will let you place the cursor correctly.
Thank you@X140hu4
David Belmares
@DavidBelmares
Nov 26 2017 03:29 UTC
Alright thanks
Micah M.
@mcmxl22
Nov 26 2017 03:30 UTC
@X140hu4 Thank you!
CamperBot
@camperbot
Nov 26 2017 03:30 UTC
mcmxl22 sends brownie points to @x140hu4 :sparkles: :thumbsup: :sparkles:
:cookie: 311 | @x140hu4 |http://www.freecodecamp.org/x140hu4
Sorin Ruse
@sorinr
Nov 26 2017 06:11 UTC
@mcmxl22 you need something like:
.name {
  font-size: 28px;
  width: 100%;
  text-align: right;
}
#well{
  display: flex;
  width: 100%;
}
Sorin Ruse
@sorinr
Nov 26 2017 06:18 UTC
@mcmxl22 yes i've seen. but if you make the changes to your css like the above you will get the result you want.
Micah M.
@mcmxl22
Nov 26 2017 06:24 UTC
@sorinr Thanks for the suggestions. I used text-align:center;.
CamperBot
@camperbot
Nov 26 2017 06:24 UTC
mcmxl22 sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:star2: 1370 | @sorinr |http://www.freecodecamp.org/sorinr
ADIL KARMOUZI
@mradil16
Nov 26 2017 09:07 UTC
Did web developers create their own scripts or they use others scripts , and add some modifications ,so it fits their needs ?
Sorin Ruse
@sorinr
Nov 26 2017 09:11 UTC
@mradil16 take a look at this js library. would you try to write one on your own or just use it along with your app specific functions?
Bartek Lewandowski
@Jabarlew
Nov 26 2017 14:42 UTC
can anyone help me with forEach loop ?
@Jabarlew whats up
Can anybody help me with Simon Game. I'm trying to check if the user input is the same as the computer but it seems to not work. Here is my code: https://codepen.io/Teo03/pen/yPvbwY
@Teo03 any luck?
i guessing it's in the usrClick function
instead of userClicks.push cant you test it against the array of the computers clicks
@moT01 I'am still trying but I think is in checkClicks
wouldnt you want to check it every time the user clicks
so if it's wrong you can stop the game or something
@moT01 ok, I will try
@moT01 still doesen't work
you do want to do that though right?
check on every click if it's the right button
function usrClick() {
    if ($(this).is("#green")) {
      userClicks.push(1);
      audio[0].play();
      checkClicks();
    } else if ($(this).is("#red")) {
      userClicks.push(2);
      audio[1].play();
      checkClicks();
    } else if ($(this).is("#blue")) {
      userClicks.push(3);
      audio[2].play();
      checkClicks();
    } else if ($(this).is("#yellow")) {
      userClicks.push(4);
      audio[3].play();
      checkClicks();
    }
    console.log(userClicks);
  }
Something like this?
i think your check clicks function is more for checking if we reached the length of the computers array - which would start a new round
we need to check on every click if the click we made this turn == the one in the computer array for the same turn
@moT01 Thanks I will try to fix it I have to go now
CamperBot
@camperbot
Nov 26 2017 15:57 UTC
teo03 sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 915 | @mot01 |http://www.freecodecamp.org/mot01
Boarworm
@Boarworm
Nov 26 2017 16:35 UTC
Hi guys. Give me please good Vagrantfile for any vagrant box which you use.
Dan Stockham
@DanStockham
Nov 26 2017 17:10 UTC
What's vagrant?
1rjun
@1rjun
Nov 26 2017 17:23 UTC
Hlo
Dane David
@danedavid
Nov 26 2017 17:26 UTC
yes?
1rjun
@1rjun
Nov 26 2017 17:27 UTC
How can i bootstrap the content of my website
Datikzz
@Datikzz
Nov 26 2017 18:02 UTC
hi, I'm trying to reapply offset of elements, when their dimensions changed, its working when resizing window. Press + or - to change width of elements - http://jsfiddle.net/srfy5qs4/1/
alpox
@alpox
Nov 26 2017 19:48 UTC
@Boarworm I kinda don't think that anyone here uses Vagrant. But i guess it was worth a shot :D
alpox
@alpox
Nov 26 2017 19:53 UTC
@Datikzz Any question about it?
@Datikzz Why not just group those elements together so you don't have to use any resize event / javascript trickery to align the elements?
Luis Sanchez
@sanchezl391
Nov 26 2017 21:03 UTC
@1rjun add the bootstrap css
Cristi Ciobanu
@c-ciobanu
Nov 26 2017 21:08 UTC
why the last console log gives me undefined? https://codepen.io/c-ciobanu/pen/KyBeGo
the var is not global in js?
last?
Cristi Ciobanu
@c-ciobanu
Nov 26 2017 21:11 UTC
row 20
last in the code - but shows first in the log?
Cristi Ciobanu
@c-ciobanu
Nov 26 2017 21:11 UTC
y
well, i suck at explaining what i think is happening
you declare your variable
make a request for the location
then code continues to execute to the bottom before the request for the location is returned
so when it logs on the bottom (right away) it's still undefined
then when you hit allow location - or something - it continues that function where it sets the new values
Cristi Ciobanu
@c-ciobanu
Nov 26 2017 21:22 UTC
there is something that allows me to run the log after one functione executes completely?
is strange because the 2 logs inside the function run instantly
well, i dont know why it's not working for me right now
but you either need to nest the rest of you stuff in one of the functions
or use a callback function
using a callback is probly what you're supposed to do
thats what your showPosition function is for the getCurrentPosition
it executes after it gets the current position
Sorin Ruse
@sorinr
Nov 26 2017 21:31 UTC
@c-ciobanu see here an example
Cristi Ciobanu
@c-ciobanu
Nov 26 2017 21:36 UTC
still can't log or use it outside the showPosition function
Sorin Ruse
@sorinr
Nov 26 2017 21:38 UTC
@c-ciobanu have you loaded my example above?
Cristi Ciobanu
@c-ciobanu
Nov 26 2017 21:44 UTC
yes, but the variables are still not global
you declare them inside the function and use them inside
i wanr to be able to use the variables outside the function
you can use it outside the function, it just doesn't have a value yet
Sorin Ruse
@sorinr
Nov 26 2017 21:47 UTC
@c-ciobanu u don't need them to be global. why do u think will be useful to have them global?
Daniel
@DanJP2016
Nov 26 2017 21:49 UTC
if you want them to be global you can do something like this. https://codepen.io/bones211/pen/eejjpX?editors=1010
but @sorinr is right, they don't need to be global. you just have to put your code in the callback functions to be able to access them
Cristi Ciobanu
@c-ciobanu
Nov 26 2017 21:55 UTC
because sometimes you need some global vars, and is strange that in this case is not working properly in i want to understand why
Daniel
@DanJP2016
Nov 26 2017 21:59 UTC
i think the geolocation creates it own object to store data in. idk though, maybe this can help https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/Using_geolocation
Sorin Ruse
@sorinr
Nov 26 2017 22:00 UTC

@c-ciobanu just to make you understand whats happening in your js:

getLocation();
console.log(lat);

so js encounters the function getLocation and calls it and then pass immediately to the next instruction that is console.log(lat) that ofc will display undifined because the getLocation didn't get back yet the response provided by your fallback "showPosition" that will update the lat var. change the global var lat = 0.00; and you will see that you will get console loged 0.00 and not undefined because you have this time instantiated the var with a default value. hope it makes sense

Cristi Ciobanu
@c-ciobanu
Nov 26 2017 22:09 UTC
how can i make it finish the function before executing next istruction?
Sorin Ruse
@sorinr
Nov 26 2017 22:11 UTC
@c-ciobanu like here
@c-ciobanu the calls are asynchronous(the flow of app does not wait for a response to the call) and that's the best way coz you don't make a synchronous call ( a call that will freeze all your page until it gets a response. what if the call, for some reason, don't get a response?)
Cristi Ciobanu
@c-ciobanu
Nov 26 2017 22:16 UTC
time limit is one option
is possible to make a call synchronous?
Sorin Ruse
@sorinr
Nov 26 2017 22:20 UTC
@c-ciobanu its absolute bad practice to freeze an app just to wait for a sync response. i will not give u any advice on that. i did it myself for testing but if you want it just google for yourself
alpox
@alpox
Nov 26 2017 22:23 UTC
@c-ciobanu Just never ever freeze a GUI application. Just don't ;-)
Thats not really possible in javascript anyway (Except you make some looping for some seconds - which cannot be timed right)
Sorin Ruse
@sorinr
Nov 26 2017 22:29 UTC
@c-ciobanu time limit its not a valid option because you can't guess how long will take to the server to send back the response
@c-ciobanu the idea is that: i make the call to the server and let the "callback" function to deal with the response when it receive it and pass the result to my other components that need data from that response
Jordan
@jordanleo7
Nov 26 2017 22:58 UTC
Is anyone familiar with the voting app project? I'm trying to get started with some of the basic functions of the site. I can't figure out how to submit form data and have res.send req.body.title display the title of the user input on the page. https://github.com/jordanleo7/voting-app and https://voting-app-jordan.glitch.me/
Micah M.
@mcmxl22
Nov 26 2017 23:12 UTC
I'm trying to put pictures and borders on by grid but they don't show up. https://codepen.io/mcmxl22/pen/ooMBbL?editors=1100
Jordan
@jordanleo7
Nov 26 2017 23:32 UTC
Hi Micah, why not use the img element, instead of a button's background image?
Micah M.
@mcmxl22
Nov 26 2017 23:38 UTC
@jordanleo7 Where would I put the img element?
Jim Tryon
@jimtryon
Nov 26 2017 23:42 UTC
@mcmxl22 img element would go in the body
Ben Hart
@Benjmhart
Nov 26 2017 23:44 UTC
hey gang, trying to get an event listener for my simon off/on switch, and it's like it's firing twice? any reason why?
Jim Tryon
@jimtryon
Nov 26 2017 23:47 UTC
shouldn’t you be calling switchCallback instead of callback?
Jordan
@jordanleo7
Nov 26 2017 23:49 UTC
@mcmxl22 Why are you using buttons? Are you trying to make 6 boxes for a portfolio project? I meant, if you use 6 images instead of buttons. I'm not sure what your project is yet
Ben Hart
@Benjmhart
Nov 26 2017 23:50 UTC
@jimtryon i got it, should have been useing mouseup event instead of the click event
Micah M.
@mcmxl22
Nov 26 2017 23:52 UTC
@jordanleo7 I am working on the portfolio project. I got it working with<div class="btn" id="one"><img src="#"></img></div>
Jordan
@jordanleo7
Nov 26 2017 23:55 UTC
@mcmxl22 I'm not sure but I think it may be more correct to use links with img instead of buttons with img for the purpose of your site