These are chat archives for FreeCodeCamp/HelpJavaScript

15th
Aug 2018
Brad
@bradtaniguchi
Aug 15 2018 00:02
nice spot :D
and nice fish haha
Pagnito
@Pagnito
Aug 15 2018 00:04
hey how can i create like a text are where u can drag content into like image and videos and w/e else like this char log
textarea*
Eric Wang
@bigbigDreamer
Aug 15 2018 00:08
Just drag it around like that?
@Pagnito
Pagnito
@Pagnito
Aug 15 2018 00:09
ya like u cn drag images into here
but not necesserily
for now ill be satsified to append with a btn
}G4K1_I$$[JN`_R~}QV]1ZJ.png
like this?
@Pagnito
Pagnito
@Pagnito
Aug 15 2018 00:19
yea
and like if u scroll up and u see images
like tom posted the nature pics
Eric Wang
@bigbigDreamer
Aug 15 2018 00:21
I will send the code to you, you can refer to it
This is the JS file
Tom
@moT01
Aug 15 2018 00:23
IMG_0685.JPG
IMG_0712.JPG
Eric Wang
@bigbigDreamer
Aug 15 2018 00:24
(H_%FHRE]O3BNIBF)%FOU50.png
Tom
@moT01
Aug 15 2018 00:24
"andre the giant" - caught it 3 times in 3 years
Eric Wang
@bigbigDreamer
Aug 15 2018 00:24
this is html file
@moT01 Looks great
Brad
@bradtaniguchi
Aug 15 2018 00:26
haha, all the big fish I catch get eaten :P
Tom
@moT01
Aug 15 2018 00:26
that's why you only catch small ones these dayss
Eric Wang
@bigbigDreamer
Aug 15 2018 00:27
I recently worked on a small crawler project. Would anyone like to work with me on it
Eric Wang
@bigbigDreamer
Aug 15 2018 00:32
like it
Pagnito
@Pagnito
Aug 15 2018 00:47
@bigbigDreamer its that simple?
Eric Wang
@bigbigDreamer
Aug 15 2018 00:48
Are you talking about your problem? Or the crawler
Pagnito
@Pagnito
Aug 15 2018 00:49
my problem
i dont get it tho it says text
Eric Wang
@bigbigDreamer
Aug 15 2018 00:50
Use javascript to manipulate the dom within HTML to make page elements move (equivalent to giving attributes that can be dragged)
Add an ondrop event to your target drag element
Pagnito
@Pagnito
Aug 15 2018 00:53
@bigbigDreamer thnx
Eric Wang
@bigbigDreamer
Aug 15 2018 00:54
You're welcome. I'm a beginner, too.
I have just paid attention to you at github, so I can communicate with you in the future @Pagnito
Pagnito
@Pagnito
Aug 15 2018 00:56
@bigbigDreamer sounds good ill do the same
Eric Wang
@bigbigDreamer
Aug 15 2018 00:57
Yes, the essence of knowledge and technology is sometimes brought about by the collision of intense ideas
At least ,I think that
Pagnito
@Pagnito
Aug 15 2018 02:21
im perplexed as to why my react routes stop working when i log out of the app
Eric Wang
@bigbigDreamer
Aug 15 2018 02:28
you can google
Claudio Restifo
@Marmiz
Aug 15 2018 02:55

im perplexed as to why my react routes stop working when i log out of the app

perhaps is how the route hierarchy is set up

Pagnito
@Pagnito
Aug 15 2018 03:06
@Marmiz my older version has the same hierarchy and it works i dunnno whats diffirent about this one T.T
Claudio Restifo
@Marmiz
Aug 15 2018 03:08
@Pagnito well, something for sure :smile:
if you have a demo feel free to post it :)
Pagnito
@Pagnito
Aug 15 2018 03:10
k ima try a few things then if anything ill make a new branch on github and post alink
Claudio Restifo
@Marmiz
Aug 15 2018 03:11
better a reproducible sandbox :)
Pagnito
@Pagnito
Aug 15 2018 03:14
h wait
my routes are working
but the content is winvisble
i checkd for z index and nothing
plus there is only two components when i click the the link
login page and its header
yea react rredux did something
when i connected my article form
it somehow messed with my login form which isnt connected to redux form
Pagnito
@Pagnito
Aug 15 2018 03:30
ughhhh, y when i type out api/logout the redirect to '/' works perfectly but wit a button it logs me out but doesnt redirect for shit
Claudio Restifo
@Marmiz
Aug 15 2018 03:34
@Pagnito you know that sometimes some route updates may be blocked by the usage of some shouldComponentUpdate under the hood (surprise - surprise, redux connect)
Be sure to give the update blocking section of the docs a read
Pagnito
@Pagnito
Aug 15 2018 04:10
@Marmiz it seems even tho its linked to that route its not loggin me out
<Link to="/api/logout">
                                        <div className="setting">Log Out</div>
                                    </Link>
    app.get("/api/logout", (req, res) => {
        req.logout();
        res.redirect("/");
    });
Error occurred while trying to proxy request /api/logout from localhost:3000 to http://localhost:4000 (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)
Claudio Restifo
@Marmiz
Aug 15 2018 04:16
@Pagnito wait. Are you trying to use both web routing and server routing?
Pagnito
@Pagnito
Aug 15 2018 04:17
ooh wait
omg lol
too much react
k fixed it with an anchor instead of link >.<
Pagnito
@Pagnito
Aug 15 2018 04:49
for some reason i cant apply class to an element
Screen Shot 2018-08-15 at 12.50.29 AM.png
Screen Shot 2018-08-15 at 12.51.59 AM.png
Screen Shot 2018-08-15 at 12.52.52 AM.png
oooooh
Pagnito
@Pagnito
Aug 15 2018 04:55
i think i know what it is
Pagnito
@Pagnito
Aug 15 2018 05:21
hey anyone know where i can find docs for react transitions v2
zhutongtong
@AC-greener
Aug 15 2018 06:07
how to use cloud 9?
Henry
@GitHub-Henry
Aug 15 2018 06:32
@AC-greener consider https://www.heroku.com/ instead
zhutongtong
@AC-greener
Aug 15 2018 06:35
ok, let me try,thank you
Eric Wang
@bigbigDreamer
Aug 15 2018 07:11
Who can tell me how to upload my local images on codepen?
Kelechi Chinaka
@ke1echi
Aug 15 2018 08:20
https://postimages.org/ @bigbigDreamer
Eric Wang
@bigbigDreamer
Aug 15 2018 08:21
I can't open it
why?
@ke1echi
I know ,I konw ....Probably because, in China, some foreign websites are blocked
alas!
Kelechi Chinaka
@ke1echi
Aug 15 2018 08:31
oh
maybe you need a local image hosting site then @bigbigDreamer
Eric Wang
@bigbigDreamer
Aug 15 2018 08:32
Thank you. I'll try @ke1echi
Patrick star and Sponge bob
@Joshua-leyer
Aug 15 2018 09:31
How do you learn by yourself? I feel that I have finished html and css, but I don’t know how to write a web page. I feel very hard to imitate. Who wants to give way
Eric Wang
@bigbigDreamer
Aug 15 2018 09:32
You can do some little exercises
for example
6ON176J75K2{26ZIC{OFD_G.png
Patrick star and Sponge bob
@Joshua-leyer
Aug 15 2018 09:34
@bigbigDreamer i think so ,but i don't know where ,and ,so many is how long . I can't accurately understand the meaning of css.
Eric Wang
@bigbigDreamer
Aug 15 2018 09:36
HTML is like white paper. CSS is like a brush
@Joshua-leyer
use brush draw a picture
Patrick star and Sponge bob
@Joshua-leyer
Aug 15 2018 09:39
u from china ?
@bigbigDreamer
Eric Wang
@bigbigDreamer
Aug 15 2018 09:39
I'm a Chinese
and you
Patrick star and Sponge bob
@Joshua-leyer
Aug 15 2018 09:40
too
Eric Wang
@bigbigDreamer
Aug 15 2018 09:40
Ok
Patrick star and Sponge bob
@Joshua-leyer
Aug 15 2018 09:41
can i add u vx ?
be my teacher
Eric Wang
@bigbigDreamer
Aug 15 2018 09:42
No, no, no, no, I think this is the best communication environment, I don't play WeChat anymore
Patrick star and Sponge bob
@Joshua-leyer
Aug 15 2018 09:42
i went to bomb
Eric Wang
@bigbigDreamer
Aug 15 2018 09:42
You can confide in me
Patrick star and Sponge bob
@Joshua-leyer
Aug 15 2018 09:43
ok thanks
Bryan Xu
@bryanpalau
Aug 15 2018 10:00

I am lost in this one @@ help
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/stand-in-line/

function nextInLine(arr, item) {
// Your code here

return item; // Change this line
}

// Test Setup
var testArr = [1,2,3,4,5];

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));

Aditya
@ezioda004
Aug 15 2018 10:04
@bryanpalau As said in the description, you're implementing a queue data structure via array. You need to add an element to its end and remove the first element from it (return the same removed element).
Bryan Xu
@bryanpalau
Aug 15 2018 10:14
@ezioda004 thanks for the help, I am still clueless because I do not know what elements to add ...
Aditya
@ezioda004
Aug 15 2018 10:20
@bryanpalau function nextInLine(arr, item) {} this is the function given, arr is the array you need to implement queue on and item is the item that you need to add to arr
Nate Mallison
@NJM8
Aug 15 2018 12:25
Anyone can help me with a http error? I'm trying to setup an axios interceptor to grab a bad token response and for some reason I'm getting a cors error in the interceptor, but I can see the options request in my browser is a 200 followed by the 401 Unauthorized I'm trying to grab.
Eric Wang
@bigbigDreamer
Aug 15 2018 13:01
I want to do secondary development for BootStrap and prepare to build my own UI library. Do you have any good ideas
Jason Luboff
@JLuboff
Aug 15 2018 15:09
Morning :wave:
Christopher McCormack
@cmccormack
Aug 15 2018 15:12
@JLuboff yo :wave:
Jason Luboff
@JLuboff
Aug 15 2018 15:14
What up
Christopher McCormack
@cmccormack
Aug 15 2018 15:15
working on a InterviewBit challenge
looks easy enough
Chris
@crokita
Aug 15 2018 15:16
uhoh
Jason Luboff
@JLuboff
Aug 15 2018 15:16
ugh... I've tried something similar on codewars...not fun lol
Chris
@crokita
Aug 15 2018 15:16
this immediately reminds me of another problem
Christopher McCormack
@cmccormack
Aug 15 2018 15:17
my logic is to iterate over each point then
increase x and y until x or y matches destination x or y
increase non-matching value x or y until destination reached
hope it works out!
Jason Luboff
@JLuboff
Aug 15 2018 15:23
I too hope
Christopher McCormack
@cmccormack
Aug 15 2018 15:23
hah thanks
you should do it too if you're bored :)
Jason Luboff
@JLuboff
Aug 15 2018 15:23
I'm trying to get a query to output XML... so..not sure if I'd say bored or insane at the moment
Christopher McCormack
@cmccormack
Aug 15 2018 15:24
both!
Jason Luboff
@JLuboff
Aug 15 2018 15:25
The only reason I'm doing it...is I think it will give me my data in a format where I don't have to manipulate it a dozen times (maybe..)
Christopher McCormack
@cmccormack
Aug 15 2018 15:36
solid logic
Jason Luboff
@JLuboff
Aug 15 2018 15:37
Ya.. but..damn it's proving to be a pain one way or the other lol
Christopher McCormack
@cmccormack
Aug 15 2018 15:40
why not JSON?
Jason Luboff
@JLuboff
Aug 15 2018 15:41
Support for FOR JSON only came about in SQL Server 2016
We're running 2008 R2 I believe (or its 2008).
There's a lot of features in 2017 that I would like to take advantage of..
Jefferson
@jeffersonnnn
Aug 15 2018 15:47
Hi guys, in a moral quandary and i'd like some thoughts, please. So i am practicing interview questions and using cracking the code interview (this thing is fabulous: i feel like i should pay Ms Gayle again after getting the job) and i am getting stuck a lot. Do you guys thing i should use Google seeing as it won't be allowing during whiteboarding or just stay stuck (kinda where i am right now and it is depressing tbh) Thoughts?
Christopher McCormack
@cmccormack
Aug 15 2018 15:49
There's no shame in seeing how other people have solved problems, it will help you understand their thought process and use that understanding to be able to solve problems later
However, don't be quick about looking up answers. Tackle it from several directions and see what you can come up with
even a rough solution that works is still a solution
Jefferson
@jeffersonnnn
Aug 15 2018 15:50
true true. So use Google sparingly?
Christopher McCormack
@cmccormack
Aug 15 2018 15:50
These problems are designed for you to break them down into small parts and try to figure out the constraints and what will be needed to solve them. They aren't supposed to be tricky necessarily
So if you read others solutions you may think you're lacking understanding when, in reality, many of those solutions are from people who have seen the problem, solved it, and seen other answers that allowed them to create tricky solutions
@jeffersonnnn I think that's a good rule of thumb in general :)
Jefferson
@jeffersonnnn
Aug 15 2018 15:53
you know, i just saw an answer to a common problem (the answer is strewn over the interwebs) and i realised that i could have come up with it. Okay then. I think i will try this is survival mode. Pure head work.
Christopher McCormack
@cmccormack
Aug 15 2018 15:54
@jeffersonnnn really most of the problems look hard at first glance - and many times they attempt to make it vague. personally I like to write down what I think the steps might be, along with test cases that will help me understand how to get from A to B or whatever
I think on average they can take at least an hour, some many more depending on skill level
so if you don't get the right away you're in good company
But DO make sure if you answer the problem correctly that you review the other solutions, that can teach you a load of new ideas that can help for future problems
Don't just look at them, really try to understand them
ArchivalBoat50
@ArchivalBoat50
Aug 15 2018 16:05

Hey guys I'm doing the Drop It algorithm and I am quite close.

function dropElements(arr, func) {
  for (let i=0; i<arr.length; i++) {
   if (arr.every(func) === true) {
    break;
  }
  else {
    arr.splice(i--, 1);
  }
}
  return arr;
}

dropElements([1,2,3,9,2], function(n) {return n > 2; });

Why is it that dropElements([1,2,3,9,2], function(n) {return n > 2; }); returns []

But dropElements([1, 2, 3, 7, 4], function(n) {return n > 3;}) returns [7, 4]

Moisés Man
@moigithub
Aug 15 2018 16:10
@ArchivalBoat50 u can use this tool http://www.pythontutor.com/javascript.html#mode=edit
to check how ur code work step by step
ArchivalBoat50
@ArchivalBoat50
Aug 15 2018 16:11
@moigithub Oh thanks,
Blauelf
@Blauelf
Aug 15 2018 16:11
@ArchivalBoat50 The task does not require all numbers of the remaining array to fulfill the condition, only the first one.
ArchivalBoat50
@ArchivalBoat50
Aug 15 2018 16:13
@Blauelf That is what I'm trying to accomplish
Blauelf
@Blauelf
Aug 15 2018 16:13
every has no place there.
ArchivalBoat50
@ArchivalBoat50
Aug 15 2018 16:20
@Blauelf Oh I see, because every will keep going, even if it returned true
Blauelf
@Blauelf
Aug 15 2018 16:27
This challenge is from a time when there was no findIndex :D
(doing the loop yourself also isn't too hard - unless you use every, which is another loop)
Ankur sharma
@ankur1163
Aug 15 2018 18:15
can someone help me out
I have this code
<div class="col-1-of-2">
              <div class="composition">
                <img src="img/nat-1-large.jpg" alt="Photo 1" class="composition__photo composition__photo--p1">
                <img src="img/nat-2-large.jpg" alt="photo 2" class="composition__photo composition__photo--p2">
                <img src="img/nat-3-large.jpg" alt="Photo 3" class="composition__photo composition__photo--p3">
              </div>
           </div>
.composition{

      &__photo{
        width: 55%;
        box-shadow: 0 1.5rem 4rem rgba($color-black,.4);
        border-radius:2px;


      }
}
I dont see this effect
Ankur sharma
@ankur1163
Aug 15 2018 18:23
ok, i just tried to recompile scss files and its stuck
Christopher McCormack
@cmccormack
Aug 15 2018 18:32
@ankur1163 what does $color-black look like?
Brad
@bradtaniguchi
Aug 15 2018 18:34
just read all the typescript documentation, still didn't find what I needed :/
Christopher McCormack
@cmccormack
Aug 15 2018 18:34
@bradtaniguchi a prayer?
Brad
@bradtaniguchi
Aug 15 2018 18:35
Yea pretty much, pretty complicated use-case, just went along with a simplier solution and its working out hehe
Diego Mayer
@Chrono79
Aug 15 2018 18:35

@ankur1163 what does $color-black look like?

black? ;)

Christopher McCormack
@cmccormack
Aug 15 2018 18:36
har
Ankur sharma
@ankur1163
Aug 15 2018 18:36
yeah @Chrono79
its a variable
Christopher McCormack
@cmccormack
Aug 15 2018 18:36
yes...
can you show the code?
Diego Mayer
@Chrono79
Aug 15 2018 18:37
I was discarding daltonism ;)
Ankur sharma
@ankur1163
Aug 15 2018 18:37
I tried to compile scss files again
but its stuck
Ankurs-Air:sass ankursharma$ npm run compile:sass

> natoure@1.0.0 compile:sass /Users/ankursharma/Downloads/advanced-css-course-master/Natours/starter
> node-sass sass/main.scss css/style.css -w
its stuck here, so that might be the reason
Christopher McCormack
@cmccormack
Aug 15 2018 18:38
@ankur1163 that's watch mode, did you save after running?
Simon Cordova
@gbsimon87
Aug 15 2018 18:38
Ey oh!
Christopher McCormack
@cmccormack
Aug 15 2018 18:38
@gbsimon87 heyah
Ankur sharma
@ankur1163
Aug 15 2018 18:39
yeah i saved
but i feel like i should see green line
Christopher McCormack
@cmccormack
Aug 15 2018 18:39
@ankur1163 check your css output
Ankur sharma
@ankur1163
Aug 15 2018 18:39
i made some changes in html, save d it.
Christopher McCormack
@cmccormack
Aug 15 2018 18:39
and paste it here if you like
Ankur sharma
@ankur1163
Aug 15 2018 18:39
i dont think it compiled
Christopher McCormack
@cmccormack
Aug 15 2018 18:40
no errors in your terminal?
Ankur sharma
@ankur1163
Aug 15 2018 18:40
no
looks like it is stuck
Christopher McCormack
@cmccormack
Aug 15 2018 18:40
@ankur1163 can you please post the scss code for $color-black??
I feel you are actively ignoring a potential issue
Ankur sharma
@ankur1163
Aug 15 2018 18:41
//colors
$color-primary:#55c57a;
$color-primary-light:#7ed56f;
$color-primary-dark:#28b485;
$color-grey-dark:#777;
$color-white:#fff;
$color-black:#000;
$color-grey-light-1:#f7f7f7;

//font sizes
$default-font-size:1.6rem;


//grid-test
$grid-width:114rem;
$gutter-vertical:8rem;
$gutter-horizontal:6rem;
Christopher McCormack
@cmccormack
Aug 15 2018 18:41
@ankur1163 there you go
that's not rgba
that's hex
don't think you can put hex in rgba
Ankur sharma
@ankur1163
Aug 15 2018 18:42
i'll try to csimple color
and check
Christopher McCormack
@cmccormack
Aug 15 2018 18:43
Ankur sharma
@ankur1163
Aug 15 2018 18:43
yes sir
it worked
:)
Christopher McCormack
@cmccormack
Aug 15 2018 18:43
:thumbsup:
Ankur sharma
@ankur1163
Aug 15 2018 18:43
i changed it to
box-shadow: 0 1.5rem 4rem rgba(255,0,0,.4);
and it worked and compiled also
thanks @cmccormack
Christopher McCormack
@cmccormack
Aug 15 2018 18:43
awesome!
I wonder why you didn't see errors. do you see a log file or anything in your root dir?
Ankur sharma
@ankur1163
Aug 15 2018 18:44
no
normally, i was seeing error yesterday
but not today
Christopher McCormack
@cmccormack
Aug 15 2018 18:44
strange
Ankur sharma
@ankur1163
Aug 15 2018 18:44
the whole coding is strange
lol
but thanks seriously
Brad
@bradtaniguchi
Aug 15 2018 21:40
anyone here have any experience with docker at all? I want to use it for local development testing, where I can setup a new mongodb instance, and tear it down for clean e2e testing
Jason Luboff
@JLuboff
Aug 15 2018 21:40
Nope
Christopher McCormack
@cmccormack
Aug 15 2018 21:44
keep meaning to but get bored when I realize I don't have a project
@bradtaniguchi if you find good resources please share!
Brad
@bradtaniguchi
Aug 15 2018 21:46
I found this article I might try later to see if I could tweak it to my needs
I've been reading about docker, but the leap from reading/learning and using is huge. I blame the vastness of features XD
Jason Luboff
@JLuboff
Aug 15 2018 21:50
I know @forkerino uses docker at work...but..I haven't seen him around for a while
Christopher McCormack
@cmccormack
Aug 15 2018 21:52
yeah he's busy being a pro dev now
a provocative deviant
Jason Luboff
@JLuboff
Aug 15 2018 21:52
Hmmm..guess I get to start calling myself a pro dev now.. or at least almost.. just waiting on the actual announcement to call myself one lol
Jason Luboff
@JLuboff
Aug 15 2018 21:58
views/review.hbs          | 1827 ++++++++++++++++++++++++++-------------------
I guess I changed a few lines there...
Diego Mayer
@Chrono79
Aug 15 2018 22:02
I'm a pro dev, a procrastinator developer ;)
Jason Luboff
@JLuboff
Aug 15 2018 22:11
@Chrono79 Aren't we all :)
Brad
@bradtaniguchi
Aug 15 2018 22:11
1.8k lines in 1 file, man I thought I was looking at walls of code :P
Jason Luboff
@JLuboff
Aug 15 2018 22:12
@bradtaniguchi Its a template file...with a lot of repeating code lol. I can probably clean it up a ton but for now its fine
I know I have 4 blocks of code that are the duplicates but becuase handlebars doesn't have built in conditional operators, I went that route. Could make a helper to handle that though. Additionally... I probably only need one code block per section and just do a bunch of the checks inside there but meh. Maybe I'll change that in the future
Christopher McCormack
@cmccormack
Aug 15 2018 22:15
@Chrono79 hah
Jason Luboff
@JLuboff
Aug 15 2018 22:19
:joy:
Brad
@bradtaniguchi
Aug 15 2018 22:20

Maybe I'll change that in the future

I think the guy who did the code I'm re-building said the same thing :P

Jason Luboff
@JLuboff
Aug 15 2018 22:20
It was a situation of building/changing as I went so.. it turned into what it is..a monster!
Brad
@bradtaniguchi
Aug 15 2018 22:21
Sounding more and more familar :0
Jason Luboff
@JLuboff
Aug 15 2018 22:22
Now now lol
Fikry82
@Fikry82
Aug 15 2018 23:45
how i know if a number is a fractions with javascript
Fikry82
@Fikry82
Aug 15 2018 23:49
Number.isInteger
thx
Brad
@bradtaniguchi
Aug 15 2018 23:50
:+1: I was lazy and just googled it :P
I would like to add Number.isInteger is es6 standard, so no IE support
Jason Luboff
@JLuboff
Aug 15 2018 23:53
Oh thats a nice addition
Fikry82
@Fikry82
Aug 15 2018 23:54
who cares about IE :)