These are chat archives for FreeCodeCamp/HelpJavaScript

8th
Jan 2019
Jason Luboff
@JLuboff
Jan 08 00:18
testing is cool. Changed a bit of my route, and instead of having to manually test it, ran my test saw a failure and fixed it
Brad
@bradtaniguchi
Jan 08 00:59
:+1:
Rémi Fortier
@mizujin
Jan 08 03:22
Hey guys, I played around a recurvise function that flattens a deeply nested json object.. but i'm having a hard time understanding it
Nitin
@thenm
Jan 08 06:54
I want to configure my site to support multi language how can I do that?
Aditya
@ezioda004
Jan 08 07:04
@cmccormack @JLuboff Did you guys do the socket.io challenges?
Nitin
@thenm
Jan 08 07:10
please suggest template for admin portal
for vue project
Jefferson
@jeffersonnnn
Jan 08 07:36
a happy new year guys. wishing you and yours the best this year.
abraham anak agung
@padunk
Jan 08 08:54
@ezioda004 just do it last week. Need updates tho
Aditya
@ezioda004
Jan 08 09:22
@padunk Were challenges working for you?
abraham anak agung
@padunk
Jan 08 09:24
@ezioda004 well much of it still don't work, idk why. You need to update all the packages in package.json tho
some challenges i can't passed, so i ignore it for now. Maybe the test is wrong, idk.
i'm currently on this challenge
@ezioda004 I can't passed this challenges:
Create New Middleware
Not PassedLogging a User Out
Not PassedRegistration of New Users
How bout you?
Aditya
@ezioda004
Jan 08 09:33
@padunk I have not tried passport challenges, but seems like theres quite some problems with Advanced Node challenges. If you have time, can you open an issue regarding the challenges which have issues here?
Would be easier to track and hopefully we can update and fix the challenges ASAP.
abraham anak agung
@padunk
Jan 08 09:38
@ezioda004 sure, i was thinking of contributing and updating it too. Basically Advance Node challenges really need significant updates.
Garrus Napp
@GarrusNapp
Jan 08 10:03
Hello guys, I need help with React! Anyone brave? :)
Tiago Correia
@tiagocorreiaalmeida
Jan 08 11:05
everyone here is brave, just ask @GarrusNapp
Garrus Napp
@GarrusNapp
Jan 08 11:13
@tiagocorreiaalmeida I've already got an answer, thanks anyway!! :)
abraham anak agung
@padunk
Jan 08 12:30
What is lambda functions?
Garrus Napp
@GarrusNapp
Jan 08 12:35
@padunk small anonymous functions
Jason Luboff
@JLuboff
Jan 08 16:08
@ezioda004 I have not done those challenges. I have built the stock chart app thoiugh which uses socket.io
Kelechi Chinaka
@ke1echi
Jan 08 16:42
is fcc down? can't access site
Christopher McCormack
@cmccormack
Jan 08 16:44
up for me
keeps loading forever
Christopher McCormack
@cmccormack
Jan 08 16:49
that is also loading fine for me, maybe try in another browser
Kelechi Chinaka
@ke1echi
Jan 08 16:52
ok I'll do that @cmccormack
Jason Luboff
@JLuboff
Jan 08 16:52
Also works fine for me
Kelechi Chinaka
@ke1echi
Jan 08 16:54
same issue on IE
Jason Luboff
@JLuboff
Jan 08 16:58
Try clearing cache/history? Shouldn't affect across different browsers..but worth a shot. Also restart your computer
Mohammed Boudad
@matrixersp
Jan 08 17:30
Hey guys, what's the difference between using Apollo <Query> tag in React and Wrapping the the component with graphql(someQuery)(), and why would someone use one over the other?
Atsushi Toda
@broadsinatlanta
Jan 08 18:22
Hey everyone - I need to confirm if I'm getting a bug or not on the Array.prototype.sort part of the functional programming section.
Jason Luboff
@JLuboff
Jan 08 18:23
Whats the problem?
Atsushi Toda
@broadsinatlanta
Jan 08 18:23
I can't seem to get a clearing score on either sort problems
Jason Luboff
@JLuboff
Jan 08 18:23
Can you send a link as well as your current code?
Atsushi Toda
@broadsinatlanta
Jan 08 18:23
its not a code issue, works perfectly in other environments
have even copy and pasted solutions into it and failed
sure
1 sec
var globalArray = [5, 6, 3, 2, 9];
function nonMutatingSort(arr) {
  // Add your code below this line
  let newArr = arr.concat([]);
  return newArr.sort((a,b) => a > b);
  // Add your code above this line
}
nonMutatingSort(globalArray);

//nonMutatingSort(globalArray) should return [2, 3, 5, 6, 9].
returns the correct array in repl.it but fails in the FCC interface
similar issue in the exercise before
Brad
@bradtaniguchi
Jan 08 18:25
@broadsinatlanta Some of the excersizes don't pass if you don't do it the way they expect, which challenge is this again?
Jason Luboff
@JLuboff
Jan 08 18:25
Can you give me the link to the challenge?
Jason Luboff
@JLuboff
Jan 08 18:26
Hmmm...does concat do a deep clone? If not..thats probably the issue
Atsushi Toda
@broadsinatlanta
Jan 08 18:26
For what its worth, same issue in incognito
Worth raising an issue on GitHub (If there isn't a similar one up already)
?
Jason Luboff
@JLuboff
Jan 08 18:28
@broadsinatlanta Try clearing cache/history/cookies. Your code works fine for me
Brad
@bradtaniguchi
Jan 08 18:28
Same here, code ran just fine
Atsushi Toda
@broadsinatlanta
Jan 08 18:30
Odd, worked in another browser for me too.
Cheers guys, will surely work after clearing
Jason Luboff
@JLuboff
Jan 08 18:30
:thumbsup:
Atsushi Toda
@broadsinatlanta
Jan 08 18:30
is there kudos/point system I can attribute to you @bradtaniguchi @JLuboff
Jason Luboff
@JLuboff
Jan 08 18:31
There used to be....but...FCC killed @camperbot
Atsushi Toda
@broadsinatlanta
Jan 08 18:31
Sucks! Either way, take some good karma from me.
Jason Luboff
@JLuboff
Jan 08 18:31
Taken, thanks! lol
Markus Kiili
@Masd925
Jan 08 18:34
...browsniez...snif
Jason Luboff
@JLuboff
Jan 08 18:35
Those delicious e-brownies...I can still taste them
Brad
@bradtaniguchi
Jan 08 19:17
The one bad part of linux... when things are wrong its scary as hell to try and fix em
Jason Luboff
@JLuboff
Jan 08 19:18
Psh...thats why you say fuck linux :P
Christopher McCormack
@cmccormack
Jan 08 19:21
I dunno I usually find windows issues harder to fix when they arise
granted that isn't too often these days
Jason Luboff
@JLuboff
Jan 08 19:25
Hmmm...either my jsx file is messed up...or my linter is.. complaining about an Unexpected token...but...there's no issues
Guess it was the linter...saved the file and error went away lol
Brad
@bradtaniguchi
Jan 08 19:28
I have a package that looks like it depends upon itself somehow, so I can't remove it :/
Jason Luboff
@JLuboff
Jan 08 19:28
That sounds...retarded
Brad
@bradtaniguchi
Jan 08 19:31
image.png
Jason Luboff
@JLuboff
Jan 08 19:31
Is it possible to drop the entire node_modules and then just npm i again?
Christopher McCormack
@cmccormack
Jan 08 19:31
that message makes sense to me
is the package also v86d?
@JLuboff npm ci
Jason Luboff
@JLuboff
Jan 08 19:32
Yes...depending on his npm version
Brad
@bradtaniguchi
Jan 08 19:35
This isn't npm XD
Jason Luboff
@JLuboff
Jan 08 19:35
oh
Brad
@bradtaniguchi
Jan 08 19:35
Its the archlinux packages on my machine, I think I have to go out and remove some files and install a different package :/
Brad
@bradtaniguchi
Jan 08 19:41
OK I think I fixed it... I had to manually add a file that was required
Jason Luboff
@JLuboff
Jan 08 19:42
Good ol' linux
Yogender
@yb1997
Jan 08 19:49
Just found this awesome article on prototype in JS:
https://hackernoon.com/prototypes-in-javascript-5bba2990e04b
Christopher McCormack
@cmccormack
Jan 08 20:03
@yb1997 I'll probably read it, understand it for 10 minutes, then forget the nuance of it in an hour :) thanks for sharing though
Yogender
@yb1997
Jan 08 20:06
@cmccormack haha just write some prototypal inheritance by yourself, it might help you retain it for longer duration
Christopher McCormack
@cmccormack
Jan 08 20:07
@yb1997 yeah need to get back into it, I have a decent understanding but there are little things that are so simple to forget - in the end you rarely even need to know about it with modern tools so not sure how worth it it even is
Aditya
@ezioda004
Jan 08 20:10

in the end you rarely even need to know about it with modern tools so not sure how worth it it even is

Every day we stray further from god

Jason Luboff
@JLuboff
Jan 08 20:11
My knowledge of prototype is very limited
Yogender
@yb1997
Jan 08 20:11
@cmccormack maybe if someday you need to create an awesome library that may become popular over night and even surpass react in github stars then you'll surely need these things
Christopher McCormack
@cmccormack
Jan 08 20:11
yeah but to look it up will take all of 8 seconds :)
but then after using it for a bit I'm sure I'll remember
@ezioda004 that's funny, I had a similar thought process even while typing that
Yogender
@yb1997
Jan 08 20:13
don't you guys sleep though ? its 1:43 am here
Christopher McCormack
@cmccormack
Jan 08 20:14
it's 13:13 here
Jason Luboff
@JLuboff
Jan 08 20:14
Yes...Yes I do sleep..but its only 12:14 PM
Christopher McCormack
@cmccormack
Jan 08 20:14
still have a few hours before I'm even off work haha
Aditya
@ezioda004
Jan 08 20:14
I've been playing guitar since I got home haha, probably should sleep
Christopher McCormack
@cmccormack
Jan 08 20:14
@ezioda004 sounds nice! Furnished your new place yet?
Aditya
@ezioda004
Jan 08 20:15
@cmccormack Oh yeah, got a furnished apartment
Its a penthouse :D
Christopher McCormack
@cmccormack
Jan 08 20:15
@ezioda004 oh sweet!
should rock out on the balcony, give yourself some mystique
Aditya
@ezioda004
Jan 08 20:16
Its cold outside, I'll rock in my blanket
Jason Luboff
@JLuboff
Jan 08 20:16
@ezioda004 Is all the furniture in good condition? I've never rented a furnished apartment
Christopher McCormack
@cmccormack
Jan 08 20:16
Get a Snuggy lol
Aditya
@ezioda004
Jan 08 20:17
@JLuboff Yeah apartment is new, like ~6 months old, its a sharing one, so other people are bachelors too
Jason Luboff
@JLuboff
Jan 08 20:17
Oh nice
abraham anak agung
@padunk
Jan 08 23:13
Anyone used Gatsby? Is it ok to used styled-components along with typography?
Jason Luboff
@JLuboff
Jan 08 23:15
Sounds way out of my league
Kaz Baig
@kbaig
Jan 08 23:15
@padunk There's a lot of overlap in what they do, but I don't see why not
You'd just need to be careful in managing which overwrites what
abraham anak agung
@padunk
Jan 08 23:16
@kbaig yeah, i new to this, and kind of confuse styling my web
Kaz Baig
@kbaig
Jan 08 23:16
@padunk I only just started using Gatsby a couple days ago too
abraham anak agung
@padunk
Jan 08 23:17
what your suggestion? right now i used typography to set up my base font family and base font size onlly
lol, but it looks pretty fast tho
Kaz Baig
@kbaig
Jan 08 23:17
If you're just using it to get some basic styling over from a certain theme, why not just copy it over from that theme into a styled-components global style?
abraham anak agung
@padunk
Jan 08 23:18
and there is module css, css in js, gosh, so much options
Kaz Baig
@kbaig
Jan 08 23:18
styled components is css in js
abraham anak agung
@padunk
Jan 08 23:19
yup, never used styled components before, they have global style too?
Kaz Baig
@kbaig
Jan 08 23:19
I also started using that last night lol
but yes
abraham anak agung
@padunk
Jan 08 23:20
:smile: i need to dig deeper to this css matter, but i don't really like using styled-components, maybe cause i never used it before, idk...
thanks @kbaig
Kaz Baig
@kbaig
Jan 08 23:20
@padunk np. It's all about preference
nothing wrong with regular css really
abraham anak agung
@padunk
Jan 08 23:21
@kbaig yup, i'm used to regular css, this styled-components like a whole new thing for me.
Kaz Baig
@kbaig
Jan 08 23:21
It's primarily for DX
abraham anak agung
@padunk
Jan 08 23:21
what's DX?
Kaz Baig
@kbaig
Jan 08 23:22
developer experience
abraham anak agung
@padunk
Jan 08 23:22
ah, i see. but making bunch of components from styled-components, did it effect performance?
Kaz Baig
@kbaig
Jan 08 23:23
For Gatsby I don't think so. It just injects the style into the html file at build time
Make sure to use the styled components extension if you're using atom or vscode
abraham anak agung
@padunk
Jan 08 23:24
Ah cool, what ext is in vscode? sometimes they have couples of it
Kaz Baig
@kbaig
Jan 08 23:24
the first result let me see
vscode-styled-components
abraham anak agung
@padunk
Jan 08 23:26
@kbaig :thumbsup: install it already. Thanks again man
Kaz Baig
@kbaig
Jan 08 23:26
no prob
Jason Luboff
@JLuboff
Jan 08 23:37
Nothing like accidently deleting production files hehe
Kaz Baig
@kbaig
Jan 08 23:38
ummm
yikes
You can't delete production files if you never make it to production
Jason Luboff
@JLuboff
Jan 08 23:39
Touche!
However..I have put measures in place to never allow that to happen again
Kaz Baig
@kbaig
Jan 08 23:40
Sounds sketch
Jason Luboff
@JLuboff
Jan 08 23:40
I can tell you what happened... and then you can laugh at me if you like

Basically I have a file upload option for different parts of the app. I had back in October added the option to upload in an additional place, which meant I changed my directory a bit

const dir = req.query.mocNumber === undefined ? 
`//${process.env.FILESERVER}/moc/Request/${req.params.requestID}` 
: `//${process.env.FILESERVER}/moc/${req.query.mocNumber}/${req.query.type}`;

So I had that, but accidently had req.query.mocnumber thus every file upload was going into the Request folder. Incidently...I was stupidly writing to that same location while in dev..so in testing I would also end up putting files into sometimes the same folder as production...and I routinely delete those folders...which meant I deleted production files..
Now I have

const url = process.env.NODE_ENV === 'production' && process.env.MODE === 'production' 
? `//${process.env.FILESERVER}/moc` 
: `//${process.env.FILESERVER}/moc/DEVELOPMENT`;
    const dir = req.query.mocNumber === undefined 
? `${url}/Request/${req.params.requestID}`
 : `${url}/${req.query.mocNumber}/${req.query.type}`;

As to not fuck myself over again :)

Kaz Baig
@kbaig
Jan 08 23:46
oh boyyy
big yikes
Jason Luboff
@JLuboff
Jan 08 23:47
Yup. Felt real stupid about that one
The reason I didn't think twice about it while testing, is becuase if I had done it correctly.. only new requests would be able to do that additional upload and I would never get up to the same requestID :joy: I learned my lesson
Brad
@bradtaniguchi
Jan 08 23:55
@JLuboff Time to write some tests for that code :P