These are chat archives for FreeCodeCamp/Help

20th
Mar 2018
Greg
@davisgreg1
Mar 20 2018 00:04
cool
Kyle Holm
@thekholm80
Mar 20 2018 00:34
ugh, need a 2nd set of eyes here
const getStockBySymbol = async (root, { symbols }, context) => {
  const responseData = await symbols.map(async symbol => {
    try {
      const url = `https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=${ symbol }&interval=60min&outputsize=compact&apikey=${ API_KEY }`;
      const { data } = await axios.get(url);
      const addition = {};
      addition[symbol] = data;
      responseData.push(addition)
    }

    catch(err) {
      console.warn(err);
      responseData.push({ "error": `API call for ${ symbol } failed` });
    }
  });
  console.log(responseData); // logs [ Promise { <pending> } ]
  return responseData;
}
oh wait, think i see it
nope, updated to:
const getStockBySymbol = async (root, { symbols }, context) => {
  const responseData = await symbols.map(async symbol => {
    try {
      const url = `https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=${ symbol }&interval=60min&outputsize=compact&apikey=${ API_KEY }`;
      const { data } = await axios.get(url);
      const addition = {};
      addition[symbol] = data;
      return addition;
    }

    catch(err) {
      console.warn(err);
      return { "error": `API call for ${ symbol } failed` };
    }
  });
  console.log(responseData);  // [ Promise { <pending> } ]
  return responseData;
}
Jeremy Cherer
@JavaLavaMT
Mar 20 2018 00:41
anyone on know ember testing?
Sam Goldberg
@sgoldber61
Mar 20 2018 01:25

Sorry for the dumb question, but is there a succinct way, either with normal JavaScript or lodash, to convert something like:

{'GOOGL': googleStockData, 'APPL': appleStockData, 'AMZN'; amazonStockData}

into this?

[{name: 'GOOGL', data: googleStockData}, {name: 'APPL', data: appleStockData}, {name: 'AMZN', data: amazonStockData}]
where the order doesn't matter
Kyle Holm
@thekholm80
Mar 20 2018 01:29
const obj = {'GOOGL': googleStockData, 'APPL': appleStockData, 'AMZN'; amazonStockData};
const keys = Object.keys(obj);
const result = keys.map(key => {name: key, data: obj[key]});
something like that
Sam Goldberg
@sgoldber61
Mar 20 2018 01:30
@thekholm80 OK that seems simple enough thanks!
CamperBot
@camperbot
Mar 20 2018 01:30
sgoldber61 sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1733 | @thekholm80 |http://www.freecodecamp.org/thekholm80
Kyle Holm
@thekholm80
Mar 20 2018 01:30
:+1:
inder
@nohoesinder_twitter
Mar 20 2018 02:32
Can someone plz help me Im trying to scroll down my followers list on www.holonis.com with this window.scrollTo(0,document.body.scrollHeight); but it does not work.
BuddhaHeart
@BuddhaHeart
Mar 20 2018 02:48
the href "http://freecatphotoapp.com" is unuseless
Henry
@GitHub-Henry
Mar 20 2018 03:30
I seem to recall some jokes about writing in Python and converthing to JavaScript. Well, it's here http://pyjs.org/
Darren
@DarrenfJ
Mar 20 2018 04:41
@GitHub-Henry :D looks interesting
if i knew enough python that would be cool if i knew enough js ;)
Jackhours
@Jackhours
Mar 20 2018 07:11
I'm from China and I'm happy to learn JS with you. Can you add me?
Sweet Coding :)
@SweetCodingInc
Mar 20 2018 07:34
@Jackhours Is it true that whatsapp is banned in China now?
Johnny
@JohnnyBizzel
Mar 20 2018 09:13
@nohoesinder_twitter Where is the source code?

@buddaheart

the href "http://freecatphotoapp.com" is unuseless

Is that even a word?

@GitHub-Henry

You can write web applications in Python - a readable programming language - instead of in HTML and JavaScript, both of which become quickly unreadable for even medium-sized applications

I thought VB code was readable but who wants to code in that? :D
(For the record I like both Python and JS)

May Kittens Devour Your Soul
@diomed
Mar 20 2018 09:17
unuseless = when something is useful but not really
like lorem ipsum demo
or that diomed guy
Johnny
@JohnnyBizzel
Mar 20 2018 09:22
@diomed I thought useless was "useful but not really" but if it's un-useless then it's useful?
Jesse
@ki4jgt
Mar 20 2018 09:31
Why is my function returning true twice?
function primeTest(n){
  for (i = n - 1; i > 1; i--){
    if (n % i == 0){
      return false;
    }
  }
  return true;
}
It's also returning false, twice as well.
Fabien SHAN
@X140hu4
Mar 20 2018 09:32
Arent you calling the function twice? @ki4jgt
Jesse
@ki4jgt
Mar 20 2018 09:33
Not that I'm aware of. Can you elaborate on your thinking?
May Kittens Devour Your Soul
@diomed
Mar 20 2018 09:35
@JohnnyBizzel useless is not useful at all
unuseless is like the middle
Johnny
@JohnnyBizzel
Mar 20 2018 09:36
@diomed Ok got it thanks. I think most of my projects are unuseless then :P
CamperBot
@camperbot
Mar 20 2018 09:36
johnnybizzel sends brownie points to @diomed :sparkles: :thumbsup: :sparkles:
:star2: 5359 | @diomed |http://www.freecodecamp.org/diomed
May Kittens Devour Your Soul
@diomed
Mar 20 2018 09:37
haha . mine too
Johnny
@JohnnyBizzel
Mar 20 2018 09:37
@ki4jgt I did not see the function being called.
Jesse
@ki4jgt
Mar 20 2018 09:38
I rename my console.log() to print for ease of use and thought it would confuse people to see print(primeTest(10));
But when the answer is returned from the function (either false or positive) it's returned twice.
Johnny
@JohnnyBizzel
Mar 20 2018 09:43
@ki4jgt what is print exactly?
Jesse
@ki4jgt
Mar 20 2018 09:45
const print = console.log;
I used it in all my JS projects and I've removed it from this one, only to still get the same answer, twice, from my function.
BuntyBru
@BuntyBru
Mar 20 2018 09:48

Can anyone please explain me this line
"Node.js is asynchronous and event driven in nature. As a result, it’s very good at handling I/O bound tasks"

Thank you

Johnny
@JohnnyBizzel
Mar 20 2018 09:50
1Return.png
@ki4jgt Only one return
BuntyBru
@BuntyBru
Mar 20 2018 09:51
@JohnnyBizzel
could you help me with my query
?
Jesse
@ki4jgt
Mar 20 2018 09:51
@BuntyBru When you read or write (Input/Output) to a disk, it takes time. Traditional servers serve one person at a time. Someone connects and asks for data, then the server holds up everyone else in line, while it goes and gets what you want.
Johnny
@JohnnyBizzel
Mar 20 2018 09:51
@BuntyBru async events like api calls take time to respond. Node is good at handling these.
BuntyBru
@BuntyBru
Mar 20 2018 09:51
Okay got it
Thanks Johnny and Jesse
Johnny
@JohnnyBizzel
Mar 20 2018 09:51
@BuntyBru :+1:
Almost got a cookie there :cookie:
Jesse
@ki4jgt
Mar 20 2018 09:52
:thumbsup:
Johnny
@JohnnyBizzel
Mar 20 2018 09:52
@BuntyBru thanks for the question, have a cookie!
@camperbot where's the cookies??
:frowning:
Jesse
@ki4jgt
Mar 20 2018 09:53
@JohnnyBizzel the console is logging it twice for me and I thought maybe that was why I was failing my test.
BuntyBru
@BuntyBru
Mar 20 2018 09:53
well i will have
I think camperbot ate all the cookies
@JohnnyBizzel
Johnny
@JohnnyBizzel
Mar 20 2018 09:54
lol
1repl.png
@ki4jgt On repl.it also only logs once.
Jesse
@ki4jgt
Mar 20 2018 09:56
Thanks @JohnnyBizzel, don't know what's going on. Maybe it's a Firefox thing?
CamperBot
@camperbot
Mar 20 2018 09:56
ki4jgt sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:star2: 1811 | @johnnybizzel |http://www.freecodecamp.org/johnnybizzel
Johnny
@JohnnyBizzel
Mar 20 2018 09:56
@ki4jgt Try it on an different browser?
Hey cookies!
Jesse
@ki4jgt
Mar 20 2018 09:56
:thumbsup:
So what are the brownie points used for?
Johnny
@JohnnyBizzel
Mar 20 2018 09:57
@ki4jgt They are not "used" for anything. It is a way to credit people for helping others.
@ki4jgt You also get points for completing projects.
Jesse
@ki4jgt
Mar 20 2018 09:58
I mean, do they add to the points in your profile?
BuntyBru
@BuntyBru
Mar 20 2018 09:58
well i think the cookie stock is full now
Johnny
@JohnnyBizzel
Mar 20 2018 09:58
Yeah I'm too fat!
@ki4jgt Yes, the score in top right.
BuntyBru
@BuntyBru
Mar 20 2018 10:04

@ki4jgt
Asynchronous method means that it will stop the further process and will resume only when it is completed

where Synchronous methods will let the other methods process

?
Jesse
@ki4jgt
Mar 20 2018 10:11

Asynchronous means that while someone is waiting or doing something else, what they're doing won't keep the server from doing something else for someone else.

The best way I can think to describe it is in a restaurant. Your waiter can either take 1 person's order, wait til it's fixed and then take someone else's order or they can keep taking orders and putting them in line, only visiting the chef to pick up the orders once they're finished. An asynchronous server keeps taking requests for data whenever someone connects. Then, when a database finds that data, the server takes it to the connection who requested it. In a normal server, the thread which started the initial connection would look for the data (not the database) and it wouldn't be able to help anyone else until it gave that connection what it wanted.

Johnny
@JohnnyBizzel
Mar 20 2018 10:11
@BuntyBru Depends. This is the section in the docs you should read: https://nodejs.org/en/docs/guides/blocking-vs-non-blocking/
Jesse
@ki4jgt
Mar 20 2018 10:12
Asynchronous servers save time and serve more connections.
Johnny
@JohnnyBizzel
Mar 20 2018 10:13
@BuntyBru A video explanation has the same example Jesse uses: https://node.university/courses/you-dont-know-node/lectures/1590280
Jesse
@ki4jgt
Mar 20 2018 10:36
@JohnnyBizzel, know anything about the underbellies of databases?
Johnny
@JohnnyBizzel
Mar 20 2018 10:36
@ki4jgt I know I have a belly :smile:
Fabien SHAN
@X140hu4
Mar 20 2018 10:37
Do databases have belly buttons?
Jesse
@ki4jgt
Mar 20 2018 10:38
:D. Wrote my own DB to put on my resume. It uses Push, Pull, and Drop to manipulate data. I'm wondering if I should add tables to it or not but seeing as I don't have much hands-on experience with the needs of the day-to-day web dev, I thought I'd ask someone else.
Johnny
@JohnnyBizzel
Mar 20 2018 10:46
@ki4jgt How does it handle collision detection? What if 2 users open a record for writing?
@ki4jgt With tables you will have to manage the relationships somehow.
Jesse
@ki4jgt
Mar 20 2018 10:47
There's a cache for writing and a single thread writes the cache values as they come in. That thread (started with the main server) is the only one with access to write anything.
Johnny
@JohnnyBizzel
Mar 20 2018 10:47
@ki4jgt Not impossible.,
@ki4jgt Ok, sounds good :+1:
Aditya
@ezioda004
Mar 20 2018 10:47
@X140hu4 Are you going to tickle them? :laughing:
Jesse
@ki4jgt
Mar 20 2018 10:51
Well, my concept of tables is a value stored in the database which links to other information. The way I want it setup, is that if someone pushes a value to "users.bob", the database adds bob to the internal value: users, while also creating a listing for bob. I didn't know if I should just allow my users to do that for themselves or have the database do it with the dot-separator.
Johnny
@JohnnyBizzel
Mar 20 2018 10:54
@ki4jgt Sounds like JSON
Jesse
@ki4jgt
Mar 20 2018 10:55
Yeah, the database values are stored in JSON.
Johnny
@JohnnyBizzel
Mar 20 2018 10:57
@ki4jgt How about if "bob" has friends and you want to save who he is friends with?
Jesse
@ki4jgt
Mar 20 2018 10:58
Then bob's value in the database would be {"bob"{"friends":["Jeff", "Amy", "Steve"]}}
The database value for users would be ["bob", "user1", "user2"]
So users would be a table of reference values while bob would be his own value in the database.
Johnny
@JohnnyBizzel
Mar 20 2018 11:01
@ki4jgt Do you want to make it a relational Db?
May Kittens Devour Your Soul
@diomed
Mar 20 2018 11:02

Do databases have belly buttons?

asking the real questions here

I'd like to know too
Johnny
@JohnnyBizzel
Mar 20 2018 11:02
lol
Jesse
@ki4jgt
Mar 20 2018 11:04
That's my problem. I don't know if it's beneficial to make it a relational database or keep it a key-value store only. I mean, the user could make it relational if they needed to but using the dot-separator would help people who didn't want to go through the hassle. Which is why I asked, really. Is the hassle worth it to the average user?
Johnny
@JohnnyBizzel
Mar 20 2018 11:05
Question: If you want to add an event listener to several controls you have to...
object.addEventListener("click", myScript);
So do you have to get the obj collection and loop over it?
So the power of a relational db comes with the SQL. At the moment you have CRUD operations but Querying the data is more important.
JSON is not that easy to query.
eg) show me all Bobs friends who are also friends with Jeff.
Jesse
@ki4jgt
Mar 20 2018 11:09
Then you'd have to pull up both Bob and Jeff and compare notes. How does SQL handle that?
Johnny
@JohnnyBizzel
Mar 20 2018 11:10
I was thinking you would have a lookup table. You might be able to do this in your Db?
Anyway, it is a many to many relationship.
So it would be of 2 fields... ID person 1 - ID person2
person 1 is friends with person 2.
But yours is an NoSQL db so forget all that!! :D
Jesse
@ki4jgt
Mar 20 2018 11:14
Trying to think of how to put yours into play into mine. :D.
rahulgoyle
@rahulgoyle
Mar 20 2018 11:16
Hello everyone
I am trying to solve fcc regex challenge in which i have to specify upper and lower number of matches found
but i am unable to get it done
Here is the link to that challenge
Jesse
@ki4jgt
Mar 20 2018 11:17
Also, has FCC pushed the beta yet?
May Kittens Devour Your Soul
@diomed
Mar 20 2018 11:17
Ohhh no
rahulgoyle
@rahulgoyle
Mar 20 2018 11:18
anything you know?
it's matching the ohhhhhhh no
while according to tests it shouldn't
May Kittens Devour Your Soul
@diomed
Mar 20 2018 11:20
iMeant more like in Ohhh no regex :scream:
Jesse
@ki4jgt
Mar 20 2018 11:33
In my code: https://codepen.io/ki4jgt/pen/qVxdWN?editors=0010 my function sumPrimes only considers 10, 4, and 1 when I enter 10. I don't understand what is going on.
Ken Haduch
@khaduch
Mar 20 2018 11:39
@ki4jgt - you are using i as a variable in both your sumPrimes and primeTest functions, but you are not using the var or let keyword to declare it, hence it is a global variable, so it is being modified in both functions. Add the var in front of your i initialization in both for loop, and you'll get better results. With the var keyword, the i will be locally scoped in each function.
Ken Haduch
@khaduch
Mar 20 2018 11:47
@rahulgoyle - what does your regular expression look like, if you are still stuck on that challenge?
Jesse
@ki4jgt
Mar 20 2018 11:48
@khaduch Thanks.
CamperBot
@camperbot
Mar 20 2018 11:48
ki4jgt sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3806 | @khaduch |http://www.freecodecamp.org/khaduch
Ken Haduch
@khaduch
Mar 20 2018 11:55
@ki4jgt - you're welcome...
@rahulgoyle - if you are still trying to solve that regex, the thing that you have to watch out for, besides specifying the proper "quantity specifier" is what happens after the expression match. In other words, you might have to put something after the quantity specifier to make sure that the characters afterward are not a match.
rahulgoyle
@rahulgoyle
Mar 20 2018 12:06
yes i am still stuck bro
@khaduch this is what my regex looks like
rahulgoyle
@rahulgoyle
Mar 20 2018 12:13
/h{3,6}/
BuntyBru
@BuntyBru
Mar 20 2018 12:17
thanks @JohnnyBizzel and @ki4jgt
CamperBot
@camperbot
Mar 20 2018 12:17
buntybru sends brownie points to @johnnybizzel and @ki4jgt :sparkles: :thumbsup: :sparkles:
:cookie: 286 | @ki4jgt |http://www.freecodecamp.org/ki4jgt
:star2: 1812 | @johnnybizzel |http://www.freecodecamp.org/johnnybizzel
Johnny
@JohnnyBizzel
Mar 20 2018 12:18
@BuntyBru :+1:
Jesse
@ki4jgt
Mar 20 2018 12:33
@BuntyBru :thumbsup:
Ken Haduch
@khaduch
Mar 20 2018 13:04
@rahulgoyle - sorry, I was away from the computer for a while. Your expression /h{3,6}/ does match 3 through 6 h characters, but there is nothing to prevent it from a positive match if there are more than 6 h characters. That is the case that you have to consider. If there are 7 h characters, it will still match the first 6, which is a positive match. So after the closing }, you have to do something to insure that it will not match another h - since the string that they are matching against will have a space after the hhhhhhhh you can require that after your quantity specifier, there has to be something else. You could just add a space after that, so that it will only match up to 6 h characters, and then require that the next character is a space. Or you could put an expression like [^h] which would say something other than an h has to be there. It takes a little while to wrap your head around how the expressions work, but you are close and just need to think about the entire string.
Jesse
@ki4jgt
Mar 20 2018 13:05

Is it cheating to use this:

JSON.stringify(arr).match(/["]?[\d\w(\{.\})]+["]?/g).map(function(value){return JSON.parse(value);})

for the steamroller exercise? I got bored and figured a regular expression would work a lot better.

Ken Haduch
@khaduch
Mar 20 2018 13:07
@ki4jgt - I think that I saw a similar solution using a regular expression. There might even be something along those lines in the "hints" for that exercise? So it's not "cheating" - it's a creative solution to the problem using a different tool that is available. At least that's what I would say.
Jesse
@ki4jgt
Mar 20 2018 13:08
@khaduch I checked the hints section. They all had numerous lines of code which used recursive searching. Didn't make sense to me, so I did it that way. The problem is, I know the point the lesson was trying to teach and doing it my way, avoided said point altogether.
Ken Haduch
@khaduch
Mar 20 2018 13:30
@ki4jgt - yeah, I can't remember where I saw a similar solution that just went through and stripped out the square brackets and other kruft. Maybe someone else posted it in the code review room? Creativity is good!
rahulgoyle
@rahulgoyle
Mar 20 2018 13:31
@khaduch i tried writing \s after that closing brace but still it didn't worked
Ken Haduch
@khaduch
Mar 20 2018 13:32
@rahulgoyle - hmmm - one other thing that you might want to do is put the first part of the word in there "O" to "anchor" the expression to the expected beginning of the word. That's probably what's going on, now that I look at your expression again. Your new expression with the \s will otherwise match the last 6 h characters of the word Ohhhhhhh so adding the first "O" and having the following whitespace should make it pass.
rahulgoyle
@rahulgoyle
Mar 20 2018 13:46
Thanks@khaduch that worked
I have been stuck on this challenge from quite sometime
Jesse
@ki4jgt
Mar 20 2018 14:05
I need some motivation guys.
Ghost
@ghost~5a4a80acd73408ce4f859755
Mar 20 2018 14:06
@ki4jgt motivation for?
iammanmohit
@iammanmohit
Mar 20 2018 14:10
Guys what is IBM Watson?
have a look guys
the button dissapears after being clicked i want it to remain
so i can click to generate another
quote
iammanmohit
@iammanmohit
Mar 20 2018 14:14
If anyone here knows about IBM Watson? What is it?
Daniel
@dkapexhiu
Mar 20 2018 14:17
hello! what are better ways to display data in php from a database in mysql other than table?
Manish Giri
@Manish-Giri
Mar 20 2018 14:21

@gishy1

document.getElementById('Quote').innerHTML=myQuotes[number];

you're overwriting the content of the Quote div in this line

so the button is gone
Darren
@DarrenfJ
Mar 20 2018 14:28
morning fCC
:wave: @Manish-Giri buddy! :D
Manish Giri
@Manish-Giri
Mar 20 2018 14:29
@DarrenfJ hola amigo :wave:
teach me css grid
Darren
@DarrenfJ
Mar 20 2018 14:30
@iammanmohit haven't thought about IBM's Watson for a while but it was supposed to be some AI thing they offered.. not sure if it was cloud or not, and I think they intended it to be free? at least initially?
@Manish-Giri hilariously i just finished grid on codecademy and already forgot most of it lol
but you declare the grid and then define it like CSS properties...
it's like display: grid; or something then you define the size
there's some ability to do dynamic grid sizes like if your are not how big your table will be, and how to override it also
you can like declare a grid of say 12 but then tell it where a row starts and ends,, same with a column
Manish Giri
@Manish-Giri
Mar 20 2018 14:35
@DarrenfJ aw all that sounds really complex
Darren
@DarrenfJ
Mar 20 2018 14:37
it's not that bad when you get into it...
I'm going to cheat off of https://css-tricks.com/making-a-bar-chart-with-css-grid/ (of course it's css-tricks that explains it well)
to help explain so i can remember the details
.chart {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-column-gap: 5px;
}
you can do a grid layout at the start and then modifiy it last... the fr is fraction so you can break up the grid into fractions of the screen
you then decide where a particlar html thing or class starts and stops
grid-row-start: 1;
  grid-row-end: 101;
Sweet Coding :)
@SweetCodingInc
Mar 20 2018 14:41
@DarrenfJ Ser Darren :wave:
Darren
@DarrenfJ
Mar 20 2018 14:41
shorthand is grid-row: 2 / 4; start at 2 and stop at 4...
like um, everything,, like slice.. it stops at 4 u doesn;t inlcude 4
hey buddy! @SweetCodingInc
Kyle Holm
@thekholm80
Mar 20 2018 14:41
@DarrenfJ @SweetCodingInc :wave:
Sweet Coding :)
@SweetCodingInc
Mar 20 2018 14:42
@thekholm80 Ser Kyle :wave:
Darren
@DarrenfJ
Mar 20 2018 14:42
@thekholm80 hello sir!
Kyle Holm
@thekholm80
Mar 20 2018 14:42
it looks like react-bootstrap is using grid
i think that's pretty neat
Darren
@DarrenfJ
Mar 20 2018 14:43
@Manish-Giri this should take like no time at all to go through: https://www.codecademy.com/courses/learn-css-grid/lessons/css-grid-i/exercises/grid-intro
Sweet Coding :)
@SweetCodingInc
Mar 20 2018 14:43
Such a fruity name for a site lol
Darren
@DarrenfJ
Mar 20 2018 14:44
I haven't checked out this one yet but I did on CSS variables (also very cool) but I like the teaching tool: https://scrimba.com/g/gR8PTE
Ken Haduch
@khaduch
Mar 20 2018 14:44
@Manish-Giri wesbos.com has a free CSS grid course, I haven't tried it, but he seems to do a pretty good job.
Darren
@DarrenfJ
Mar 20 2018 14:44
and while yer in there check out the CSS variable course: https://scrimba.com/g/gcssvariables
@khaduch buddy! :D
Sweet Coding :)
@SweetCodingInc
Mar 20 2018 14:45
@DarrenfJ typing yer is a nice hack to avoid your you'reconfusion :P
Darren
@DarrenfJ
Mar 20 2018 14:46
@thekholm80 thanks for the link.. will go check out the garden when right after I do the scrimba to keep the grid fresh.. I've already forgotten most of it lol
CamperBot
@camperbot
Mar 20 2018 14:46
darrenfj sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1734 | @thekholm80 |http://www.freecodecamp.org/thekholm80
Ken Haduch
@khaduch
Mar 20 2018 14:46
@rahulgoyle - it might be helpful to you, just to firm up your knowledge about what is going on there, to take that case that was failing and your original and modified expressions to a site like http://regexr.com, where they show you the match for your expression, and you'll get a better understanding of why it wasn't and then was matching with the modifications.
Darren
@DarrenfJ
Mar 20 2018 14:46
@SweetCodingInc saves me the worry ;)
Ken Haduch
@khaduch
Mar 20 2018 14:46
@DarrenfJ - hey there!
@DarrenfJ - oooh, I'll have to check out your links for scrimba.com - always nice to check out new resources... thanks!
CamperBot
@camperbot
Mar 20 2018 14:47
khaduch sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2430 | @darrenfj |http://www.freecodecamp.org/darrenfj
Manish Giri
@Manish-Giri
Mar 20 2018 14:50
@DarrenfJ @khaduch ty
CamperBot
@camperbot
Mar 20 2018 14:50
manish-giri sends brownie points to @darrenfj and @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 2431 | @darrenfj |http://www.freecodecamp.org/darrenfj
:star2: 3807 | @khaduch |http://www.freecodecamp.org/khaduch
Darren
@DarrenfJ
Mar 20 2018 14:51
scrimba's cool cause you watch a vid then if you stop the vid you can code right in the vid! So he does an exercise then says to stop it and try it out yourself... it's pretty effective in that regard.
I think too they're open sources the tool
just checked and yah... it's a GitHub community https://github.com/scrimba/community
Kyle Holm
@thekholm80
Mar 20 2018 14:54
fCC should give lessons on understanding other people's code
i read someone's repo and i'm almost always completely lost
Darren
@DarrenfJ
Mar 20 2018 14:55
it's MIT licensed
Ken Haduch
@khaduch
Mar 20 2018 15:01
@thekholm80 - that's a good point - the funny thing is, that I go back and look at code that I wrote (sometimes a long time ago) and just ask myself "Did I do that?"... I've been amazed at some of the things that I used to know how to do! And befuddled at the same time... :)
Darren
@DarrenfJ
Mar 20 2018 15:02
me too
me three i guess in this case ;)
Kyle Holm
@thekholm80
Mar 20 2018 15:02
haha @khaduch i had one of those moments just the other day ... Manish and I were discussing a kata on codewars that he solved using XOR, i thought that was a great approach ... then i looked at a solution i did a few months ago to the same kata and saw that I used XOR too
Darren
@DarrenfJ
Mar 20 2018 15:03
ha!
Ken Haduch
@khaduch
Mar 20 2018 15:04
@thekholm80 - when I used to work for a company where i didn't mind printing 50 pages of code, I would do that and then go through it and make notes about different things. I guess that if I took the time to comment my own code appropriately that it would help me when my short term memory (and long term memory) don't work all that well... But in general, remembering this stuff is a challenge!
Kyle Holm
@thekholm80
Mar 20 2018 15:05
i spend a lot of time cussing myself for not commenting code
Ken Haduch
@khaduch
Mar 20 2018 15:05
@Manish-Giri - I just checked the http://wesbos.com/announcing-my-css-grid-course/ Wes Bos course, and it's free - I wasn't sure about that after I mentioned, but it's there.
Darren
@DarrenfJ
Mar 20 2018 15:06
i redid exact change a while back when someone as going through all the js challenges.. and I had to comment like crazy.. so much so that when I went to lok at my saved result it crashed and said it was too much to dsiplay on the screen lol!
actually.. too many characters.
Kyle Holm
@thekholm80
Mar 20 2018 15:06
lol
gishy1
@gishy1
Mar 20 2018 15:07
@Manish-Giri yes i think im getting it
Darren
@DarrenfJ
Mar 20 2018 15:07
oh cool the fCC page with your solutions has a new format.. pop-ups the solution
and now it does let me check the code and it's horrible.. all the console logs and comments and variable names...
Kyle Holm
@thekholm80
Mar 20 2018 15:09
lol
Darren
@DarrenfJ
Mar 20 2018 15:09
I'll give you a small taste:
function cleanOutTheTill(pileForCust, changeLeft, whatDemoninationValueDealingWith, whatDollarName, howMuchofIt) {
  var changeLefttoDealWith = parseFloat(Math.round((changeLeft - howMuchofIt) * 100) / 100).toFixed(2);
  //if money in till is more than amount. subtract and return leftChange and add to array
  //remember demonination here, so can only deduct 'even' coin amounts
  if (changeLefttoDealWith < 0) {  
    // here we subtract even coin amounts using modulus
    var left = changeLeft%whatDemoninationValueDealingWith;
    if (left === 0) {
      changeLefttoDealWith = 0;
      pileForCust = [whatDollarName, changeLeft];
    } else {
      // divide to find coins to reduce by
      var reduce = Math.floor(changeLeft/whatDemoninationValueDealingWith);
      var payOut = 
    parseFloat((Math.round((whatDemoninationValueDealingWith*reduce) * 100) / 100).toFixed(2));
I left the console logs out of it but throw in about 20 of them
Kyle Holm
@thekholm80
Mar 20 2018 15:11
i'm all about some meaningful variable names, but come on now
Darren
@DarrenfJ
Mar 20 2018 15:11
I think I was coding it along with them when they asked Q's
seriously eh lol!
I was trying to do it fast so I could kep up with their q's...
Kyle Holm
@thekholm80
Mar 20 2018 15:12
lol
Darren
@DarrenfJ
Mar 20 2018 15:12
and had no time to remember whan my varialbes actually where ha!
that's horrible ^^^^
and now it's my latest solution
Kyle Holm
@thekholm80
Mar 20 2018 15:13
you know what I always say: Make it work, then make it pretty
Darren
@DarrenfJ
Mar 20 2018 15:14
but i couldn't cause it wouldn't let me view my solution and the cache was gone too! lol!
but now they go it in a modal so you can view it without leaving the fCC profile page
Kyle Holm
@thekholm80
Mar 20 2018 15:16
that's a good improvement
Darren
@DarrenfJ
Mar 20 2018 15:30
it is actually.. i like it better
Darren
@DarrenfJ
Mar 20 2018 15:39
welp
back to testing
DarrenfJ @DarrenfJ sneaks off to test boring functionality in a boring world of boring
Kyle Holm
@thekholm80
Mar 20 2018 16:06
blockchain is so hot right now
Aditya
@ezioda004
Mar 20 2018 16:15
It is indeed
Kyle Holm
@thekholm80
Mar 20 2018 16:16
@ezioda004 haha i saw that ... it's amazing how useless buzzwords can affect the economy.
yesterday it was machine learning, today blockchain ... tomorrow ?
Aditya
@ezioda004
Mar 20 2018 16:17
Lol, I wonder what investors think "Hmm my grandchild keeps talking abt this bitcoin, I better invest in that shiz"
@thekholm80 I dont think we'll be there to know that, AI uprising is coming, hide in yo bunkers
Kyle Holm
@thekholm80
Mar 20 2018 16:19
i saw a video of a robot dog that can open doors. why would you teach them that? that's one less layer of protection for us
warning: can cause nightmares
Aditya
@ezioda004
Mar 20 2018 16:22
Oh yes I know that, they made a black mirror episode with same design and I think boston dynamics played along and posted that video you lined after it was aired.
Kyle Holm
@thekholm80
Mar 20 2018 16:22
i love black mirror
Aditya
@ezioda004
Mar 20 2018 16:23
Have you watched the latest season?
Kyle Holm
@thekholm80
Mar 20 2018 16:23
the last episode i watched was the christmas episode
so .. that was the end of season 2 or 3?
Aditya
@ezioda004
Mar 20 2018 16:24
I think that was 2
I like how they reference all these pre existing episodes in their new ones, kinda like a universe of its own
Kyle Holm
@thekholm80
Mar 20 2018 16:25
yeah
i'm hoping there's some grand unifying theme to it all
si
@demon9181
Mar 20 2018 16:31
function steamrollArray(arr) {
  // I'm a steamroller, baby
  var newarr = [];
  arr.forEach(item => {
    if (Array.isArray(item)) {
      newarr.push(...steamrollArray(item));
    } else {
      newarr.push(item);
    }
  });
  return newarr;
}

steamrollArray([1, [2], [3, [[4]]]]);
could someone help me understand the if statement here, i copypastad this code and it passes
what is the Array of Array.isArray?
The Array.isArray() function determines whether the passed value is an Array.
si
@demon9181
Mar 20 2018 16:35
thanks but still unclear what the Array part is
Kyle Holm
@thekholm80
Mar 20 2018 16:35
it's a data type
for example [1, 'a', 3] is an array
si
@demon9181
Mar 20 2018 16:36
but why would i need to specify its an Array if the function already is isArray which presumably checks if its an array?
Aditya
@ezioda004
Mar 20 2018 16:36
Array.isArray The Array part is an Object and isArray() is a method of that Array Object.
Kyle Holm
@thekholm80
Mar 20 2018 16:36
isArray() is a property of the Array global object
to use the isArray() method you need to reference it's object, Array
si
@demon9181
Mar 20 2018 16:38
got it thank you @ezioda004 @thekholm80
CamperBot
@camperbot
Mar 20 2018 16:38
demon9181 sends brownie points to @ezioda004 and @thekholm80 :sparkles: :thumbsup: :sparkles:
:cookie: 506 | @ezioda004 |http://www.freecodecamp.org/ezioda004
:star2: 1735 | @thekholm80 |http://www.freecodecamp.org/thekholm80
gishy1
@gishy1
Mar 20 2018 16:43
HELLO WORLD!!
LOOKING FOR SOME CONSTRUCTIVE CRITICISM HERE
fa icons are not workig also let me know if there is anything I need to work on
thanks
:smile:
Aditya
@ezioda004
Mar 20 2018 16:47
I suppose you have to specify that and use Array object and cant use that in your Array literal because those methods like isArray are not prototype methods? Because
let x = [1, 2, 3];
x instanceof Array //true
and Array is a constructor function
Kyle Holm
@thekholm80
Mar 20 2018 16:48
i wonder if it's preferable over typeof
Aditya
@ezioda004
Mar 20 2018 16:49
typeof for arrays return object so you have to use isArray instead
Kyle Holm
@thekholm80
Mar 20 2018 16:49
interesting
Aditya
@ezioda004
Mar 20 2018 16:49
Man JS
Kelechi Chinaka
@ke1echi
Mar 20 2018 16:56
:wave guys
hows it going with cs50? @ezioda004
Aditya
@ezioda004
Mar 20 2018 16:58
@kelechy Hey Ive been busy a bit but, completed pset3 and now gotta start with week3. What about you?
Kelechi Chinaka
@ke1echi
Mar 20 2018 17:00
busy with non-coding stuff @ezioda004 at the last part of pset3
Aditya
@ezioda004
Mar 20 2018 17:01
Frequency function?
Honestly in pset3 the hardest part was to learn how to read a music sheet
I still dont know if I wrote it correctly, but it passes the test so I'll let that slide lol
Kelechi Chinaka
@ke1echi
Mar 20 2018 17:02
yea.. frequency
lol that took awhile to learn too... i wrote mine well
Nazar
@IsaakNazar
Mar 20 2018 17:18
@ezioda004 Hi! Do you use react with webpack?
Aditya
@ezioda004
Mar 20 2018 17:20
@kelechy Yeah, goodluck :thumbsup:
@IsaakNazar Yes
Nazar
@IsaakNazar
Mar 20 2018 17:21
@ezioda004 Did you install react babel webpack manually or not?
@ezioda004 I also installed style-loader and css-loader but doesnt work
Aditya
@ezioda004
Mar 20 2018 17:24
I'm using this boilerplate so it came with babel, webpack etc
Not sure why style-loader doesnt work, I'm not experienced with that
Nazar
@IsaakNazar
Mar 20 2018 17:27
@ezioda004 I installed webpack manually through off.Docs, but somehow it doesnt work, spent 2 hours with no luck :worried:
Aditya
@ezioda004
Mar 20 2018 17:31
@IsaakNazar Is it installed globally? You can check with npm -g ls
Nazar
@IsaakNazar
Mar 20 2018 17:31
@ezioda004 on the DOCs doesnt say that I need install it globally
Aditya
@ezioda004
Mar 20 2018 17:37
@IsaakNazar Ah then idk how to fix it :/ probably someone in the JS room or main room can help
Nazar
@IsaakNazar
Mar 20 2018 17:39
@ezioda004 :+1:
Kelechi Chinaka
@ke1echi
Mar 20 2018 17:40
goodluck to u too @ezioda004
Kyle Holm
@thekholm80
Mar 20 2018 17:52
@IsaakNazar did you make a webpack.config.js file?
it should be in the root of your project directory
Nazar
@IsaakNazar
Mar 20 2018 17:54
@thekholm80 yes I did, I'm re creating project again , maybe then style-loader will work
Kyle Holm
@thekholm80
Mar 20 2018 17:54
if you'd like some help, i'm not a webpack master but i generally get it to do what i need
Nazar
@IsaakNazar
Mar 20 2018 17:59
@thekholm80 do you install through off Docs?

ERROR in ./src/index.js
Module not found: Error: Can't resolve 'style-loader' in 'C:
\Users\Nazar\Desktop\myapp'
 @ ./src/index.js 3:0-21
Kyle Holm
@thekholm80
Mar 20 2018 18:02
my general workflow in starting a new react project is to open my terminal then:
  1. mkdir my_new_project && cd my_new_project make a new folder for my project
  2. npm init initialize a new project, hit enter for all the questions
  3. npm install --save react react-dom install basic react packages
  4. npm install --save-dev babel-core babel-loader babel-preset-env babel-preset-react css-loader file-loader style-loader webpack webpack-dev-server get the dev tools
  5. open my text editor and start scaffolding
generally the basic files i need are
  1. index.js, index.css, index.html the basic entry points
  2. webpack.config.js tells webpack what to do
  3. package.json automatically created by npm init
  4. .babelrc some config for babel
the react eco-system is a steep learning curve, but you can do it
Nazar
@IsaakNazar
Mar 20 2018 18:06
@thekholm80 I'm importing like this import './style.css';
Module not found: Error: Can't resolve 'style-loader' in 'C:\Users\Nazar\Desktop\mya
pp'
 @ ./src/index.js 3:0-21
Kyle Holm
@thekholm80
Mar 20 2018 18:07
how did you install style-loader?
Nazar
@IsaakNazar
Mar 20 2018 18:07
but I've already installed style-loader and css-loader
Kyle Holm
@thekholm80
Mar 20 2018 18:07
okay, but HOW did you install them
Nazar
@IsaakNazar
Mar 20 2018 18:08
@thekholm80
npm install --save-dev style-loader css-loader
Kyle Holm
@thekholm80
Mar 20 2018 18:08
do you see them in your node_modules folder?
Nazar
@IsaakNazar
Mar 20 2018 18:08
@thekholm80 package.json?
Kyle Holm
@thekholm80
Mar 20 2018 18:09
one sec, lemme open a project
Nazar
@IsaakNazar
Mar 20 2018 18:09
@thekholm80 nope, inside node_modules only 2 folders
Kyle Holm
@thekholm80
Mar 20 2018 18:09
while my vm boots, do you see those listed in your package.json?
Nazar
@IsaakNazar
Mar 20 2018 18:10
inside package.json
"devDependencies": {
    "css-loader": "^0.28.11",
    "style-loader": "^0.20.3",
    "webpack": "^4.1.1",
    "webpack-cli": "^2.0.12"
  },
Kyle Holm
@thekholm80
Mar 20 2018 18:10
can you do npm install?
Nazar
@IsaakNazar
Mar 20 2018 18:10
ok 1 sec
@thekholm80 nothing, same 2 folders
@thekholm80 2 folders are lodash and .cache
Kyle Holm
@thekholm80
Mar 20 2018 18:12
crazy
my last project has 784 folders in the node_modules directory, i think you might be missing some
Nazar
@IsaakNazar
Mar 20 2018 18:13
@thekholm80 maybe I have to install like you U usually installing?
Kyle Holm
@thekholm80
Mar 20 2018 18:14
what does your .cache file say?
Nazar
@IsaakNazar
Mar 20 2018 18:15
@thekholm80 inside is single folder named uglifyjs-webpack-plugin
Kyle Holm
@thekholm80
Mar 20 2018 18:15
very weird
can you make a new project folder and go through the steps i listed?
starting at #2
Nazar
@IsaakNazar
Mar 20 2018 18:16
@thekholm80 Ok, I'll try
Kyle Holm
@thekholm80
Mar 20 2018 18:28
@IsaakNazar with me so far?
when your node_modules finish installing make a new file called webpack.config.js
open it, and paste in:
const webpack = require('webpack'),
      HtmlWebpackPlugin = require('html-webpack-plugin');

const config = {
  entry: [
    './index.js'
  ],
  output: {
    path: __dirname + '/dist',
    publicPath: '/',
    filename: 'bundle.js'
  },
  module: {
    rules: [
      {
        test: /\.(js|jsx)$/,
        exclude: [/node_modules/],
        use: ['babel-loader']
      },
      {
        test: /\.css$/,
        use: ['style-loader', 'css-loader']
      }
    ]
  },
  resolve: {
    extensions: ['*', '.js', '.jsx']
  },
  devServer: {
    historyApiFallback: true
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: './index.html'
    })
  ]
}

if (process.env.NODE_ENV === 'production') {
  config.plugins.push(
    new webpack.DefinePlugin({
      'process.env': {
        'NODE_ENV': JSON.stringify(process.env.NODE_ENV)
      }
    }),
    new webpack.optimize.UglifyJsPlugin()
  )
}

module.exports = config;
then you'll need to edit your package.json file, make sure you have both of these:
  "babel": {
    "presets": [
      "env",
      "react"
    ]
  },

  "scripts": {
    "start": "webpack-dev-server --open",
    "build": "NODE_ENV='production' webpack -p"
  },
Nazar
@IsaakNazar
Mar 20 2018 18:31
@thekholm80 my laptop is too slow, takes some time :worried:
Kyle Holm
@thekholm80
Mar 20 2018 18:31
no worries
Nazar
@IsaakNazar
Mar 20 2018 18:41

@thekholm80 where should I put

"babel": {
    "presets": [
      "env",
      "react"
    ]
  },

inside devDependencies?

Kyle Holm
@thekholm80
Mar 20 2018 18:41
no
Nazar
@IsaakNazar
Mar 20 2018 18:41
@thekholm80 before scripts?
Kyle Holm
@thekholm80
Mar 20 2018 18:42
it can go anywhere on the top level of the tree
Nazar
@IsaakNazar
Mar 20 2018 18:42
@thekholm80 what's next?
Kyle Holm
@thekholm80
Mar 20 2018 18:43
make a file called index.html
then put this in it:
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Nazar's Awesome React App</title>
  </head>
  <body>
    <div id='app'></div>
  </body>
</html>
Nazar
@IsaakNazar
Mar 20 2018 18:43
@thekholm80 the same direction as webpack.config.js?
Kyle Holm
@thekholm80
Mar 20 2018 18:44
you should have everything in the root directory of your project
MyProject
--node_modules
--package.json
--index.html
--index.js
--index.css
--webpack.config.js
Nazar
@IsaakNazar
Mar 20 2018 18:44
@thekholm80 ok
Kyle Holm
@thekholm80
Mar 20 2018 18:45
inside your index.js file put this:
import React from 'react';
import ReactDOM from 'react-dom';

import './index.css';

const App = () => {
  return (
    <div>
      Hello!
    </div>
  );
}

ReactDOM.render(
  <App />,
  document.getElementById('app')
);
after that, if you've saved all the files you should be able to run npm run start in your terminal and have Hello! displayed in your browser (might take a minute for webpack to build & serve)
it's a lot of steps, but after you do it a few times it's not so bad
then you'll learn redux and the horror starts all over again lol
Nazar
@IsaakNazar
Mar 20 2018 18:49
@thekholm80
"webpack-dev-server" is not internal or external
command, executable program or batch file.
Kyle Holm
@thekholm80
Mar 20 2018 18:49
i don't do any of this on windows ... i'm not sure if you should be binding these commands to your bash or what
windows gives me a headache
@IsaakNazar maybe this will help
also, generally if someone suggests installing something globally, think really hard about it before you do it
it's not often the best suggestion
Nazar
@IsaakNazar
Mar 20 2018 19:02
@thekholm80 thank you so much for your help, appreciate!
CamperBot
@camperbot
Mar 20 2018 19:02
isaaknazar sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1736 | @thekholm80 |http://www.freecodecamp.org/thekholm80
Kyle Holm
@thekholm80
Mar 20 2018 19:02
@IsaakNazar any luck?
Nazar
@IsaakNazar
Mar 20 2018 19:02
still the same message
Kyle Holm
@thekholm80
Mar 20 2018 19:02
oh, sorry
if you ever switch to linux i'll be able to help you more lol
Nazar
@IsaakNazar
Mar 20 2018 19:03
@thekholm80 :smile:
Adam
@GoingAllTheWayUp
Mar 20 2018 19:14
I need help, I lost my password and email account to FCC
i know the e-mail, just don't have the access
Kyle Holm
@thekholm80
Mar 20 2018 19:20
@GoingAllTheWayUp you might try asking in this room: https://gitter.im/FreeCodeCamp/Contributors
Kaz Baig
@kbaig
Mar 20 2018 20:01
:wave:
Kyle Holm
@thekholm80
Mar 20 2018 21:25
@IsaakNazar apparently webpack has updated to 4.x so everything i said about it above doesn't seem to work
Henry
@GitHub-Henry
Mar 20 2018 21:57
@GoingAllTheWayUp
image.png
Adam
@GoingAllTheWayUp
Mar 20 2018 23:07
I lost the access to the e-mail account