These are chat archives for FreeCodeCamp/Help

1st
Jan 2019
Kelechi Chinaka
@ke1echi
Jan 01 00:18
Happy New Year :dancer:
Abhishek Ghosh
@abhishekghosh97
Jan 01 01:55
@VicPopescu thanks a lot
Levis
@agabyte
Jan 01 04:50
happy new year!
Anand Potukuchi
@anandpotukchi
Jan 01 05:29
how do i check wheter a url is valid
(anything except for regex)
Aditya
@ezioda004
Jan 01 06:15
You mean valid domain name?
glitz20
@glitz20
Jan 01 06:24
hey guys how can I make a component fixed even on scrolling in react?
Anand Potukuchi
@anandpotukchi
Jan 01 06:50
@glitz20 tht's css
not in react
@chiquetana we have a chinese channel
please ask there
chiquetana
@chiquetana
Jan 01 06:54
where?
Anand Potukuchi
@anandpotukchi
Jan 01 07:40
app.post('/api/shorturl/new', function (req, res) {

  var url = req.body.url;

 URL.findOne({ original_url: url }, function (err, doc) {

     if(err) {

       res.json({

       error : err
       });

     } else {

      res.json(doc);

     } 


 });


    if(checkURL(url)) {
 var newURL = new URL({

    original_url : url
  });

  newURL.save();
  res.json(newURL);

    } else {
    res.json({"error":"invalid URL"});
    }


});
im trying to determine whether a url exists in the db
im getting an error
failed to start application on wary-puffin.glitch.me

This is most likely because your project has a code error.
Check your project logs, fix the error and try again.
Anand Potukuchi
@anandpotukchi
Jan 01 07:47
checked spelling for the field name xomeomne
@ezioda004
please help
Anand Potukuchi
@anandpotukchi
Jan 01 08:05
igured it out
Levis
@agabyte
Jan 01 08:40
How do I create an object from an array using map?
Using the index as a key
Or the length of the strings in the array as a key
var a = {‘a’, ’b’, ’c’}
korzo
@korzo
Jan 01 08:43

@agabyte

Or the length of the strings in the array as a key
It will not work as more strings could have the same length

Levis
@agabyte
Jan 01 08:43
Sorry, assume the lengths of the strings in the array are unique
korzo
@korzo
Jan 01 08:43
The you can use array.reduce
Levis
@agabyte
Jan 01 08:44
But the challenge specifically asks to use map
korzo
@korzo
Jan 01 08:47
What's the name of challenge? Or post link
Aditya
@ezioda004
Jan 01 08:48
@anandpotukchi :thumbsup:
@agabyte .map() always returns a new array, if you can use .reduce() to make a new object from array.
Anand Potukuchi
@anandpotukchi
Jan 01 08:49
can you please verify this
I mean look at it
Aditya
@ezioda004
Jan 01 08:52
@anandpotukchi For www.freecodecamp.org why does it say "invalid URL"
It should shorten the link as its a valid domain.
Anand Potukuchi
@anandpotukchi
Jan 01 08:53
@ezioda004 need to add http
Aditya
@ezioda004
Jan 01 08:53
Then why does www.google.com work?
Anand Potukuchi
@anandpotukchi
Jan 01 08:53
hmmm
Aditya
@ezioda004
Jan 01 08:53
Seems inconsistent and unintuitive.
Anand Potukuchi
@anandpotukchi
Jan 01 08:55
@ezioda004 google.com isnt working either
Aditya
@ezioda004
Jan 01 08:56
How are you checking for domain?
If the URL is already in the DB then it should return the shorted version of it.
Anand Potukuchi
@anandpotukchi
Jan 01 08:57
yes
redirects to freecodecamp.org
so i need to make aure that th ehttp is optional and not compulsory
Anand Potukuchi
@anandpotukchi
Jan 01 11:36
hwo do iredirct to an external source
when the url is likegoogle.com
its reidrecting to [app_url]/google.com
@ezioda004
any tips
Johnny
@JohnnyBizzel
Jan 01 12:22
@anandpotukchi append http to the URL?
Anand Potukuchi
@anandpotukchi
Jan 01 12:22
@JohnnyBizzel what if the url has http by default?
Johnny
@JohnnyBizzel
Jan 01 12:23
If url starts with www, append http
or if url starts with http (don't append)
Parse or regex the url
... before saving in the DB
Johnny
@JohnnyBizzel
Jan 01 12:30
Actually there is a URL schema type in mongoose.
@anandpotukchi are you using that?
Anand Potukuchi
@anandpotukchi
Jan 01 12:31
nope
ill check tho
thanks
@JohnnyBizzel
Anand Potukuchi
@anandpotukchi
Jan 01 15:05
@JohnnyBizzel cant find anything like that
May Kittens Devour Your Soul
@diomed
Jan 01 15:53
Kelechi Chinaka
@ke1echi
Jan 01 16:05
scss.JPG
pls guys i need help with this dont know what am doing wrongly
fail 1 test
https://learn.freecodecamp.org/front-end-libraries/sass/create-reusable-css-with-mixins
Christopher McCormack
@cmccormack
Jan 01 16:32
@ke1echi the @include should be in your #awesome selector
Check the example:
div {
  @include box-shadow(0px, 0px, 4px, #fff);
}
Kelechi Chinaka
@ke1echi
Jan 01 16:35
ohkay @cmccormack tnx and happy new year 2u
Christopher McCormack
@cmccormack
Jan 01 16:35
@ke1echi you too!
Man Patel
@ManPate78394373_twitter
Jan 01 17:24
i want chatroom style file
May Kittens Devour Your Soul
@diomed
Jan 01 17:38
why is Christmas merry and new year is happy?
I dont know, but let it be, let it be, let it be...
may it be
Anand Potukuchi
@anandpotukchi
Jan 01 18:15
Thanks @JohnnyBizzel
Johnny
@JohnnyBizzel
Jan 01 18:16
@anandpotukchi :+1:
Anand Potukuchi
@anandpotukchi
Jan 01 18:16
Anyone know any product based companies using MERN stack?
glitz20
@glitz20
Jan 01 20:08
anybody who knows how to make a component fixed in react?
tundeiness
@tundeiness
Jan 01 20:08
Hi guys. Happy new year you all. So I still need some push to completing my marked react previewer but I have been battling with making sure the input outputs well in the previewer using the proper formatting text like \n and \r but so far it has not been totally successful. Most of the text input I want to set on a newline does not work even if I set it on a new line with \n and this has been frustrating. I have been looking for documentations to read to achieve near perfect formatting but I haven't found any . At the moment I need guide on properly formatting the text in my editor so that it can appear well as it should in the previewer. Here is my codepen on the work so far: https://codepen.io/highness/pen/ebNYVX?editors=0010 looking forward to responses. thanks.
glitz20
@glitz20
Jan 01 20:08
 <Row>
                    <Col className="filter" xs={4} md={4}>
                       Ab


                    </Col>

                    <Col className="hometext" xs={8} md={8}>
                        {this.itemRow()}

                    </Col>

                </Row>
tundeiness
@tundeiness
Jan 01 20:09
@glitz20 Hi. "fixed" in what way please?
glitz20
@glitz20
Jan 01 20:09
I want col "filter" to fixed while "hometext" is scrolling
I donot want it to move
while scrolling
tundeiness
@tundeiness
Jan 01 20:10
@glitz20 do you have a codepen link to look at what you have currently?
glitz20
@glitz20
Jan 01 20:11
.filter {
    padding: 7% !important;
    margin: 0% !important;
    border-right: grey solid 1px;
    border: solid red 2px;
   height:100vh;
    position: -webkit-sticky;
    position: sticky;
    top: 0;
}
tundeiness
@tundeiness
Jan 01 20:12
@glitz20 i think position: fixed will get that working..
@glitz20 give it a try
glitz20
@glitz20
Jan 01 20:13
nope it doesnot
tundeiness
@tundeiness
Jan 01 20:20
@glitz20 is it possible to the the codebase? via codepen link?
@glitz20 one more thing. before you can use either position: sticky or position: fixed you need to have a main container with position: relative then the class filter will be placed in that container for that to work.
tundeiness
@tundeiness
Jan 01 20:35
@glitz20 Row should have a class say mainand it should be styled with position: relative. Since class filter is in Row then it can be styled as position:fixed top:0 and so on.
glitz20
@glitz20
Jan 01 22:02
thanks @tundeiness