These are chat archives for FreeCodeCamp/HelpFrontEnd

6th
Sep 2018
Marc
@MWBauer
Sep 06 2018 02:49
Anyone here tonight>?
Pjdaze
@Pjdaze
Sep 06 2018 05:44
hi any wordpress image size experts here
got a client that needs help with image sizes being to big when i upload them
no matter ho much i rezise or optimize
Yashwardhan Pauranik
@yashwp
Sep 06 2018 12:17
@yashwp
I have this situation in my Angular application where I have to change the initial part of URL based on a property to be true or false. How can I do that in my app.
initially all my URLs will be https://cdn-expa.aiesec.org/some-img.png but problem aries when the object ---> {"feature":"cdn_enabled", "active":true} the field active will turns to false.
Then in that case I want all the URLs in my applications to be changed to https://s3-eu-west-1.amazonaws.com/cdn.expa.aiesec.org/some-img.png.
This has to be done at run time as soon as the user visit my application and my API can return any value true or false based on user location.
How can I do this thing? Can anybody guide me on this?
AJ Brommy
@AJ-Brommy
Sep 06 2018 16:27

I was doing so well on my own, really wanted to achieve this one without asking for help, but something has happened, and I am stumped lol...

I've got a flex box container, 3 boxes, 30% each, in a row, justify center. All good. But for smaller screens I decided to change it to columns, and make them 80% wide instead. For some reason, I do not understand, they shift over to the left instead of being centered :(

Yashwardhan Pauranik
@yashwp
Sep 06 2018 16:30
Can we call .fetch() API in environment.ts?
AJ Brommy
@AJ-Brommy
Sep 06 2018 17:00
It would appear that justify-content: center; doesn't work with flex-direction: column;
Eric Weiss
@eweiss17
Sep 06 2018 17:10
align-items: center?
AJ Brommy
@AJ-Brommy
Sep 06 2018 17:12
well that aligns vertically, i thought?
lol - seems to have worked! So I've clearly misunderstood something
thanks for pointing that out
I'm even looking at this https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Aligning_Items_in_a_Flex_Container
and I still don't understand how that works lol
AJ Brommy
@AJ-Brommy
Sep 06 2018 17:19
ok, i think i understand. basically, the x and y kind of swap depending on if it is set to row or column. So justify-content: center does vertical alignment when set to column but when set to row does horizontal alignment.
Mandeep
@mandeephub
Sep 06 2018 17:22
getting an error
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line
   var lookup = {
    "alpha" : "Adams",
    "bravo" : "Boston",
    "charlie" : "Chicago",
    "delta" : "Denver",
    "echo" : "Easy",
    "foxtrot" : "Frank"

  };

  // Only change code above this line
  return result;
}

// Change this value to test
phoneticLookup("charlie");
]
whats the issue here
AJ Brommy
@AJ-Brommy
Sep 06 2018 17:24
i'm not sure why [] are in there at the beginning and end
which lesson is this?
Mandeep
@mandeephub
Sep 06 2018 17:25
Basic JavaScript: Using Objects for Lookups
Brad
@bradtaniguchi
Sep 06 2018 17:27
yea that last line has a random bracket, delete it
Mandeep
@mandeephub
Sep 06 2018 17:28
// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line
   var lookup = {
    "alpha" : "Adams",
    "bravo" : "Boston",
    "charlie" : "Chicago",
    "delta" : "Denver",
    "echo" : "Easy",
    "foxtrot" : "Frank"

  };

  // Only change code above this line
  return result;
}

// Change this value to test
phoneticLookup("charlie");
same error
Eric Weiss
@eweiss17
Sep 06 2018 17:29
result = "";
AJ Brommy
@AJ-Brommy
Sep 06 2018 17:29
i think you are supposed to be using numbers
Eric Weiss
@eweiss17
Sep 06 2018 17:29
you declare and object...
AJ Brommy
@AJ-Brommy
Sep 06 2018 17:29
1: "Adams"?
Eric Weiss
@eweiss17
Sep 06 2018 17:29
then return result which = ""
AJ Brommy
@AJ-Brommy
Sep 06 2018 17:30
no sorry ignore me lol
i just read further down
i know the problem
you haven't used val
Brad
@bradtaniguchi
Sep 06 2018 17:32
I dont think your getting an error, I think your just not passing the test right?
AJ Brommy
@AJ-Brommy
Sep 06 2018 17:32
you've returned result as an empty string
Mandeep
@mandeephub
Sep 06 2018 17:33
when i m trying to do it like this Im getting it right
https://jsbin.com/zucoquk/edit?js,console
AJ Brommy
@AJ-Brommy
Sep 06 2018 17:33
and in there you havent used the result variable
you need to attach the array with the val into result
one line of code is missing
result = ?
Mandeep
@mandeephub
Sep 06 2018 17:34
@AJ-Brommy ok let me try doing that
AJ Brommy
@AJ-Brommy
Sep 06 2018 17:35
:)
Brad
@bradtaniguchi
Sep 06 2018 17:36
looking back at that challenge, I didn't even use objects when I did it haha
AJ Brommy
@AJ-Brommy
Sep 06 2018 17:37
:O
tut tut lol
how ya getting on @mandeephub ?
Mandeep
@mandeephub
Sep 06 2018 17:38
@AJ-Brommy blankkkk
AJ Brommy
@AJ-Brommy
Sep 06 2018 17:38
?
Mandeep
@mandeephub
Sep 06 2018 17:38
not getting
AJ Brommy
@AJ-Brommy
Sep 06 2018 17:38
what ya got now? can we see the new code?
Eric Weiss
@eweiss17
Sep 06 2018 17:39
this challenge wants you to search for a key within an object and return the value?
does the description in the challenge tell you how to do this? or is it non descriptive
AJ Brommy
@AJ-Brommy
Sep 06 2018 17:40
i think its a genuine mistake any of us could have made when learning to program
Mandeep
@mandeephub
Sep 06 2018 17:41
@AJ-Brommy y i cant see that
AJ Brommy
@AJ-Brommy
Sep 06 2018 17:41
show me what you got
I recon you will kick yourself when you see it lol
Mandeep
@mandeephub
Sep 06 2018 17:42
// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line
   var lookup = {
    "alpha" : "Adams",
    "bravo" : "Boston",
    "charlie" : "Chicago",
    "delta" : "Denver",
    "echo" : "Easy",
    "foxtrot" : "Frank"
  };

  // Only change code above this line
  return result.lookup[val];
}

// Change this value to test
phoneticLookup("charlie");
AJ Brommy
@AJ-Brommy
Sep 06 2018 17:42
only change code above this line ;)
maybe its how i worded it, i didn't mean attach in that way. sorry. you need to insert the value into the result variable. above the line it says only change code above this line.
but at the same time now you need to put the return line back how it was. which should just read return result;
Mandeep
@mandeephub
Sep 06 2018 17:45
ok
AJ Brommy
@AJ-Brommy
Sep 06 2018 17:46
you are close :)
Mandeep
@mandeephub
Sep 06 2018 17:46
// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line
   var lookup = {
    "alpha" : "Adams",
    "bravo" : "Boston",
    "charlie" : "Chicago",
    "delta" : "Denver",
    "echo" : "Easy",
    "foxtrot" : "Frank"
  };
     result = lookup[val]
  // Only change code above this line
  return result
}

// Change this value to test
phoneticLookup("charlie");
AJ Brommy
@AJ-Brommy
Sep 06 2018 17:46
semi colon ;)
;
Mandeep
@mandeephub
Sep 06 2018 17:47
You should not modify the return statement
:-(
AJ Brommy
@AJ-Brommy
Sep 06 2018 17:47
because you have no semi colon
Mandeep
@mandeephub
Sep 06 2018 17:47
:-)
@AJ-Brommy thanks for taking me there
AJ Brommy
@AJ-Brommy
Sep 06 2018 17:48
you're welcome :)
alpox
@alpox
Sep 06 2018 18:26
@AJ-Brommy Javascript can live without semicolons
But its better to be consistent ofc.
AJ Brommy
@AJ-Brommy
Sep 06 2018 18:32
well, he needed to pass, and it wouldn't pass without it, especially on the return line.
but yes, probably best practice to use them, will create less issues transferring to other languages like c or java etc. even if it does allow without the semi colon, probably not worth thinking much about coding that way. but i suppose it might be useful to know that.
Neil
@NNeil1
Sep 06 2018 21:22
I keep needing to add 0 margin and padding to my body or universal selector, to get rid of the white space at the top of the screen, but what this is making me do is use !important on all other classes I need to add margin/padding to. - What is the solution to this
newmoon
@newmoon
Sep 06 2018 21:32
@NNeil1 Sounds like maybe a collapsing margin issue - can you share an example?
Neil
@NNeil1
Sep 06 2018 21:32
its an offline project I just started working on, I've fixed it with as CSS reset
jsjoe82
@jsjoe82
Sep 06 2018 22:11

https://codepen.io/jsjoe82/pen/yxoRjL

Could anyone help me figure out why my tribute page test is failing on the responsive image bit? It's the only one I am missing. I thought I got the breakpoints right. Any help or pointing in the right direction would be appreciated.