These are chat archives for FreeCodeCamp/HelpJavaScript

13th
Dec 2018
Brad
@bradtaniguchi
Dec 13 2018 00:36
@JLuboff I guess it depends on how your using the value
if its like in an if statement, then it doesn't matter
Jason Luboff
@JLuboff
Dec 13 2018 00:38
Ya...in this case, an if statement
Brad
@bradtaniguchi
Dec 13 2018 00:42
It depends on how verbose you want to be. If you haven't been using !!, and the linter isn't complaining then I wouldn't start now, id stick with consistency
Jason Luboff
@JLuboff
Dec 13 2018 00:44
Eh...I don't use it all that often but occasionally
Dylan Mayers
@DylanMayers
Dec 13 2018 00:50
hey guys, i'm working my way through the basic javascript section and am almost at the end of it, but i've just come across a question on parseInt. It hasn't been covered thus far in the previous exercises, have i missed something?
Jason Luboff
@JLuboff
Dec 13 2018 00:51
Sometimes you're expected to look at the docs (https://developer.mozilla.org/en-US/docs/Web/javascript) to understand a method/concept
Personally.. I'll just bing "javascript parseint" or whatever the method is I'm looking for and look specifically for the MDN (mozilla docment network?) link
Dylan Mayers
@DylanMayers
Dec 13 2018 00:54
right right, so they want you to go and learn it from outside sources? It just seemed a bit out of the blue with no introduction on it so i wasn't sure if i'd missed something way back in the section
Jason Luboff
@JLuboff
Dec 13 2018 00:57
Ya, FCC is a good learning resource but at a certain point they expect you to learn from other avenues as well. When I first started, I found the concept a bit harder to grasp so tried codecademy, but found that they hold our hand too much. As long as you stick to it, you'll get where you want to go one way or the other
Tom
@moT01
Dec 13 2018 00:59
what do you mean 'bing'?
Jason Luboff
@JLuboff
Dec 13 2018 00:59
I use Bing instead of Google.. don't hate
Tom
@moT01
Dec 13 2018 01:00
whats bing
Jason Luboff
@JLuboff
Dec 13 2018 01:00
Microsoft's search engine
You get points for using it..which translates into real stuff like XBox Live and shit
Tom
@moT01
Dec 13 2018 01:00
oh, i get it
Jason Luboff
@JLuboff
Dec 13 2018 01:00
but.. I gotta go
Tom
@moT01
Dec 13 2018 01:00
so you use bing when you need to google something
Jason Luboff
@JLuboff
Dec 13 2018 01:00
Yup
Tom
@moT01
Dec 13 2018 01:00
cya
Jason Luboff
@JLuboff
Dec 13 2018 01:00
DM me if you have any more questions about it
Brad
@bradtaniguchi
Dec 13 2018 01:12
@moT01 you legit don't know what bing is?
Tom
@moT01
Dec 13 2018 01:27
yes, I know what bing is
I was just messin with him
but, I didn't know you can get stuff for using it
I may have to check that out
Dylan Mayers
@DylanMayers
Dec 13 2018 01:30
cheers @JLuboff i'll keep this in mind moving forward
Pagnito
@Pagnito
Dec 13 2018 01:52
is there a way to config webpack to import files outside of dir with a relative path of /src/assets instead of ../assets?
Brad
@bradtaniguchi
Dec 13 2018 02:00
@Pagnito you want a relative path, that isn't relative?
Pagnito
@Pagnito
Dec 13 2018 02:00
lol kind of
like u know how u can write inside of component for img src
/src/assets/img.jpg
even tho that component is inside a directory that is inside of anthoer directory
i wanna b able to do that for importing files
i wanna see if there is a diff solution besides what this thread provides
oh wiat thats not the thread
this one
Brad
@bradtaniguchi
Dec 13 2018 02:18
Sorry I can't look into other links. Just sounds like your use-case is super complex for some reason. Absolute paths, and relative paths should cover almost everything
Christopher McCormack
@cmccormack
Dec 13 2018 02:19
@Pagnito starting with a / will make it absolute I believe
Pagnito
@Pagnito
Dec 13 2018 02:20
yea i know, i tried it but it s not woking wit webpack like that for some reason
Christopher McCormack
@cmccormack
Dec 13 2018 02:24
@Pagnito webpack has a resolver I believe, you can look into that
Pagnito
@Pagnito
Dec 13 2018 02:25
oh sweet thnx
Jefferson
@jeffersonnnn
Dec 13 2018 09:21
hey guys, a quick question, please. Is it possible to send the data collected via a html form to a remote server? an example would be attaching a form to am email, asking the reciever to open on a web page and fill it out. this information is then sent to a server. is this possible?
Spyrantis Theodoros
@thodorisanta
Dec 13 2018 09:30
@Blauelf if i have an a array of strings (which strings are numbers) like: ["9", "2", "3", "4", "5", "6", "7", "8", "1"] can i sort them when they are like that or first i have to convert it to an array of numbers and then sort them?
Aditya
@ezioda004
Dec 13 2018 09:32
@thodorisanta ["9", "2", "3", "4", "11", "5", "10", "6", "7", "8", "1"].sort((a, b) => +a - +b);
+a is explicitly type casting string -> number
Spyrantis Theodoros
@thodorisanta
Dec 13 2018 09:34
@ezioda004 thanks what does the + mean before the a and b ?
oh okay
Blauelf
@Blauelf
Dec 13 2018 09:35
@ezioda004 - does that job already, no need for unary + :P
Aditya
@ezioda004
Dec 13 2018 09:36
@Blauelf Oh yeah, you're right
By explicit >> implicit type casting :D
Spyrantis Theodoros
@thodorisanta
Dec 13 2018 09:38
what do you mean? i dont need to put +a and +b ?
Blauelf
@Blauelf
Dec 13 2018 09:38
But when doing + that's also defined on strings, you're right, would be +a+ +b.
Aditya
@ezioda004
Dec 13 2018 09:39
@thodorisanta In this example, no
But could confuse someone else when they read your code, then again +a could also confuse if someone doesnt know what + does
Could do Number(a) for readability sake
Spyrantis Theodoros
@thodorisanta
Dec 13 2018 11:29
is there a fast way to take a number like 12345 and split it in an array of Numbers like [1,2,3,4,5] without turning it into a string, spliting it and then turn it back into a number?
Spyrantis Theodoros
@thodorisanta
Dec 13 2018 11:37
also if a have an array like arr = [5,4,3,2,1] and i wanna sort it low to high arr.sort((a,b) => a - b); will do the job. but if i wanna sort it high to low arr.sort((a,b) => a + b); doesnt work. in other words the + doesnt work. is there a reason why?
Blauelf
@Blauelf
Dec 13 2018 11:50
-(a-b), or b-a. The trick is the sign of the return value. Negative means a should be positioned before b, positive means b should come before a. Zero means they are equal in terms of the comparison. If the algorithm is stable (not guaranteed by standard, but implementations usually are), this means relative order should not be changed.
Most implementations actually test for positive only (>0), that way a comparison function returning 0 (false) and 1 (true), but never -1 or another negative value (incorrect in terms of standard) still works.
Aditya
@ezioda004
Dec 13 2018 11:54

is there a fast way to take a number like 12345 and split it in an array of Numbers like [1,2,3,4,5] without turning it into a string, spliting it and then turn it back into a number?

Without converting to string, a fast way? Nope

Could do this as an alt:
let num = 12345;
const arr = [];
while (num > 0){
  arr.unshift(num%10);
  num = Math.floor(num/10);
}
console.log(arr); [1, 2, 3, 4, 5]
@Blauelf I think all sort implementations are now stable, chrome introduced stable few months ago
Blauelf
@Blauelf
Dec 13 2018 11:58
I remember when non-stable sort was filed as a bug in Mozilla (or at least I think it was Mozilla Firefox at that time, it had so man names before)
And this would be wrong, but work: (a,b)=>+a>+b (returning only 0 or 1, but never negative, per standard this would lead to undefined behaviour, where browsers might do anything)
Aditya
@ezioda004
Dec 13 2018 12:03
This doesnt work in chrome anymore, does it?
I remember being confused cause it used to work but then it stopped working
Blauelf
@Blauelf
Dec 13 2018 12:45

Snippet

var fun1 = (a,b)=>(+a>+b);
var fun2 = (a,b)=>((+a>+b)-(+b>+a));

var arr = Array.from({length:1000}, Math.random);

console.log(JSON.stringify(arr.slice().sort(fun1))===JSON.stringify(arr.slice().sort(fun2)));

will print true for Firefox (and after turning into ES5.1 also Internet Exploder), and false for Chrome and Node.

I remember reading the Firefox sources and realizing it would handle it that way, and simply assumed others would do the same.
Spyrantis Theodoros
@thodorisanta
Dec 13 2018 13:10
i liked the -(a-b) its smart and simple. Dont know why i didnt though of it :P
Nate Mallison
@NJM8
Dec 13 2018 13:44
@jesskxuan Here is what I did:
const steps = {
  'PENNY': 1,
  'NICKEL': 5,
  'DIME': 10,
  'QUARTER': 25,
  'ONE': 100,
  'FIVE': 500,
  'TEN': 1000,
  'TWENTY': 2000,
  'ONE HUNDRED': 10000
}

function removeDecimal(num){
  return Math.round(num * 100);
}

function addDecimal(num){
  return Number((num / 100).toFixed(2));
}
Just run all the values through remove decimal, then at the end run them all through add decimal. And all your steps need to be larger. Then no funny errors or hacks needed
tundeiness
@tundeiness
Dec 13 2018 14:05

so I keep getting error like this: >Error: Request errror: 0
when I started the >React and Redux: Getting Started with React Redux
task in FCC. Here is the task:

Start with a DisplayMessages component. Add a constructor to this component and initialize it with a state that has two >properties: input, that's set to an empty string, and messages, that's set to an empty array.
and here is my code:
```


class DisplayMessages extends React.Component {
  // change code below this line
  constructor(props){
    super(props);
    this.state = {
      input: "",
      messages:[]
    }
  }

  // change code above this line
  render() {
    return <div />
  }
};
can someone help with the error? it seems like a FCC issue though.
@GregatGit I do not think that is possible in codepen though.
Mohammed Boudad
@matrixersp
Dec 13 2018 14:08
@tundeiness Can you give the challenge link?
Mohammed Boudad
@matrixersp
Dec 13 2018 14:13
It's taking too long to open, seems a problem with FCC
tundeiness
@tundeiness
Dec 13 2018 14:15
@matrixersp well there goes my task for the day.
Mohammed Boudad
@matrixersp
Dec 13 2018 14:26
@tundeiness I don't know why it didn't work for you, cause in my case it works
Try reset and type the code again
Blauelf
@Blauelf
Dec 13 2018 14:27
Interestingly, it works for me, using about same code.
tundeiness
@tundeiness
Dec 13 2018 14:28
@matrixersp @Blauelf I will do that
Mohammed Boudad
@matrixersp
Dec 13 2018 14:28
Or maybe reload the page
Blauelf
@Blauelf
Dec 13 2018 14:29
I used Firefox, but maybe I was lucky, the new UI has been difficult for me, failing for unknown reasons, stuck in an invalid state.
Mirkan Çalışkan
@mirkancal
Dec 13 2018 14:30
@NJM8 has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Jason Luboff
@JLuboff
Dec 13 2018 16:12
Morning :wave:
Blauelf
@Blauelf
Dec 13 2018 16:18
Nightingale just began singing.
Mohammed Boudad
@matrixersp
Dec 13 2018 16:18
@JLuboff Evening :sleepy:
Jason Luboff
@JLuboff
Dec 13 2018 16:19
Yes..I guess it is evening for some :)
Mohammed Boudad
@matrixersp
Dec 13 2018 16:19
Haha yup
Christopher McCormack
@cmccormack
Dec 13 2018 16:22
@JLuboff yo
@JLuboff what it is?
Tom
@moT01
Dec 13 2018 16:24
@JLuboff @JLuboff @JLuboff @JLuboff @JLuboff
oh, I did it again, didn't let my chat refresh before I started sending stuff
Jason Luboff
@JLuboff
Dec 13 2018 16:27
@cmccormack It is.. it?
@moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01
Tom
@moT01
Dec 13 2018 16:28
oh boy
Christopher McCormack
@cmccormack
Dec 13 2018 16:28
lol
Jason Luboff
@JLuboff
Dec 13 2018 16:28
@moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01 @moT01
Tom
@moT01
Dec 13 2018 16:29
alright now
Jason Luboff
@JLuboff
Dec 13 2018 16:29
Ok, I'm done
Tom
@moT01
Dec 13 2018 16:29
lets all just calm down
go ask some questions
Tom
@moT01
Dec 13 2018 16:30
i took a look at that
Jason Luboff
@JLuboff
Dec 13 2018 16:31
My 1 year old...and Quincy's 1 year old... have the same name! Different spellings though
Christopher McCormack
@cmccormack
Dec 13 2018 16:31
dang wonder if you guys were reading the same stuff when you came up with it :)
Aditya
@ezioda004
Dec 13 2018 16:32
Thats good, if the babies get mixed, you can spell their names and see which one responds to the correct one :baby:
Jason Luboff
@JLuboff
Dec 13 2018 16:32
Lol
Christopher McCormack
@cmccormack
Dec 13 2018 16:32
lol smart babies
Amit Patel
@AmitP88
Dec 13 2018 16:34
hey guys, I'm currently on my 3rd react/redux project (apart from the front end libraries projects) and my goal for this month is to complete 10 of them. However, I'm getting worried that I won't be able to meet that goal. Do you think 10 react/redux projects in a month is an unrealistic goal? Or should I be able to accomplish this if I want to get a junior react position?
Christopher McCormack
@cmccormack
Dec 13 2018 16:34
@AmitP88 I think you worry too much, just keep learning and applying
Amit Patel
@AmitP88
Dec 13 2018 16:35
I haven't even started applying yet. I feel like I need to build enough react/redux projects to get ready
I'm planning on applying starting Jan 1st
Christopher McCormack
@cmccormack
Dec 13 2018 16:35
you'll never be ready if you think you need to know everything
Tom
@moT01
Dec 13 2018 16:35
@AmitP88 seems like a lot if you ask me, but I suppose it depends how big they are - 1-2 weeks per project is typical for me if its something small-medium sized
Jason Luboff
@JLuboff
Dec 13 2018 16:35
I'd say 10 projects is very ambitious...but it also depends on the projects..
Christopher McCormack
@cmccormack
Dec 13 2018 16:35
Most successful people I know didn't know much about their jobs before getting into them, it takes immersion and a willingness to learn, and it's difficult to get that on your own
Amit Patel
@AmitP88
Dec 13 2018 16:36
well I mean, so far I've built an unbeatable tic tac toe and a simon game (although with simon game I need to work on getting it mobile responsive - I updated my Chrome browser and it screwed up the responsiveness)
I'm currently working on Recipe Box
Jason Luboff
@JLuboff
Dec 13 2018 16:37
Chrome...shouldn't affect responsiveness..?
Amit Patel
@AmitP88
Dec 13 2018 16:37
@JLuboff that's what I thought, as my Simon game was responsive before the update
but after that it messes up if I open the game in my phone
Jason Luboff
@JLuboff
Dec 13 2018 16:38
You update Chrome on your computer...or on your phone..?
Amit Patel
@AmitP88
Dec 13 2018 16:38
the tic tac toe took me 3 weeks to complete, and simon game took me 1 week
on my computer
there was an icon with an up arrow where the three dots usually are
Aditya
@ezioda004
Dec 13 2018 16:39
@AmitP88 I think you should start applying already, the very first redux project I made was the one for my employer. 3-4 Redux projects are quite handful
Jason Luboff
@JLuboff
Dec 13 2018 16:39
Well.. keep in mind that Chrome is just emulating that resolution...so..it may or may not actually be like that on an actual phone
Amit Patel
@AmitP88
Dec 13 2018 16:39
ah I see
@ezioda004 I still need to revamp my portfolio site. I was planning on doing that after I get the projects done
@cmccormack I understand. But I'm worried that I won't even get noticed by employers or get any interviews
Aditya
@ezioda004
Dec 13 2018 16:41
@AmitP88 Yeah definitely do that, a nice portfolio makes a good impression
Amit Patel
@AmitP88
Dec 13 2018 16:41
@ezioda004 my current portfolio looks like this http://imamitpatel.com but I haven't updated it in a long while
Christopher McCormack
@cmccormack
Dec 13 2018 16:41
@AmitP88 I don't know what to tell you, you should apply when you feel confident, but don't wait too long or you may waste a lot of time. We won't have the answers for you though, it's personal
Lucci Paula
@luccipaula
Dec 13 2018 16:41
Has anybody ever had an issue where their webpack.config.js file works fine on one project and not on another? My mini-css-extract-plugin isn't compiling in my new project for some reason :(
Christopher McCormack
@cmccormack
Dec 13 2018 16:42
@luccipaula newer webpack doesn't support that one I think
Jason Luboff
@JLuboff
Dec 13 2018 16:42
@AmitP88 You won't get 100% of the jobs you never apply for
Christopher McCormack
@cmccormack
Dec 13 2018 16:42
I may have that backward though
Aditya
@ezioda004
Dec 13 2018 16:42
@AmitP88 Thats not bad, add some smooth scrolling and animations and it'll look good!
Christopher McCormack
@cmccormack
Dec 13 2018 16:42

@JLuboff

Wayne Gretzky

Michael Scott

JLuboff

Lucci Paula
@luccipaula
Dec 13 2018 16:43
@cmccormack But I'm on the same 4.25.1 version of Webpack D:
It compiles perfectly in my recent project
Christopher McCormack
@cmccormack
Dec 13 2018 16:44
@luccipaula did you add your import statements for your css?
Amit Patel
@AmitP88
Dec 13 2018 16:44
@ezioda004 thanks. I'm planning on finishing this udemy course on adv css and sass. That course teaches some good animations, and I'm planning on implementing similar styles from there onto my site
Lucci Paula
@luccipaula
Dec 13 2018 16:44
@cmccormack !!! holy crap I forgot to add it to main.js
Thank you wow
Christopher McCormack
@cmccormack
Dec 13 2018 16:44
np
Lucci Paula
@luccipaula
Dec 13 2018 16:45
Not used to adding css to js
Christopher McCormack
@cmccormack
Dec 13 2018 16:45
yeah it does feel a little strange
Aditya
@ezioda004
Dec 13 2018 16:45
@AmitP88 I'm not big on CSS but FCC also have good animations challenges
Christopher McCormack
@cmccormack
Dec 13 2018 16:45
but webpack can't do anything without it :)
Amit Patel
@AmitP88
Dec 13 2018 16:45
@cmccormack @JLuboff I understand. I'm just scared of wasting time applying if I'm not ready you know? like I don't want to send out 100 applications just to get no interviews when I could have build more/better projects
Lucci Paula
@luccipaula
Dec 13 2018 16:46
@AmitP88 Are you doing Jonas' course?
Amit Patel
@AmitP88
Dec 13 2018 16:46
@ezioda004 FCC has animation challenges? Which section? I haven't seen any that pertain to animation
Christopher McCormack
@cmccormack
Dec 13 2018 16:46
@AmitP88 I'm not necessarily saying apply when you aren't ready, just don't wait until you think you know everything. You'll know when you're confident enough to apply
Lucci Paula
@luccipaula
Dec 13 2018 16:47
@AmitP88 Yes that's the one! It's amazing
I improved so much from it
Aditya
@ezioda004
Dec 13 2018 16:48
@AmitP88 Here
I think @moT01 worked on these, thanks to him
Amit Patel
@AmitP88
Dec 13 2018 16:48
@cmccormack hmm, I guess I'm not confident yet then. I mean I'm sort of comfortable using redux (although initial setup of things can take me some time), but I don't think I can knock out a react/redux project in 1 day if that was a coding test
@luccipaula yeah, the projects look really cool on that one. I'm thinking of using the flipping cards design as my project thumbnails for my portfolio
@ezioda004 hmmm, this looks vaguely familiar. Was this part of the certification challenges? or is this in beta?
Aditya
@ezioda004
Dec 13 2018 16:51
It was in beta, but now live! Yes, its part of the 1st certificate - CSS one
Amit Patel
@AmitP88
Dec 13 2018 16:52
ah I see. lol last time I was working on the 1st cert was in june haha
I still need to do the last two certs for backend, but I'm aiming to get good at react/redux first
Aditya
@ezioda004
Dec 13 2018 16:52
I havent even completed that one yet 🤦‍♀️
Amit Patel
@AmitP88
Dec 13 2018 16:53
the Responsive Web Design cert?
Lucci Paula
@luccipaula
Dec 13 2018 16:53
I only just finished that one after almost 2 years lol
Aditya
@ezioda004
Dec 13 2018 16:54
@AmitP88 Yeah
Amit Patel
@AmitP88
Dec 13 2018 16:54
lol granted I'm not working atm so I have more time to devote
The first cert is pretty good
Aditya
@ezioda004
Dec 13 2018 16:55
@luccipaula The new CSS challenges are good but I feel so bored after doing like 2 of them
Amit Patel
@AmitP88
Dec 13 2018 16:56
yeah, the challenges themselves aren't that engaging. It gets better once you get into projects though
Aditya
@ezioda004
Dec 13 2018 16:56
Yeah - I'm thinking to just start the projects but OCD part of me wants to finish the challenges first :<
Lucci Paula
@luccipaula
Dec 13 2018 16:57
Must. Complete. In. Order.
I'm the same way
Christopher McCormack
@cmccormack
Dec 13 2018 16:57
just think of it this way - if new content is added, it will most likely be much more challenges than projects, so if you keep waiting it will take forever.
Amit Patel
@AmitP88
Dec 13 2018 16:58
yeah, best just to dive in and gain momentum
you can probably get through the challenges in a few days or so if you blaze through them
Christopher McCormack
@cmccormack
Dec 13 2018 16:59
@ezioda004 do the challenges while waiting for merge conflict resolutions to complete CI :)
Amit Patel
@AmitP88
Dec 13 2018 17:01
I'm just gonna give myself the rest of this month to get as much as I can done, then apply starting Jan 1st. Whatever I have by then is what I got
Christopher McCormack
@cmccormack
Dec 13 2018 17:03
You can learn a lot from the interviews and interview projects as well
Aditya
@ezioda004
Dec 13 2018 17:03
@cmccormack Good idea, tho I havent been reviewing PRs for couple of days lol
Christopher McCormack
@cmccormack
Dec 13 2018 17:03
@ezioda004 there now you have a reason to do both!
I call them FCC SuperSets!
At its most basic definition, a superset is when you do two exercises back to back with little to no rest between them
Amit Patel
@AmitP88
Dec 13 2018 17:04
@cmccormack I bet. One of my main issues is speed, but I think I'm getting faster. Just need to practice more
Jason Luboff
@JLuboff
Dec 13 2018 17:05
I'm working as a Developer...and I'm slow as shit.. :joy: Given.. I'm also doing multiple jobs
Amit Patel
@AmitP88
Dec 13 2018 17:06
@JLuboff yeah but I mean I have to be fast for the tech interviews though right? like if they give me a take home project to complete in a day, I have to be able to do it. Atm it takes me about a week to complete a project, but I'm cutting that time short with the recipe box I'm working on (today is day 4 and I'm aiming to get it done today)
Jason Luboff
@JLuboff
Dec 13 2018 17:07
I'm going to be honest.. I have not done a tech interview. I worked myself into my current role. But yes, some do require you to do a take home project
Aditya
@ezioda004
Dec 13 2018 17:07
I dont think thats standard interview process, is it?
Amit Patel
@AmitP88
Dec 13 2018 17:08
Idk, that's what I've read online - that it'll most likely be either take home projects or whiteboarding algorithms (I still need to finish the algorithms cert too)
Aditya
@ezioda004
Dec 13 2018 17:09
Yeah whiteboarding is common
Jason Luboff
@JLuboff
Dec 13 2018 17:09
@ezioda004 Didn't you have to do a project for your interview?
Aditya
@ezioda004
Dec 13 2018 17:09
Gonna be honest, algo cert wont help that much in DSA (whiteboarding) problems
@JLuboff Yeah, but I havent heard of that before
Amit Patel
@AmitP88
Dec 13 2018 17:09
:(
damn
Jason Luboff
@JLuboff
Dec 13 2018 17:10
@ezioda004 I recall another user coming on here asking for help with his interview take home project too.. but..again I haven't actually applied for a Dev job so..
Amit Patel
@AmitP88
Dec 13 2018 17:10
I was hoping the algo cert would help somewhat
Aditya
@ezioda004
Dec 13 2018 17:10
@JLuboff Like I read about whiteboard kinda process but not home takeaway one
Christopher McCormack
@cmccormack
Dec 13 2018 17:11
@JLuboff yeah his was pretty interesting, create a front end and a separate backend but didn't have to link them
Aditya
@ezioda004
Dec 13 2018 17:11
@AmitP88 I guess it depends..but data structure and algo is a classic CS fundamental
FCC have those challenges in the coding interview section
But you'll have to find another resource to really learn it
Amit Patel
@AmitP88
Dec 13 2018 17:12
@ezioda004 for sure. I'm still going to complete it regardless. Last time I had to look at hints or solutions a lot, but now I'm forcing myself to go through it without using any hints
damn, it seems like for junior dev jobs, they want pros already
Aditya
@ezioda004
Dec 13 2018 17:13
@AmitP88 Yeah definitely complete it, but pick a book like "cracking the code interview" and solve problems from there
And do lots of codewars!
Amit Patel
@AmitP88
Dec 13 2018 17:14
oh yeah, I've done some codewars - I think I'm on 7th kyu
but I sort of put that on the back burner to dive into redux
Jason Luboff
@JLuboff
Dec 13 2018 17:16
I used to do codewars all the time...haven't for a while now :(
Aditya
@ezioda004
Dec 13 2018 17:16
Yeah thats understandable, redux takes its toll
@JLuboff Same, I used to do when someone would post one in the chat haha
Jason Luboff
@JLuboff
Dec 13 2018 17:16
Ya..used to try to do some every day but got tired of them
I could do the lower kyu ones but struggled with the 3-4 + kyu
Amit Patel
@AmitP88
Dec 13 2018 17:17
I figured I should get my hands dirty with using redux first and save algorithm solving for later
now I'm sort of comfy using redux
Mike Smith
@MikeSS281986
Dec 13 2018 17:17
Morning all! Having a time figuring how to resolve this. if you have a large number returned and its say for example 7.125774134884027e+26, how would you go about to make it show 712577413488402631964821329?
tried math.round and the like..
Mike Smith
@MikeSS281986
Dec 13 2018 17:20
its already an integer,
so would i convert tostring the pass it in for Number?
Amit Patel
@AmitP88
Dec 13 2018 17:21
according to the link, probably
Aditya
@ezioda004
Dec 13 2018 17:21
@MikeSS281986 Since JS numbers are double 64 bit, you start losing precision after Number.MAX_SAFE_INTEGER
Amit Patel
@AmitP88
Dec 13 2018 17:21
then you can parse it back to a number after the conversion
Aditya
@ezioda004
Dec 13 2018 17:21
If you're open to use experimental stuff, you could use BigInt
BigInt(7.125774134884027e+26); // 712577413488402688796262400n
Amit Patel
@AmitP88
Dec 13 2018 17:22
this might be a dumb question, but do you think I would also need to know the rest of the mern stack to have a good chance of getting job interviews after applying?
Mike Smith
@MikeSS281986
Dec 13 2018 17:22
its where im failing in codewars. instead of sci note, it wants the large number instead
Aditya
@ezioda004
Dec 13 2018 17:23
@AmitP88 Nah you can get a job with just React/Redux
Amit Patel
@AmitP88
Dec 13 2018 17:23
@ezioda004 that's a relief lol
Aditya
@ezioda004
Dec 13 2018 17:24
Since its codewars then using string is your best bet
Mike Smith
@MikeSS281986
Dec 13 2018 17:24
ill give it a shot. thanks guys
Amit Patel
@AmitP88
Dec 13 2018 17:24
np, good luck :)
Mirkan Çalışkan
@mirkancal
Dec 13 2018 17:28

Does anyone know about CORS error? I'm trying to send get request to jobs.github api with Fetch API, I get this error:

has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

You may not be able to do it from the frontend without using JSONP, not sure
Kelechi Chinaka
@ke1echi
Dec 13 2018 17:58
kid bro reset my fcc account
Your a element should not have the text "View more".
Christopher McCormack
@cmccormack
Dec 13 2018 18:02
@ke1echi works for me, can you post just the p snippet?
sounds like you added View more within the anchor instead of outside the anchor but within the p element
Mirkan Çalışkan
@mirkancal
Dec 13 2018 18:05

@cmccormack In the document you've just send, it works.

https://api.github.com?callback=foo

That wraps json in a foo function, but I guess it's not work with jobs api. This link didn't wrap json in foo

https://jobs.github.com/positions.json?callback=foo
Kelechi Chinaka
@ke1echi
Dec 13 2018 18:05
fcc.JPG
Christopher McCormack
@cmccormack
Dec 13 2018 18:06
@ke1echi doesn't look like you did anything from the instructions
Now nest your existing a element within a new p element (just after the existing main element). The new paragraph should have text that says "View more cat photos", where "cat photos" is a link, and the rest of the text is plain text.
Kelechi Chinaka
@ke1echi
Dec 13 2018 18:12
did not actually read it. fixed now .thanks @cmccormack
Jason Luboff
@JLuboff
Dec 13 2018 18:21
Reading is good
Kelechi Chinaka
@ke1echi
Dec 13 2018 18:36
i need to read if i need that full stack cert from fcc .. lol @JLuboff
Jason Luboff
@JLuboff
Dec 13 2018 18:36
True true
Kelechi Chinaka
@ke1echi
Dec 13 2018 18:38
gotten the full stack cert? @JLuboff
Jason Luboff
@JLuboff
Dec 13 2018 18:39
Nah... haven't done any of the Data viz stuff
Kelechi Chinaka
@ke1echi
Dec 13 2018 18:40
any plans on doing them?
Jason Luboff
@JLuboff
Dec 13 2018 18:42
Not at this time. Too busy with work projects (aka actually using my skills lol)
Kelechi Chinaka
@ke1echi
Dec 13 2018 18:42
lol nice
Jason Luboff
@JLuboff
Dec 13 2018 18:44
Ya before I was in this position... I had a lot of free time at work..now.. not so much :)
Kelechi Chinaka
@ke1echi
Dec 13 2018 18:45
cool
Jason Luboff
@JLuboff
Dec 13 2018 18:47
You go out and find a dev job yet?
Kelechi Chinaka
@ke1echi
Dec 13 2018 18:49
not yet, hopefully soon
i feel i need to build stuffs, so the need of fcc
Christopher McCormack
@cmccormack
Dec 13 2018 18:53
@mirkancal yo - I took your problem as a challenge and made a proxy for the github jobs api
you can add your query strings and it should work, let me know if you run into issues and I can work on fixes
Jason Luboff
@JLuboff
Dec 13 2018 18:54
@cmccormack Look at mr.fancy pants over here...programming shit!
Christopher McCormack
@cmccormack
Dec 13 2018 18:54
@JLuboff thought it might be fun, only took about 10 minutes which is pretty cool
Jason Luboff
@JLuboff
Dec 13 2018 18:54
Thats not bad at all lol I'm just being a jerk :)
Christopher McCormack
@cmccormack
Dec 13 2018 18:55
you didn't sound like a jerk you sounded like a nice guy!
Jason Luboff
@JLuboff
Dec 13 2018 18:55
Well the Mr.fancy pants part was kind of jerky :)
Aditya
@ezioda004
Dec 13 2018 18:56
I hate how I fall asleep watching yt but when I try to sleep I cant for the life of me
Jason Luboff
@JLuboff
Dec 13 2018 18:57
Welcome to getting old
Christopher McCormack
@cmccormack
Dec 13 2018 18:57
@ezioda004 I used to read myself to sleep for that very reason
wait until the book falls on my face a few times then go to sleep
Aditya
@ezioda004
Dec 13 2018 18:58
Lol
Jason Luboff
@JLuboff
Dec 13 2018 18:58
Alright... think I'm almost done with the form part of my React app.. Added a breadcrumb to the top to allow people to go back and forth between the workflow
Aditya
@ezioda004
Dec 13 2018 19:00
This christmas, gift yourself javascript
Jason Luboff
@JLuboff
Dec 13 2018 19:01
The elvis operator looks..awesome
It solves a problem I was having before (where I am currently first checking if an array is defined..)
Aditya
@ezioda004
Dec 13 2018 19:03
Yeah, its quite handy!
Jason Luboff
@JLuboff
Dec 13 2018 19:03
I never knew about it until now :( Given...I guess its a new feature
Aditya
@ezioda004
Dec 13 2018 19:04
Yep, I believe theres a babel plugin for it
Still stage 1, quite a long way to go
Jason Luboff
@JLuboff
Dec 13 2018 19:04
Ya don't see it on MDN
Apparently there is an in operator too..
Never knew
Aditya
@ezioda004
Dec 13 2018 19:05
You didnt know about in? :o
Jason Luboff
@JLuboff
Dec 13 2018 19:06
No :(
Aditya
@ezioda004
Dec 13 2018 19:06
Btw babel plugin
Yeah its similar to.hasOwnProperty()
Jason Luboff
@JLuboff
Dec 13 2018 19:06
Correct
Aditya
@ezioda004
Dec 13 2018 19:06
Except it also checks the prototype chain
Kelechi Chinaka
@ke1echi
Dec 13 2018 19:10
nice link @ezioda004
Aditya
@ezioda004
Dec 13 2018 19:16
:sparkles:
Theres one for react too
Pagnito
@Pagnito
Dec 13 2018 19:56
when i deploy, my req.cookies are undefined
even tho when i look at the request headers
its there
Mirkan Çalışkan
@mirkancal
Dec 13 2018 19:57
@cmccormack wow that's actually helpful, is there any way to solve that without proxy?
@cmccormack
Access to fetch at 'https://github-jobs.glitch.me/positions.json?description=python&location=new+york' from origin 'https://www.google.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Christopher McCormack
@cmccormack
Dec 13 2018 20:01
@mirkancal If their API doesn't have a way to accept your origin and it doesn't have a JSONP api, I don't think so. The proxy is basically doing it from a server, which doesn't have the same CORS issues
Are you getting that error from my API?
What are you using?
Christopher McCormack
@cmccormack
Dec 13 2018 20:11
@mirkancal all add cross origin when I get home, can't atm sorry
Pagnito
@Pagnito
Dec 13 2018 20:29
it seems alot of middlewares arent working with firebase functions
Brad
@bradtaniguchi
Dec 13 2018 20:46
I would think either its a setup issue, or there are docs/issues reported if your running into that
Brad
@bradtaniguchi
Dec 13 2018 20:56
I ran into the dumbest mongodb issue, anyone want to hear it?
Christopher McCormack
@cmccormack
Dec 13 2018 20:58
yes?
Brad
@bradtaniguchi
Dec 13 2018 20:58
Ok wasn't sure, cuse I complain so much already :P
Christopher McCormack
@cmccormack
Dec 13 2018 20:59
haha
Brad
@bradtaniguchi
Dec 13 2018 21:00
So basically we were doing a groupBy of some fields on some records, big deal. But we were getting a BSON object to string error when running it against a specific field. No other field anywhere had this issue. So after just straight up guessing it came down to this part of the code (I normally redact stuff, but this is for real the code):
// part of a mongodb aggregate
{
    "$group": {
      "_id": {
        "$toLower": "$checkbox153204012984514"
      }
}
Nothings wrong with that per-say, but somewhere at some level mongodb is a moron and assumes the checkbox field is a BSON object, thus tries to convert it and blows up on some level
And it only occurred on this field as with the $sign, the field is the same string length as a BSON objectId
Example id compared to the field above
// $checkbox153204012984514
// 5b3e502f77cf0537829a7321
Christopher McCormack
@cmccormack
Dec 13 2018 21:09
hah so is it coercing it for some reason?
Brad
@bradtaniguchi
Dec 13 2018 21:15
Yea at some level, which results in an error being thrown by mongo. Whats really funky is the same query put into robo3t doesn't spit out an error
Christopher McCormack
@cmccormack
Dec 13 2018 21:24
@bradtaniguchi that's super weird, I wonder why it just makes that assumption
Brad
@bradtaniguchi
Dec 13 2018 21:25
I have no idea, if I know where I could post the bug I would, since it's the kinda bug you lose sleep over
Christopher McCormack
@cmccormack
Dec 13 2018 21:27
probably their github repo
Brad
@bradtaniguchi
Dec 13 2018 21:35
mongo, or the node mongo adaptor?
Pagnito
@Pagnito
Dec 13 2018 21:37
mann, i dunno if im n00b, but firebase serve DOES not work the same as the deploy server and its rly annoying
Christopher McCormack
@cmccormack
Dec 13 2018 21:39
@bradtaniguchi beats me
Brad
@bradtaniguchi
Dec 13 2018 21:39
Yea, Ill just start somewhere and see where it goes
Simon Cordova
@gbsimon87
Dec 13 2018 22:57
hey all
Brad
@bradtaniguchi
Dec 13 2018 23:23
Heya
Pagnito
@Pagnito
Dec 13 2018 23:58
app.post('/sessionLogin', (req, res) => {
  // Get the ID token passed and the CSRF token.
  const idToken = req.body.idToken.toString();
  const csrfToken = req.body.csrfToken.toString();
  // Guard against CSRF attacks.
  if (csrfToken !== req.cookies.csrfToken) {
    res.status(401).send('UNAUTHORIZED REQUEST!');
    return;
  }
  // Set session expiration to 5 days.
  const expiresIn = 60 * 60 * 24 * 5 * 1000;
  // Create the session cookie. This will also verify the ID token in the process.
  // The session cookie will have the same claims as the ID token.
  // To only allow session cookie setting on recent sign-in, auth_time in ID token
  // can be checked to ensure user was recently signed in before creating a session cookie.
  admin.auth().createSessionCookie(idToken, {expiresIn}).then((sessionCookie) => {
    // Set cookie policy for session cookie.
    const options = {maxAge: expiresIn, httpOnly: true, secure: true};
    res.cookie('session', sessionCookie, options);
    res.end(JSON.stringify({status: 'success'});
  }, error => {
    res.status(401).send('UNAUTHORIZED REQUEST!');
  });
});
im lookin at this code to create cookie session with firebase, cuz it seems thats the only way they allow it
but i dont understand what this idtoken and csrf token are