These are chat archives for FreeCodeCamp/HelpJavaScript

4th
Jun 2018
Greg Duncan
@GregatGit
Jun 04 2018 03:44
@Craig939393_twitter its quite easy - it just sounds complicated (proto stuff)
anthonygallina1
@anthonygallina1
Jun 04 2018 04:13
I dont understand what I did wrong
Screenshot from 2018-06-03 21-10-42.png
abraham anak agung
@padunk
Jun 04 2018 04:17
@anthonygallina1 you using string? why not return boolean?
anthonygallina1
@anthonygallina1
Jun 04 2018 04:17
some tiimes
Nazar
@IsaakNazar
Jun 04 2018 04:19
I have 'link', and when I paste it to search bar it gives me 'callback link', how to make it in JS?
const link = 'www.someLInk.com';
const callbackLink = '';
function getCallbackLink(){ paste link variable to search bar , get the callback link and assign it to callbackLink variable};
anthonygallina1
@anthonygallina1
Jun 04 2018 04:19
well with the ternary operator Wont it return true or false any way?
Hi @IsaakNazar
Nazar
@IsaakNazar
Jun 04 2018 04:20
@anthonygallina1 Hi
anthonygallina1
@anthonygallina1
Jun 04 2018 04:21
use axious?
Nazar
@IsaakNazar
Jun 04 2018 04:22
@anthonygallina1 never used it before, let me check
abraham anak agung
@padunk
Jun 04 2018 04:23
@anthonygallina1 yes, but i think it will return string, not boolean
Fabien SHAN
@X140hu4
Jun 04 2018 04:25
@anthonygallina1 Your code works fine for me. I see that you console.log the check. If you reset the code or just take out he console log it should work
anthonygallina1
@anthonygallina1
Jun 04 2018 04:29
@padunk @X140hu4 thank you
abraham anak agung
@padunk
Jun 04 2018 04:30
@anthonygallina1 you're doing new challenge in fcc? how was it?
anthonygallina1
@anthonygallina1
Jun 04 2018 04:31
I like them but they dont all work right yet. They will get it. I made it through all the scss and css and the one for readers fine.
security ones arent working for me though.
Just a matter of time.. I have been around long. It all ways gets sraightened out. So far as I have seen. I am grateful to be here.
abraham anak agung
@padunk
Jun 04 2018 04:35
@anthonygallina1 sound cool, need to check it out soon.
Nazar
@IsaakNazar
Jun 04 2018 04:37
@anthonygallina1 I've tried axios, and it doesnt give proper callback url
David Young
@dayvidwhy
Jun 04 2018 04:37
what do you mean callback url?
Nazar
@IsaakNazar
Jun 04 2018 04:43
@dayvidwhy when user paste some url to search bar and hit enter, the page redirects the user to new URL, that URL I want to extract
using javascript
David Young
@dayvidwhy
Jun 04 2018 04:44
you want the url of the page? have you tried window.location.href ?
Nazar
@IsaakNazar
Jun 04 2018 04:44
@dayvidwhy ok, let me check
David Young
@dayvidwhy
Jun 04 2018 04:44
one thing though is if you manipulate the url of the page without navigating the user away, the href stored in window.location may not update, but if it’s after a page load you’ll be fine
Nazar
@IsaakNazar
Jun 04 2018 04:48
@dayvidwhy the thing is I want to do this process automatically, without pasting the url to search bar redirecting me and get URL via location.href
not manually
David Young
@dayvidwhy
Jun 04 2018 04:50
if you change window.location.href you can redirect the user if that helps, eg window.location.href = “https://navigatethe.user/away”
Nazar
@IsaakNazar
Jun 04 2018 04:52
@dayvidwhy ok thanx
Blauelf
@Blauelf
Jun 04 2018 08:18
@IsaakNazar So you essentially want to do a request equivalent to the form submit and parse the result?
Dimitris Nik.
@dimitrissnk
Jun 04 2018 08:38
I want to append newDivForDescription to the newDivForTitle but it isn't seem to work as it should! Could anybody help? https://codepen.io/dimitris51/pen/bMPjqd?editors=1010
Nazar
@IsaakNazar
Jun 04 2018 08:54
@Blauelf actually I want to get access token
from callback url
Blauelf
@Blauelf
Jun 04 2018 08:57
And the token is passed in an HTTP header?
Nazar
@IsaakNazar
Jun 04 2018 08:58
@Blauelf ever worked with bitbucket api? trying to get access token , and when it expires then to refresh it
Ankur sharma
@ankur1163
Jun 04 2018 09:21
anybody here connecting 2 or wide monitor with macbook air?
Blauelf
@Blauelf
Jun 04 2018 12:28

@IsaakNazar I haven't even worked with bitbucket. OK, we do have a git repository on bitbucket, but I use it via git only. I was actually surprised bitbucket supports git, as I thought of it as supporting mercurial only.

window.location sounds wrong in this context, you more likely would do XMLHttpRequests (or maybe fetch API? Haven't used that one), possibly abstracted away by some jQuery function.

sabahatullah
@sabahatullah
Jun 04 2018 14:47
Is that a valid selector $('.c_181_2_card:contains("Rogue"):not(:contains("Rogue Sport"))')
Jason Luboff
@JLuboff
Jun 04 2018 15:15
Morning
Blauelf
@Blauelf
Jun 04 2018 15:17
Afternoon/evening, I'd say :P
Christopher McCormack
@cmccormack
Jun 04 2018 15:21
:wave: gm
Diego Mayer
@Chrono79
Jun 04 2018 15:23
Good whatever time it is where you are :wave:
Christopher McCormack
@cmccormack
Jun 04 2018 15:23
haha not morning anymore there?
Diego Mayer
@Chrono79
Jun 04 2018 15:23
It's past midday here now
But I was trying a catch-all greeting ;)
Christopher McCormack
@cmccormack
Jun 04 2018 15:26
@Chrono79 I should just stop using time all together, it's not very useful in a global chat room I now see :D
Jason Luboff
@JLuboff
Jun 04 2018 15:28
@Blauelf Evening ;)
@cmccormack How was the mini-trip?
@Chrono79 Yo!
Christopher McCormack
@cmccormack
Jun 04 2018 15:29
@JLuboff was good, had some good food and explored downtown Seattle. Tried out the Amazon Go store (felt like stealing but in a good way), went to Pike's Place, walked around a lot
Jason Luboff
@JLuboff
Jun 04 2018 15:30
Amazon Go store...is that the one that you can just walk in and (Scan?) the product and walk out. No interaction with a salesperson/clerk?
Christopher McCormack
@cmccormack
Jun 04 2018 15:31
don't even have to do that! just scan your qr code when you walk in and that's it - walk out with whatever you grab and it automatically knows what you grabbed and how much to charge
Jason Luboff
@JLuboff
Jun 04 2018 15:31
Oh neat. That does sound like stealing haha
Diego Mayer
@Chrono79
Jun 04 2018 15:32
Has anyone an IPhone at hand?
Jason Luboff
@JLuboff
Jun 04 2018 15:32
@Chrono79 Yes
Diego Mayer
@Chrono79
Jun 04 2018 15:32
Could you check this site? http://meduladigital.com.ar/
There is an image below the slider that (I dunno why) doesn't appear at portrait (it does appear in android or at landscape in android and iOS)
Christopher McCormack
@cmccormack
Jun 04 2018 15:32
@JLuboff I did all the React stuff on FCC while waiting at the airport as well, was pretty good
Jason Luboff
@JLuboff
Jun 04 2018 15:33
@Chrono79 Is it three seperate images?
Christopher McCormack
@cmccormack
Jun 04 2018 15:34
They got rid of the Dungeon Crawler React project and replaced with a much easier drum machine project, which is awesome because the dungeon crawler was a lot of work
Diego Mayer
@Chrono79
Jun 04 2018 15:34
It's the background image below the menu bar
Jason Luboff
@JLuboff
Jun 04 2018 15:34
@cmccormack Cool, I started going through the curriculm but at the beginning. So HTML/CSS (only the portiuon I haven't done). Learned about CSS varibles which I knew existed but never knew how to use, so.. thats cool hah
Diego Mayer
@Chrono79
Jun 04 2018 15:34
with a text that says "Impulsamos..."
Jason Luboff
@JLuboff
Jun 04 2018 15:35
@Chrono79 It just has a bluish/green background in that section?
Diego Mayer
@Chrono79
Jun 04 2018 15:35
That's what I put now to make the text readable
try in landscape
the image appears
Jason Luboff
@JLuboff
Jun 04 2018 15:36
Ah, ya it does
Diego Mayer
@Chrono79
Jun 04 2018 15:36
a real mystery
Jason Luboff
@JLuboff
Jun 04 2018 15:37
@cmccormack Drum machine seems fun. I also like that they actually added test suite for the projects
Christopher McCormack
@cmccormack
Jun 04 2018 15:38
@JLuboff yeah and it actually works, although if you use the provided codepen it will have a duplicate import of the test script
Jason Luboff
@JLuboff
Jun 04 2018 15:39
@Chrono79 Very mysterious. It's like the programmer didn't know what he was doing! (This is of course a joke...you're a lot better at this stuff than I am)
Christopher McCormack
@cmccormack
Jun 04 2018 15:39
@JLuboff it was fun, although the sample project doesn't use the best practices for react
Jason Luboff
@JLuboff
Jun 04 2018 15:39
@cmccormack Psh. Forget boilerplates!
Diego Mayer
@Chrono79
Jun 04 2018 15:39
Lol, it's a Wordpress Theme so I didn't actually do much, but hard to debug
Jason Luboff
@JLuboff
Jun 04 2018 15:39
Did you already create your drum machine?
Christopher McCormack
@cmccormack
Jun 04 2018 15:39
It only took me a few hours that if that gives you a baseline
Jason Luboff
@JLuboff
Jun 04 2018 15:39
Ah
Christopher McCormack
@cmccormack
Jun 04 2018 15:39
yup got my new cert too!
Diego Mayer
@Chrono79
Jun 04 2018 15:42
Congratz!
Christopher McCormack
@cmccormack
Jun 04 2018 15:43
Thanks :) going to try and knock out the two new Data Viz this week as well
Did you guys dig into the new content yet?
Diego Mayer
@Chrono79
Jun 04 2018 15:43
Not yet
Christopher McCormack
@cmccormack
Jun 04 2018 15:44
Seems they've cleared up most of the bugs, still a bug when selecting cirriculum and it going white, requiring a reload, but that's the most I've seen recently
Jason Luboff
@JLuboff
Jun 04 2018 15:44
Going to be working my way through things. Got my Algorithm cert as well (didn't have to do anything new for it)
Christopher McCormack
@cmccormack
Jun 04 2018 15:47
oh didn't see that :)
Jason Luboff
@JLuboff
Jun 04 2018 15:48
Still need to go back and redo some of those algorithms, particularly the advanced ones. I have some uggglllyyy code
Christopher McCormack
@cmccormack
Jun 04 2018 15:49
They added a new api exercise tracker project, but it appears to have been a rush job, with some text taken from the nightlife app and inconsistent api calls
@JLuboff can you see your code? Show Solution does nothing for me
Jason Luboff
@JLuboff
Jun 04 2018 15:51
@cmccormack No.. but I have all my code saved in a OneNote notebook
Christopher McCormack
@cmccormack
Jun 04 2018 15:52
ah smart
Does OneNote do syntax highlighting?
Jason Luboff
@JLuboff
Jun 04 2018 15:52
No
Not sure if anyone makes add ons or anything for it
I just used it since it was an easy way to sync
Christopher McCormack
@cmccormack
Jun 04 2018 15:53
All good.
Diego Mayer
@Chrono79
Jun 04 2018 15:55
Mmmm, it seems I can get a cert without doing some project, maybe I'll get the Algorithms and Data Structures later
Christopher McCormack
@cmccormack
Jun 04 2018 15:56
@Chrono79 not even the Algorithms cert?
Diego Mayer
@Chrono79
Jun 04 2018 15:57
Nope, it seems a lot was added from last time I checked
FP OOP
Christopher McCormack
@cmccormack
Jun 04 2018 15:58
@Chrono79 you should just be able to claim it in Settings
those don't appear to count toward it
but I am excited to do those new exercises!
arowolodaniel
@arowolodaniel
Jun 04 2018 15:59
Are you a developer (no matter the language you write). would you like to meet other developers from different country, would you like to join our open source projects.
we can make the world a better place together with support of free and open projects to solve some challenging problems in the world.
Join the group on Messenger by visiting: https://m.me/join/AbbHTkhEpZOSn-es
Jason Luboff
@JLuboff
Jun 04 2018 16:02
@cmccormack So am I. I've always liked how FCC curriculm is designed
Diego Mayer
@Chrono79
Jun 04 2018 16:02
It seems none of my code was kept, maybe I'll have to copy/paste it all :(
Later :wave:
Christopher McCormack
@cmccormack
Jun 04 2018 16:02
@JLuboff The functional programming stuff may help with React later as well
@Chrono79 see ya
Jason Luboff
@JLuboff
Jun 04 2018 16:04
I'll probably go in order (although I'm trying one of the basic algorithms right now lol)_
Jason Luboff
@JLuboff
Jun 04 2018 16:11
Done...although ugly
Christopher McCormack
@cmccormack
Jun 04 2018 16:12
haha
Amit Patel
@AmitP88
Jun 04 2018 16:12
hey guys, I need a little advice. I have a coding test in August that will require me to build an email app using Angular and the companies API. However, I'm also doing FreeCodeCamp and I want to be able to earn all 6 certifications this year if possible (I've already solved most of the basic algorithms, a few of the intermediate algorithms, and 3/5 of the Front End Libraries Projects). I've signed up for an Angular 6 course on Udemy that I plan to complete next month (this month I'll be focusing on sharpening up my js and algo solving skills). My question is, once I complete the Udemy Angular 6 course, what projects should I build using Angular? should I rebuild the Front End Libraries Projects?
Jason Luboff
@JLuboff
Jun 04 2018 16:16
@AmitP88 Well if you know you
ll have to build an email app...I'd say practice doing that! :smile:
Christopher McCormack
@cmccormack
Jun 04 2018 16:16
@JLuboff
const frankenSplice = (arr1, arr2, n) => [
  ...arr2.slice(0, n), ...arr1, ...arr2.slice(n)
]
Jason Luboff
@JLuboff
Jun 04 2018 16:17
Yup... much nicer than mine haha
I just did a loop
Christopher McCormack
@cmccormack
Jun 04 2018 16:17
@AmitP88 I don't think you should wait on finishing the Angular course to proceed
Courses are great but you learn the most when you dive into a project
use the course to supplement your understanding
@JLuboff loops are blasphemous!
Jason Luboff
@JLuboff
Jun 04 2018 16:18
Even worse...its a backward loop!
function frankenSplice(arr1, arr2, n) {
let slice = arr1.slice(0);
let arr2Slice = arr2.slice(0);
  for(let i = arr1.length - 1; i >= 0; i--){
    arr2Slice.splice(n, 0, slice[i])
  }
  return arr2Slice;
}
:joy:
Amit Patel
@AmitP88
Jun 04 2018 16:19
@JLuboff for sure, I definitely plan on building the email app using Angular. Especially since I'll have to do it in 4 hours or less for the test lol
@cmccormack definitely, I plan on doing that. I was just most concerned on what projects I should build for the test (besides the email app). I want to be good at Angular (while getting better at JS) by August lol
Christopher McCormack
@cmccormack
Jun 04 2018 16:21
@AmitP88 best way to learn anything is to read the docs and start building something challenging, IMO
Amit Patel
@AmitP88
Jun 04 2018 16:22
@cmccormack I understand, but besides the email app, what else should I build? that's the part I'm kind of iffy on
arowolodaniel
@arowolodaniel
Jun 04 2018 16:23
@AmitP88 Try temporary email app
Christopher McCormack
@cmccormack
Jun 04 2018 16:23
@AmitP88 well, FCC has several frontend projects in React, try them in Angular!
Amit Patel
@AmitP88
Jun 04 2018 16:23
@arowolodaniel will do
Christopher McCormack
@cmccormack
Jun 04 2018 16:23
@AmitP88 who is giving you this test?
Amit Patel
@AmitP88
Jun 04 2018 16:24
@cmccormack what do you mean?
it's a company test
Christopher McCormack
@cmccormack
Jun 04 2018 16:24
@AmitP88 a company you work for?
Amit Patel
@AmitP88
Jun 04 2018 16:24
@cmccormack no
Christopher McCormack
@cmccormack
Jun 04 2018 16:25
@AmitP88 may want to ask them if there are any other projects you could create
Amit Patel
@AmitP88
Jun 04 2018 16:26
@cmccormack I had a slack interview last month, and basically the manager told me that I can take as much time as I need to prepare (she said typically 1-2 months or so) since I don't know Angular. I told her that I should be ready in August and that I'll let her know when I'm ready to test when the time comes
I've interviewed there before 2 years ago and didn't pass the test (I was barely learning web dev back then). the test back then was just building a webpage usign html css responsive design, but my html, css skills were lacking back then
@cmccormack I asked her if there were other options for the test and she said no
I work in a lab job which is seasonal (been working there for 2.5 years). The season ended at the end of last month and I'm on unemployment atm, but I've decided that I'm not going to go back to that job and just focus on learning web dev full time for the rest of this year
Ankur sharma
@ankur1163
Jun 04 2018 16:30
thats amazing
@AmitP88
You will do very well
Amit Patel
@AmitP88
Jun 04 2018 16:30
I hope so lol
It's a risk, but I figure if I dont do it now, then I never will
sabahatullah
@sabahatullah
Jun 04 2018 16:33
hey guys Is that a valid selector $('.c_181_2_card:contains("Rogue"):not(:contains("Rogue Sport"))')
Christopher McCormack
@cmccormack
Jun 04 2018 16:35
@sabahatullah looks alright, did you test it to see?
mstellaluna
@mstellaluna
Jun 04 2018 16:36
@AmitP88 you will do well Amit, you have come a long way from when you started.. I wish you luck !
Amit Patel
@AmitP88
Jun 04 2018 16:37
@mstellaluna thank you! :)
sabahatullah
@sabahatullah
Jun 04 2018 16:37
not yet/ still in development. ":not(:contains(" part was looking bit weird so thought to check with you guys
Brad
@bradtaniguchi
Jun 04 2018 17:10
whoa MS bought github?
Jason Luboff
@JLuboff
Jun 04 2018 17:11
@bradtaniguchi Did they?
Jason Luboff
@JLuboff
Jun 04 2018 17:14
Interesting. I wonder if they'll lower the cost for private repos :trollface:
Christopher McCormack
@cmccormack
Jun 04 2018 17:15
or if we all end up on Bitbucket
:D
who has free private repos
Jason Luboff
@JLuboff
Jun 04 2018 17:16
Yup... hence why I haven't had a repo or commit to github in months
Brad
@bradtaniguchi
Jun 04 2018 17:18
Ill give them the benefit of the doubt, VSCode is a delight after I got over my ego hehe
They do make good developer software
Christopher McCormack
@cmccormack
Jun 04 2018 17:18
It will probably be fine but at least we have alternatives
Brad
@bradtaniguchi
Jun 04 2018 17:21
Yea, bitbucket is OKey, and gitlab seems like a good alternative if they don't delete my code :P
Jason Luboff
@JLuboff
Jun 04 2018 17:22
I've been happy with bitbucket thus far
Nate Mallison
@NJM8
Jun 04 2018 17:28
hey guys, quick one, using mongoose, what would be the syntax to increment a value in an array at a specific index
my model has an array of numbers, I want to be able to increment a specific index
Jason Luboff
@JLuboff
Jun 04 2018 17:32
@NJM8 Use dot notation
{ $inc : {'arrayName.indexNumber': incrementByNum}}
{$inc: {'myArr.3': 2}
Nate Mallison
@NJM8
Jun 04 2018 17:35
db.Polls.findOneAndUpdate({ id: req.body.id }, 
        { $inc: { 'votes.req.body.location': 1 },
         $push: { voters: req.body.voter } }).then(
?
Jason Luboff
@JLuboff
Jun 04 2018 17:35
is req.body.location a number?
You would want to use a template string if so
Nate Mallison
@NJM8
Jun 04 2018 17:36
yes
Jason Luboff
@JLuboff
Jun 04 2018 17:36
{$inc: {${votes.req.body.location}: 1}
Nate Mallison
@NJM8
Jun 04 2018 17:36
ohh, the whole thing in a template, thats why it doesn't like it
Jason Luboff
@JLuboff
Jun 04 2018 17:37
errr... can't get the damn escape to work lol
Nate Mallison
@NJM8
Jun 04 2018 17:37
do you have to escape some chars?
Jason Luboff
@JLuboff
Jun 04 2018 17:38
for gitter, ya
I was trying to escape `
Nate Mallison
@NJM8
Jun 04 2018 17:38
oh right
    { $inc: { `${votes.req.body.location}`: 1 },
              ^^^
SyntaxError: Unexpected template string
Jason Luboff
@JLuboff
Jun 04 2018 17:39
I would define that in a variable outside your query then
Nate Mallison
@NJM8
Jun 04 2018 17:39
   const index = req.body.location;
    db.Polls.findOneAndUpdate({ id: req.body.id }, 
        { $inc: { 'votes.index': 1 },
         $push: { voters: req.body.voter } }).then(
Jason Luboff
@JLuboff
Jun 04 2018 17:40
const location = votes.req.body.location;
.... {$inc: {location : 1}}
(I'm a little rusty on mongo but I think that should be okay)
Nate Mallison
@NJM8
Jun 04 2018 17:40
ok I'll try it
Jason Luboff
@JLuboff
Jun 04 2018 17:40
'votes.index' is a string literal
so its looking for that exact string, index isn't being converted to a numeric value
Christopher McCormack
@cmccormack
Jun 04 2018 17:52
oops didn't read it right ignore :)
Jason Luboff
@JLuboff
Jun 04 2018 17:52
Already ignored!
Christopher McCormack
@cmccormack
Jun 04 2018 17:52
haha
I prefer the following format as it's so much easier to read:
db.Polls.findOneAndUpdate(
    {
        id: req.body.id
    }, 
    { 
        $inc: { 'votes.index': 1 },
        $push: { voters: req.body.voter }
    },
    { new: true } // Add this if you want the new doc in your callback
).then( //...
Jason Luboff
@JLuboff
Jun 04 2018 17:55
Well la-de-da Mr.fancy pants
Christopher McCormack
@cmccormack
Jun 04 2018 17:55
yeah man
Jason Luboff
@JLuboff
Jun 04 2018 17:55
Sweet.. think I finally found the error in my code
Christopher McCormack
@cmccormack
Jun 04 2018 17:55
@JLuboff was it a semicolon?
Jason Luboff
@JLuboff
Jun 04 2018 17:56
Nope!
Christopher McCormack
@cmccormack
Jun 04 2018 17:56
regular colon?
Small intestine?
Jason Luboff
@JLuboff
Jun 04 2018 17:56
So I originally had an action item that was split between two people that has since been changed to a single individual. My code was combining them and so it was erroring out an trying to read a property that didn't exist
Christopher McCormack
@cmccormack
Jun 04 2018 17:57
@JLuboff man refactoring is a bug magnet isn't it
@JLuboff maybe you need some testing
I started using mocha/chai in my latest, kind of confusing when you first start but might be useful
Jason Luboff
@JLuboff
Jun 04 2018 18:00
@cmccormack Oh I absolutely need testing..but.. I don't really understand how to implement it :(
Glad I'm working on a different branch though lol
Lol.. load time > 300 ms with three console.log messages... load time < 15 ms without them
Christopher McCormack
@cmccormack
Jun 04 2018 18:05
very nice - did you add a linter for console statements?
Jason Luboff
@JLuboff
Jun 04 2018 18:06
I have it disabled right now since I still have quite a few (in my catch blocks)
Christopher McCormack
@cmccormack
Jun 04 2018 18:19
you should be able to leave it on right? In mine I have it set to error for console.log but I can still run my app just fine if I have one. VS Code will show that file as red so I know I have a linting error in it and I can change/remove those statements when ready to deploy
Jason Luboff
@JLuboff
Jun 04 2018 18:25
Ya I was just annoyed at the warnings lol
Christopher McCormack
@cmccormack
Jun 04 2018 18:29
I think you can remove it from your pipeline and still have it be useful, I don't get any warnings
just highlighting in the file and in the VS Code output I believe (not terminal)
Jason Luboff
@JLuboff
Jun 04 2018 18:30
Ya I get warnings in my file (and it opens a debugger window at the bottom of Atom)
Brad
@bradtaniguchi
Jun 04 2018 18:35
Oh I have to say something about atom, I finally figured out how to get it to import imports XD
Gulsvi
@gulsvi
Jun 04 2018 18:36
Just in time for Atom to get axed by its new owner ;)
Nate Mallison
@NJM8
Jun 04 2018 18:37
anyone can tell why this doesn't work?
 db.Polls.findOne({ _id: req.body.id }).then(poll => {
      let voter = '';
      if (req.body.voter.length > 12) {
        const decoded = jwt.verify(req.body.voter, process.env.SECRET_KEY);
        voter = decoded.user_id;
      } else {
        voter = req.body.voter;
      }
      if (!poll.voters.includes(voter)) {
        poll.voters.push(voter);
        poll.votes[req.body.location] += 1;        
        poll.save();
        res.status(200).send('Vote Successful');
      } else {
        res.status(400).send('You cannot vote twice');
      }
the new vote is not being saved
poll.votes[req.body.location] += 1;
shows ok if I log the poll and the save operation shows in the console but the data is not changed
Mongoose: polls.updateOne({ _id: ObjectId("5b1569fd0b349f2a2815ee80") }, { '$set': { updatedAt: new Date("Mon, 04 Jun 2018 18:36:57 GMT") }, '$push': { voters: { '$each': [ '74799136' ] } }, '$inc': { __v: 1 } })
Christopher McCormack
@cmccormack
Jun 04 2018 18:45
@NJM8 it should be .then(err, poll)
Jason Luboff
@JLuboff
Jun 04 2018 18:45
Has to be dot notation, not bracket
if i remember correctly..
@cmccormack Speaking as someone who still gets troubled by Promises...shouldn't the err go in a catch bloick?
Christopher McCormack
@cmccormack
Jun 04 2018 18:49
Can be both but that's still the order of arguments to .then with mongoose I believe
Jason Luboff
@JLuboff
Jun 04 2018 18:49
Ah
Christopher McCormack
@cmccormack
Jun 04 2018 18:50
@JLuboff with a promise you're just resolving something and in this case I believe it's a callback that looks something like (error, document) => { ... }
Jason Luboff
@JLuboff
Jun 04 2018 18:51
Got it (sort of)
Nate Mallison
@NJM8
Jun 04 2018 18:51
nope
I try to save you the trouble of reading it every time but I guess I have to post it all
router
  .route('/addNewVote')
  .patch((req, res, next) => {
    db.Polls.findOne({ _id: req.body.id }).then(poll => {
      const voter = req.body.voter.length > 12 ? jwt.verify(req.body.voter, process.env.SECRET_KEY).user_id : req.body.voter;
      if (!poll.voters.includes(voter)) {
        poll.voters.push(voter);
        poll.votes[req.body.location] += 1;        
        poll.save();
        res.status(200).send('Vote Successful');
      } else {
        res.status(400).send('You cannot vote twice');
      }
    }).catch(error => {
      res.status(400).send('Vote Failed');
    })
  })
Christopher McCormack
@cmccormack
Jun 04 2018 18:53
@NJM8 nope to which part there bud?
Nate Mallison
@NJM8
Jun 04 2018 18:53
.then(err, poll)
If I log the poll before saving the data is modified
{ options: [ 'aa', 'aaa' ],
  votes: [ 1, 0 ],
  colors: [ 'rgba(255,127,80,0.5)', 'rgba(0,255,255,0.5)' ],
  voters: [ '5b0eee86ca43651ec14c8b0a' ],
  _id: 5b158aa49f3d682bf491768c,
  title: 'aa',
  description: 'aa',
  creator: 'nate',
  createdAt: 2018-06-04T18:53:24.253Z,
  updatedAt: 2018-06-04T18:53:24.253Z,
  __v: 0 }
votes is there, but not saving to db, but voters is saved
{
    "_id" : ObjectId("5b158aa49f3d682bf491768c"),
    "options" : [
        "aa",
        "aaa"
    ],
    "votes" : [
        0,
        0
    ],
    "colors" : [
        "rgba(255,127,80,0.5)",
        "rgba(0,255,255,0.5)"
    ],
    "voters" : [
        "5b0eee86ca43651ec14c8b0a"
    ],
    "title" : "aa",
    "description" : "aa",
    "creator" : "nate",
    "createdAt" : ISODate("2018-06-04T18:53:24.253Z"),
    "updatedAt" : ISODate("2018-06-04T18:53:28.238Z"),
    "__v" : 1
}
Christopher McCormack
@cmccormack
Jun 04 2018 18:56
my bad thought you were using mongoose but you're just using the driver
Nate Mallison
@NJM8
Jun 04 2018 18:57
maybe just a different way to use it? I am using mongoose, that part doesn't matter though, just trying to figure out why that new value isn't being saved in the votes array
Christopher McCormack
@cmccormack
Jun 04 2018 19:00
you're using Mongoose but you don't include the error argument and it's still providing the document you searched for? They need to clear up their docs then
it's good to know though
Pieter Stokkink
@forkerino
Jun 04 2018 19:01
@NJM8 maybe try using findOneAndUpdate?
I know I settled on that, but cannot really tell why it was necessary at the time.
Nate Mallison
@NJM8
Jun 04 2018 19:03
@cmccormack That is weird, that's how I learned it here: https://www.rithmschool.com/courses/node-express-fundamentals/mongoose-crud all my apps written that way and never had issues
Christopher McCormack
@cmccormack
Jun 04 2018 19:03
@forkerino me too, I never modify polls in place like that
Jason Luboff
@JLuboff
Jun 04 2018 19:03
I most likely used findOneAndUpdate too but with mongo, not mongoose
Christopher McCormack
@cmccormack
Jun 04 2018 19:04
@NJM8 it may be because you can use .catch for the error, but I find I need to use the (err, doc) method more often as you may still want to do something if no doc is found
Nate Mallison
@NJM8
Jun 04 2018 19:04
I tried findOneAndUpdate but had trouble indexing in the array
Pieter Stokkink
@forkerino
Jun 04 2018 19:04
@NJM8 that link has the most annoying modal popping up ever.
Christopher McCormack
@cmccormack
Jun 04 2018 19:04
@NJM8 try cloning the array and then assigning it to the object before saving
Nate Mallison
@NJM8
Jun 04 2018 19:05
I suppose I should write the db schema in a more explicit way, right now all the poll options and votes line up by index, probably not the best idea
but it's how graphs.js works so i didn't want to have to manipulate the data all over the place
@forkerino to sign up for their courses? I haven't seen it in a long time
Pieter Stokkink
@forkerino
Jun 04 2018 19:07
yeah, it pops up every time I scroll more than one screen and then keeps coming up on every keystroke/mousescroll
Nate Mallison
@NJM8
Jun 04 2018 19:08
smappy
lol
spammy
Pieter Stokkink
@forkerino
Jun 04 2018 19:09
very
makes me want to not sign up
Nate Mallison
@NJM8
Jun 04 2018 19:10
well their courses are really good.....
Pieter Stokkink
@forkerino
Jun 04 2018 19:11
Anyway, I used an array of objects like so: [{ answer: 'this is one thing to vote on', votes: 1 }]
Jason Luboff
@JLuboff
Jun 04 2018 19:11
Welp.... may have to change my authentication method for my app :worried: Used to work fine in any browser..but for some reason is only now working in FF and not in Chrome or Edge.. shit.
Christopher McCormack
@cmccormack
Jun 04 2018 19:12
@JLuboff is that because you only ever test in FF? :)
Jason Luboff
@JLuboff
Jun 04 2018 19:12
@cmccormack HarHar funny guy. But ya.. I get stuck testing most things in one browser, but I usually will at times go to other browsers to make sure behavior is expected
This behavior...is not
Christopher McCormack
@cmccormack
Jun 04 2018 19:13
@JLuboff my mom says I'm funny
Jason Luboff
@JLuboff
Jun 04 2018 19:13
She's lieing to you Chris.
Christopher McCormack
@cmccormack
Jun 04 2018 19:13
shoot
Pieter Stokkink
@forkerino
Jun 04 2018 19:14
@NJM8 when you have an array of objects defined in your schema, mongoose also adds an _id to them.
as far as I can see.
Nate Mallison
@NJM8
Jun 04 2018 19:14
@forkerino yes I was thinking to move to a design like that, just being stubborn
Pieter Stokkink
@forkerino
Jun 04 2018 19:14
:joy:
Ok, let me know if you find another way. :)
Nate Mallison
@NJM8
Jun 04 2018 19:15
plus i would have to change the structure on every call to get the poll data
Pieter Stokkink
@forkerino
Jun 04 2018 19:15
true
Nate Mallison
@NJM8
Jun 04 2018 19:15
because graph.js needs it the way I have it, and I'm also assuming mongo won't change the order of the items in the arrays
Pieter Stokkink
@forkerino
Jun 04 2018 19:16
@NJM8 nothing a simple .map can't fix, though?
Brad
@bradtaniguchi
Jun 04 2018 19:17
I spent a good 20 minutes debugging and found this code:
const myVariable = 'bob';
const obj = {
     myVariable: 20
};
console.log('wtf', obj[myVariable])// undefined
Pieter Stokkink
@forkerino
Jun 04 2018 19:17
@bradtaniguchi obj doesn't have a 'bob' prop
-> undefined
Brad
@bradtaniguchi
Jun 04 2018 19:17
yes..... it has myVariable property -___-
Jason Luboff
@JLuboff
Jun 04 2018 19:18
:joy:
Pieter Stokkink
@forkerino
Jun 04 2018 19:18
so do obj['myVariable']
ah, ok, you were just sharing.
Jason Luboff
@JLuboff
Jun 04 2018 19:18
I think he was overlooking that
Pieter Stokkink
@forkerino
Jun 04 2018 19:18
check
ugh, diving in my old code for that voting app is painful.
#progress
I'm gonna watch the latest season of Arrested Development
later
Christopher McCormack
@cmccormack
Jun 04 2018 19:22
@forkerino enjoy!
Pieter Stokkink
@forkerino
Jun 04 2018 19:24
Lucille: "I've never been less disappointed of her in my entire life." :joy:
Christopher McCormack
@cmccormack
Jun 04 2018 19:25
Haha
Nate Mallison
@NJM8
Jun 04 2018 19:26
@forkerino @cmccormack
        poll.voters.push(voter);
        const currentVote = poll.votes[req.body.location];
        poll.votes.set(req.body.location, currentVote + 1);
        poll.save();
        res.status(200).send('Vote Successful');
.set
:+1:
Pieter Stokkink
@forkerino
Jun 04 2018 19:26
:+1:
Nate Mallison
@NJM8
Jun 04 2018 19:27
I wish they hadn't changed the pages for the legacy certs
Christopher McCormack
@cmccormack
Jun 04 2018 19:27
is set a mongo array method?
Nate Mallison
@NJM8
Jun 04 2018 19:27
I'm not interested in the new cirriculum
first item, hahaha
helps to read the docs
Christopher McCormack
@cmccormack
Jun 04 2018 19:28
Or to use the update methods :)
Nate Mallison
@NJM8
Jun 04 2018 19:30
yeah I couldn't figure out how to get the index in there
Christopher McCormack
@cmccormack
Jun 04 2018 19:30
ah
you may also want to use findOneById, I think there is a bit of benefit to that
Nate Mallison
@NJM8
Jun 04 2018 19:30
it might be able to be done with $position
it wouldn't accept template string though
db.collection.update({...}, {$inc: {"answer.0.votes": 1}})
0 is the index but not sure how to get it in there
Christopher McCormack
@cmccormack
Jun 04 2018 19:33
@NJM8 "answer." + 0 + ".votes"?
odd it wouldn't accept a template string
why use a votes array?
Nate Mallison
@NJM8
Jun 04 2018 19:34
so I don't have to mutate the data for graphs.js
their data structure isn't great, rather than
Pieter Stokkink
@forkerino
Jun 04 2018 19:36
that's a very bad reason to make your own data structure not great too.
Nate Mallison
@NJM8
Jun 04 2018 19:38
polldata = {
  1: {
    color: red,
    qty: 4
  },
  2: {
    color: blue, 
    qty: 8
  }
}
they do
polldata = {
  colors: [red, blue],
  qty: [4, 8]
}
and match up the colors to the qty by index
@forkerino that's fair, I guess I don't need to worry about optimizing it, not like I'm going to have 1,000,000 polls on here
Pieter Stokkink
@forkerino
Jun 04 2018 19:39
true
Nate Mallison
@NJM8
Jun 04 2018 19:40
and a better structure would be good since this is really to showcase skills
Jason Luboff
@JLuboff
Jun 04 2018 19:40
Use a variable like i sugggested earlier to make your array dot notation name, I think that would work
Pieter Stokkink
@forkerino
Jun 04 2018 19:40
If you learn something by doing this project, that's probably good enough @NJM8
Nate Mallison
@NJM8
Jun 04 2018 19:40
@forkerino does VueJS count?
@JLuboff I got votes is undefined
Pieter Stokkink
@forkerino
Jun 04 2018 19:41
@NJM8 sure! I like Vue a lot
Nate Mallison
@NJM8
Jun 04 2018 19:43
@forkerino shouldn't have said that
now your inbox will be full of message for help
Pieter Stokkink
@forkerino
Jun 04 2018 19:43
Still a beginner as well
Nate Mallison
@NJM8
Jun 04 2018 19:43
😂😂😂
yeah but you have more experience than me so
@JLuboff something like this?
    db.Polls.findOneAndUpdate({ _id: req.body.id }, 
      { $inc: { 'votes.' + req.body.location : 1 }, $push: { voters: req.body.voter }})
Jason Luboff
@JLuboff
Jun 04 2018 19:46
@NJM8 you defined the entire variable outside the query, not just the req.body.location part?
I’m on mobile now so hard to see it all but I would have any concatenation outside the query and in the variable instead
Nate Mallison
@NJM8
Jun 04 2018 19:47
yes I had it above that.
thats ok, it's working now, I may try to optimize later
Brad
@bradtaniguchi
Jun 04 2018 19:47
This feels..... 'votes.' + req.body.locationidk...
Nate Mallison
@NJM8
Jun 04 2018 19:48
@forkerino I'm building the front end of the voting app as a spa with Vue
@bradtaniguchi also gives a syntax error
Jason Luboff
@JLuboff
Jun 04 2018 19:48
I’m on mobile now so hard to see it all but I would have any concatenation outside the query and in the variable instead
Nate Mallison
@NJM8
Jun 04 2018 19:49
    const index = 'votes.req.body.location';
    db.Polls.findOneAndUpdate({ _id: req.body.id }, 
      { $inc: { index : 1 }, $push: { voters: req.body.voter }})
Brad
@bradtaniguchi
Jun 04 2018 19:49

I don't think you can do this:

const obj = {
    getKey(): value
}

so this doesn't work either

const obj = {
    'blah' + other
}

I don't think you can execute an expression to get a key like that

I was doing a similar thing earlier hehe
Nate Mallison
@NJM8
Jun 04 2018 19:50
@JLuboff I actually have to do it the other way to verify if the user has voted already anyways
Christopher McCormack
@cmccormack
Jun 04 2018 19:50
@NJM8 "votes." + req.body.location right?
Nate Mallison
@NJM8
Jun 04 2018 19:51
unless I can stuff JWT functions inside the findOneAndUpdate haha
@cmccormack that gave a syntax error
Christopher McCormack
@cmccormack
Jun 04 2018 19:51
@NJM8 it shouldn't
not a syntax error
Nate Mallison
@NJM8
Jun 04 2018 19:51
I feel like I've done this before just can't remember where
Brad
@bradtaniguchi
Jun 04 2018 19:52
This should work:
const index = `votes.${req.body.location}`;
const inc = {}; // an empty object
inc[index] = index; // assign your variable
db.Polls.findOneAndUpdate(
  { _id: req.body.id },
  {
    $inc: inc, // place it into your query
    $push: { voters: req.body.voter }
  }
);
not clean tho :/
Nate Mallison
@NJM8
Jun 04 2018 19:53
Users/natemallison/Documents/Programming/FreeCodeCampBackEndProjects/votingApp/votingAppBackEnd/routes/VotingRouter.js:41
      { $inc: { 'votes.' + req.body.location : 1 }, $push: { voters: req.body.voter }}).then(poll => {
                         ^

SyntaxError: Unexpected token +
Pieter Stokkink
@forkerino
Jun 04 2018 19:53
@NJM8 try bracketing it with []
['votes.' + req.body.location]
that's a valid way to create a key
Christopher McCormack
@cmccormack
Jun 04 2018 19:53
@NJM8 sorry I meant for you to use that in your variable assignment not as an expression
Pieter Stokkink
@forkerino
Jun 04 2018 19:53
I believe
Brad
@bradtaniguchi
Jun 04 2018 19:53
you cant use an expression for a key
Nate Mallison
@NJM8
Jun 04 2018 19:54
@cmccormack oh ok
don't worry about it. I need to do validation on the voter before accepting the vote anyways
Pieter Stokkink
@forkerino
Jun 04 2018 19:55

@bradtaniguchi

let a = 1
let b = { ['votes.' + a]: 1 } 

b // {votes.1 : 1}

works fine here

Nate Mallison
@NJM8
Jun 04 2018 19:55
and @forkerino is forcing me to change my schema
lol
Pieter Stokkink
@forkerino
Jun 04 2018 19:55
hahaha
do it
Nate Mallison
@NJM8
Jun 04 2018 19:56
I will tomorrow, ankle biters are getting to me
Christopher McCormack
@cmccormack
Jun 04 2018 19:56
@NJM8 I entirely agree with him :)
Nate Mallison
@NJM8
Jun 04 2018 19:57
@forkerino Here is the Vue front end if you feel like poking around, https://github.com/NJM8/votingAppFrontEnd
Brad
@bradtaniguchi
Jun 04 2018 19:57
Whoa you can 80
Nate Mallison
@NJM8
Jun 04 2018 19:58
80?
Brad
@bradtaniguchi
Jun 04 2018 19:58
:open_mouth:
Learned something new with JS then
Jason Luboff
@JLuboff
Jun 04 2018 19:59
Damn mobile didn’t send my earlier response I had said: I’m on mobile now so hard to see it all but I would have any concatenation outside the query and in the variable instead
Or maybe it did send haha
Christopher McCormack
@cmccormack
Jun 04 2018 19:59
@JLuboff that did send :D
Nate Mallison
@NJM8
Jun 04 2018 19:59
@JLuboff actually it sent it twice
Pieter Stokkink
@forkerino
Jun 04 2018 20:03
@bradtaniguchi only works in >ES6, though
Brad
@bradtaniguchi
Jun 04 2018 20:03
damn didn't know about it tho
Christopher McCormack
@cmccormack
Jun 04 2018 20:03
what is 80?
Pieter Stokkink
@forkerino
Jun 04 2018 20:03
a typo
Brad
@bradtaniguchi
Jun 04 2018 20:05
its this face :open_mouth: , except sideways
cmon use your imagination :P
jusgoose
@gusd773
Jun 04 2018 20:07
anybody know why my styling won't apply to my header background?
<?php
?>
<!DOCTYPE html>
<html>
<head>
  <title></title>

<style>
.container{
  max-width: 1200px;
  margin: 0 auto;
}
.header{
  margin: 100px 0px;
  background: black;
  color: white;
}
</style>
</head>
<body>
  <div class="container">
<header>
  <nav>
    <a href="home.php">Home</a>
    <a href="about.php">About</a>
    <a href="projects.php">Projects</a>
    <a href="contact.php">Contact</a>
  </nav>
</header>
<section>
  <h1> Home </h1>

</section>
</container>


</body>
</html>
renders this
Brad
@bradtaniguchi
Jun 04 2018 20:07
your using .header when it should be header
jusgoose
@gusd773
Jun 04 2018 20:07
blob
Brad
@bradtaniguchi
Jun 04 2018 20:08
the dot means header is a class, without anything its the tag
jusgoose
@gusd773
Jun 04 2018 20:08
been a long day sorry peoples* thank you @bradtaniguchi
Brad
@bradtaniguchi
Jun 04 2018 20:09
np :D
Jason Luboff
@JLuboff
Jun 04 2018 20:28
Don't worry guys..no more double posting from this guy! :smile:
Christopher McCormack
@cmccormack
Jun 04 2018 20:29
@JLuboff I don't trust you
Jason Luboff
@JLuboff
Jun 04 2018 20:30
@cmccormack Fair. Buuuttt! I'm not on mobile anymore...so theres that
Christopher McCormack
@cmccormack
Jun 04 2018 20:33
hah
Jason Luboff
@JLuboff
Jun 04 2018 20:33
Guhh... so apparently my auth package does work...just messed up in my code somewhere lol. Frustrating that I had it working before and don't recall making any changes to it. I guess its time to deep dive
Christopher McCormack
@cmccormack
Jun 04 2018 20:38
@JLuboff is this for your work app?
Jason Luboff
@JLuboff
Jun 04 2018 20:39
@cmccormack Yup
I'm using a module to allow me to use AD as my authentication method (really just getting the username)
Christopher McCormack
@cmccormack
Jun 04 2018 20:39
instead of deep dive just look at your commit diffs!
Jason Luboff
@JLuboff
Jun 04 2018 20:39
I have a lot of commits...and not sure when it broke :worried:
Pieter Stokkink
@forkerino
Jun 04 2018 20:40
@JLuboff git blame!
Jason Luboff
@JLuboff
Jun 04 2018 20:41
I can only blame myself!
Pieter Stokkink
@forkerino
Jun 04 2018 20:41
yeah, but then you'll find the commit where the line changed.
or maybe it is just water under the bridge
Jason Luboff
@JLuboff
Jun 04 2018 20:44
Lemme try. Syntax of it seems slightly confusing but I think I need something like git blame -L <40, 60> <file>? Where <40, 60> is the lines I want to check?
Oh, I should be ommitting the < >
Ah! It's running
Mmmmhm... I'm wondering if it broke when I got eslint up and running..
Christopher McCormack
@cmccormack
Jun 04 2018 20:54
@JLuboff probably not, unless eslint "fixed" something it shouldn't have
Jason Luboff
@JLuboff
Jun 04 2018 20:55
@cmccormack It did have me move a require statement (looking at my prior code). Testing now
Christopher McCormack
@cmccormack
Jun 04 2018 20:55
@JLuboff oh! that may have been an editor issue
did you by chance start using vs code?
Atom may do it too, but it's been suggesting changing requires to import, which is not good for node
Jason Luboff
@JLuboff
Jun 04 2018 20:57
No, I'm using airbnb's style guide which expects requires to be global I guess. Still not working though.
Actually... I might have an idea of the problem... lets test and see
Christopher McCormack
@cmccormack
Jun 04 2018 20:59
@JLuboff what does it mean to have requires global? vs what?
Jason Luboff
@JLuboff
Jun 04 2018 21:01

@cmccormack Instead of have a require at the top of your file, you may have it inside your function. I.E here's my code

const authUser = (req, res, next) => {
  const nodeSSPI = require('node-sspi');
  const nodeSSPIObj = new nodeSSPI({
    perRequestAuth: true,
    domain: 'potato',
  });

  nodeSSPIObj.authenticate(req, res, (err) => {
    if (err) throw err;
    return res.finished || next();
  });
};

That suggest moving const nodeSSPI = require('node-sspi'); this out of that function

Christopher McCormack
@cmccormack
Jun 04 2018 21:01
turn that one off
Jason Luboff
@JLuboff
Jun 04 2018 21:01
My style still uses require instead of import
Christopher McCormack
@cmccormack
Jun 04 2018 21:01
that's silly it's a perfectly valid use of the function
Node only has expiramental support for import anyhow
Jason Luboff
@JLuboff
Jun 04 2018 21:02
I agree but that doesn't appear to be the problem anyhow. grr
Gulsvi
@gulsvi
Jun 04 2018 21:03
I'm guessing you list your requires at the top of the file to clearly list dependencies
Jason Luboff
@JLuboff
Jun 04 2018 21:03
Normally, yes
For this particular bit of code.. I had to turn it into middleware and I guess thought to put the require in there since thats how the example code is (that is used globally)
Brad
@bradtaniguchi
Jun 04 2018 21:12
yas, finally I have a single VSCode config for all my work stations, just my laptop is left :D
Christopher McCormack
@cmccormack
Jun 04 2018 21:19
@bradtaniguchi did you use a tool or just copy config over?
I def need to merge mine :)
Brad
@bradtaniguchi
Jun 04 2018 21:19
I got a new computer going, and I setup the settings sync extension
Brad
@bradtaniguchi
Jun 04 2018 21:27
I wanted to start from the ground up, since my current workstation has a bunch of garbage I don't think I need, and some of the extensions I think are messing me up.
So now I have a pretty minimal install compared to before, and the ability to sync it with my computers at home
Christopher McCormack
@cmccormack
Jun 04 2018 21:28
@bradtaniguchi any custom user setting you think everyone should try out that have helped you?
Brad
@bradtaniguchi
Jun 04 2018 21:29
hehe the only one that I think is really useful is formatting on save with prettier. Everything else was mostly typescript related haha
or at least opinionated
Christopher McCormack
@cmccormack
Jun 04 2018 21:29
heh I have a similar one "eslint.autoFixOnSave": true
this one is pretty nice as well "editor.rulers": [80, 120],
Gulsvi
@gulsvi
Jun 04 2018 21:30
"files.eol": "\n",
one of my favorites
and... "telemetry.enableTelemetry": false, :)
Christopher McCormack
@cmccormack
Jun 04 2018 21:32
not sure the files eol works, the bottom still shows crlf on windows
Gulsvi
@gulsvi
Jun 04 2018 21:33
Works for me, all LF endings
Wouldn't be one of my favorites if it didn't work :p
Christopher McCormack
@cmccormack
Jun 04 2018 21:33
What themes you using
Gulsvi
@gulsvi
Jun 04 2018 21:34
Just the default dark
Christopher McCormack
@cmccormack
Jun 04 2018 21:34
I'll see if I still get the git messages about line endings after enabling it
I've been using cobalt2 with Fira Code and ligatures enabled, it looks really good
Gulsvi
@gulsvi
Jun 04 2018 21:34
It won't convert existing files - only applies to new files I think
Christopher McCormack
@cmccormack
Jun 04 2018 21:35
ah that makes sense and it appears to be working in that sense
Gulsvi
@gulsvi
Jun 04 2018 21:36
I had to run a git tool - forget what it's called to convert all my files something like dos2unix I think
Brad
@bradtaniguchi
Jun 04 2018 21:38
I should add that aswell, I get git warnings for it on my windows machine all the time haha
Chase Sawyer
@shadowimmage
Jun 04 2018 21:39
you might be able to get git to automatically handle line endings by changing your git configuration: https://help.github.com/articles/dealing-with-line-endings/
Brad
@bradtaniguchi
Jun 04 2018 21:40
Id rather have git not handle it if possible, more of an editor thing
thanks tho :D
Jason Luboff
@JLuboff
Jun 04 2018 21:48
Guh. I hate programming sometimes haha.
Brad
@bradtaniguchi
Jun 04 2018 21:48
Thats my secret... I always hate it hehe
Christopher McCormack
@cmccormack
Jun 04 2018 21:48
@JLuboff never say that! it might hear you...
I usually only hate it when I'm troubleshooting an issue with webpack
Jason Luboff
@JLuboff
Jun 04 2018 21:49
I just don't understand why my auth is all of a sudden not working. I'm tracing the steps and its going as it should (hits route where it sees middleware for auth, goes to middleware, goes to auth module, goes back to route) but still just auth for FF and no other browser.
Christopher McCormack
@cmccormack
Jun 04 2018 21:59
it shouldn't even matter which browser if it's all on the backend, so maybe check how your browser is handling the response?
Jason Luboff
@JLuboff
Jun 04 2018 22:02

Huh.. doing a clean route with nothing

  app.route('/').get(authUser, (req, res) => {
    res.send(req.connection.user);
  });

Works...

but the moment I try and manipulate the user string... it says its undefined... so... async issue perhaps?
Christopher McCormack
@cmccormack
Jun 04 2018 22:06
@JLuboff maybe your authUser is running into an error and you don't have a proper err, done response for it?
not sure
I have to run for a bit though - good luck!
Jason Luboff
@JLuboff
Jun 04 2018 22:06
Thanks.. if I remove my substring and tolowercase methods...it works..
Jason Luboff
@JLuboff
Jun 04 2018 22:28
@conradkay Don't use global variables, FCC doesn't like them (or at least it used to not, I'd imagine thats still the case)
Conrad Kay
@conradkay
Jun 04 2018 22:28
ok
it worked!
Jason Luboff
@JLuboff
Jun 04 2018 22:29
:+1: