These are chat archives for FreeCodeCamp/HelpJavaScript

12th
Jun 2018
Travis A Mix
@travismix1980
Jun 12 2018 01:35 UTC
hello everyone finally re found the free code camp chatrooms
Dhaval Vira
@dhavalveera
Jun 12 2018 01:35 UTC
hello
Travis A Mix
@travismix1980
Jun 12 2018 01:38 UTC
hows things ?
Brad
@bradtaniguchi
Jun 12 2018 03:22 UTC
things are slow, very slow nowadays
JJ Megma
@megma_jj_twitter
Jun 12 2018 05:25 UTC
@shubhamsoni2617 wut?
IsmailHusseinCR
@IsmailHusseinCR
Jun 12 2018 11:01 UTC
Is it cool to ask some Typescript questions here as well ?
IsmailHusseinCR
@IsmailHusseinCR
Jun 12 2018 11:08 UTC
i am trying to make some shape game to draw random shapes and also trying learn OOP better
class Canvas {
    private canvas : HTMLCanvasElement = <HTMLCanvasElement> document.querySelector('canvas')
    public c : CanvasRenderingContext2D = <CanvasRenderingContext2D> this.canvas.getContext("2d");
    private circle : Circle
    private x : number;
    private y : number;
    private speedX : number
    private speedY : number

    constructor(){
      this.canvas.width = window.innerWidth;
      this.canvas.height = window.innerHeight;

      this.circle = new Circle(300,300,5,5)


       this.x = Math.random() * window.innerWidth;
       this.y = Math.random() * window.innerHeight;
       this.speedX = (Math.random() - 0.5 * 8);
       this.speedY = (Math.random() - 0.5 * 8);



    }
    public update() {
          this.c.clearRect(0,0,window.innerWidth,window.innerHeight)
          this.c.beginPath()
          this.c.arc(this.x,this.y,30,0, Math.PI * 2, false)
          this.c.strokeStyle = "blue"
          this.c.stroke()

          this.circle.draw()


          if (this.x + 30 > window.innerWidth || this.x - 30 < 0) {
              this.speedX = -this.speedX
          }

          if(this.y + 30 > window.innerHeight || this.y + 30 < 0 ){
              this.speedY = -this.speedY
          }

        this.x += this.speedX;
        this.y += this.speedY;
    }
}

class Circle {
   private canvas : Canvas 
    private x: number
    private y: number
    private speedX : number
    private speedY : number

    constructor(x : number, y: number, speedX : number,speedY: number) {
        this.canvas = new Canvas() // i get max stack call error here
        this.x = x;
        this.y = y;
        this.speedX = speedX
        this.speedY = speedY
    }

    /**
     * draw
     */
    public draw() {
         this.c.beginPath()
         this.c.arc(this.x,this.y,30,0, Math.PI * 2, false)
          this.c.strokeStyle = "blue"
          this.c.stroke()

        console.log("This doesnt work yet")
    }
}
but i get some max call stack error so i cannot use the c property of the canvas
Stephen James
@sjames1958gm
Jun 12 2018 11:20 UTC
@IsmailHusseinCR Your circle creates a canvas which creates a circle which creates a canvas.
If Circle is using Canvas then canvas shouldn't "know" about Circle
You have to decide if canvas owns a circle or vice versa
IsmailHusseinCR
@IsmailHusseinCR
Jun 12 2018 11:30 UTC
@sjames1958gm if i remove circle from my canvas class. I cannot use the circle.draw method in my canvas class. So i guess the canvas owns a circle
Stephen James
@sjames1958gm
Jun 12 2018 11:33 UTC
@IsmailHusseinCR If your circle needs a reference to the canvas perhaps you pass that into the constructor or as a parameter to draw?
circle.draw(c)
Blauelf
@Blauelf
Jun 12 2018 11:34 UTC
@IsmailHusseinCR So inside the Canvas constructor you create a new Circle, and in the Circle constructor you create a new Canvas? Sounds like infinite recursion, so max stack error is right.
IsmailHusseinCR
@IsmailHusseinCR
Jun 12 2018 11:38 UTC
@sjames1958gm hmm thats possible . But now the property c is private so i need some getter
@Blauelf Yes i see that now :( i did it because when i made a private canvas in circle i needed to define it . So i added this.canvas = new Canvas() in the constructor
Simon Cordova
@gbsimon87
Jun 12 2018 12:24 UTC
Hi guys, need some help.
I've got an input field which I'd only like the last number to be visible, and all the other ones to be a '*' - like a pin pad
Any ideas?
Keon Samuel
@keonsam
Jun 12 2018 12:54 UTC
Anyone uses aws?
Simon Cordova
@gbsimon87
Jun 12 2018 13:09 UTC
cheers @NJM8
Kelechi Chinaka
@ke1echi
Jun 12 2018 14:24 UTC
pic does not show on my tribute page project..pls help
Charlie Waite
@charliearlie
Jun 12 2018 14:29 UTC
Two things. You have spaces in your picture path in the src
Secondly, the picture isn't hosted anywhere.
Upload the image to imgur or another hosting service and paste the url into the src of <img id="image" src="images/Chinua-Achebe and book.jpg" alt="Achebe's pic">
@kelechy
Kelechi Chinaka
@ke1echi
Jun 12 2018 14:32 UTC
thanks @charliearlie
Jason Luboff
@JLuboff
Jun 12 2018 15:07 UTC
Morning
Kelechi Chinaka
@ke1echi
Jun 12 2018 15:08 UTC
:wave: guys
checkout my tribute page and tell me what you think...feedback expected
Christopher McCormack
@cmccormack
Jun 12 2018 15:09 UTC
@JLuboff heya!
@kelechy looks pretty good - you may want to adjust spacing a bit so things aren't so crowded, maybe add some padding to the body. Also an image caption is usually within the same container as the image itself so it doesn't exceed the width of the image
Jason Luboff
@JLuboff
Jun 12 2018 15:12 UTC
@cmccormack What up
Christopher McCormack
@cmccormack
Jun 12 2018 15:14 UTC
I think I'm about done with my nightlife app can you check it out? Anyone else here is also encouraged to try it out if you don't mind logging in with Twitter Oauth. I'm using Miami as a test search.
Kelechi Chinaka
@ke1echi
Jun 12 2018 15:14 UTC
thanks for the feedback @cmccormack
Jason Luboff
@JLuboff
Jun 12 2018 15:24 UTC
@cmccormack I'll check it out in just a bit, working on some things :+1:
Christopher McCormack
@cmccormack
Jun 12 2018 15:24 UTC
@JLuboff thanks
Jason Luboff
@JLuboff
Jun 12 2018 15:33 UTC
@cmccormack Feedback time!
Really like the design and feel. Love that you can click on '# People Going' and see whos going. Thats really cool.
Only a few issues I could spot which have to do with authentication
  1. The little user icon switches to my name but... sort of a zoomed in view so can't see it properly. I would perhaps try to use the twitter icon instead?
  2. You need to fix your twitter redirect. It's redirecting to http instead of https which means the location finder will never work as the user won't be prompted to allow it
Christopher McCormack
@cmccormack
Jun 12 2018 15:39 UTC
@JLuboff you mean the callback url?
ah yes I see what you mean
that's weird because the callback url I used was https
@JLuboff I think for #1 that may be because you have tracking protection enabled in FF?
Nate Mallison
@NJM8
Jun 12 2018 15:43 UTC
@cmccormack Looks good! I haven't tried logging in yet, I would suggest a default picture for bars if there is nothing in the yelp profile. If you want to be fancy you could do a custom google search to pull it from google images or maps. Also I went to log in, hit cancel on twitters end, they provide a return to nightlife-mackville button, which showed a blank page that says "Failed to Log in via Twitter"
Christopher McCormack
@cmccormack
Jun 12 2018 15:43 UTC
But yeah I should see if the image doesn't load and add a placeholder
@NJM8 ah good catch, I did have a default picture but a refactor yesterday seems to have broken that
Jason Luboff
@JLuboff
Jun 12 2018 15:43 UTC
@cmccormack Thats possible, I've never gone into FF and changed that setting
Christopher McCormack
@cmccormack
Jun 12 2018 15:43 UTC
@NJM8 oh I forgot to fix the failed login as well! haha that was a test redirect
great catches thank you
Nate Mallison
@NJM8
Jun 12 2018 15:45 UTC
sure thing
Kelechi Chinaka
@ke1echi
Jun 12 2018 15:46 UTC
how do i test my project to know if it meets fcc's user stories?
Nate Mallison
@NJM8
Jun 12 2018 15:46 UTC
Ui looks solid, might want to adjust your page size, though, it has the bootstrap slide as I like to call it
just a bit of horizontal scroll
Christopher McCormack
@cmccormack
Jun 12 2018 15:47 UTC
@NJM8 yeah it's something with Material UIs breakpoints, I"m not sure exactly why it's happening but I'll work on a fix. If it was just CSS it would be easy
Nate Mallison
@NJM8
Jun 12 2018 15:47 UTC
@kelechy Some of the new projects have an automatic testing feature you can add, or just post here or in other forums for feedback
@cmccormack I've had it show up on a lot of my bootstrap projects if some div gets too wide for some reason, if you can't pinpoint it I just add overflow hidden
are you using grid?
Christopher McCormack
@cmccormack
Jun 12 2018 15:50 UTC
@NJM8 I hope it's that easy - I'm using JSS with Material UI
it's built in, you just use a withStyles HoC and pass an object with your css in it
but it can make troubleshooting a few things more difficult that's for sure
Nate Mallison
@NJM8
Jun 12 2018 15:51 UTC
mui-org/material-ui#7466
maybe this?
the horizontal scroll I'm getting is just showing whitespace, so overflow like he mentions might be easiest
Christopher McCormack
@cmccormack
Jun 12 2018 15:53 UTC
yeah its due to padding on some of my components which I believe it's getting from [theme.breakpoints.up("lg")] but I'll have to play with it. overflow may be the easiest :)
Nate Mallison
@NJM8
Jun 12 2018 15:54 UTC
I should email them, need a dev?
Christopher McCormack
@cmccormack
Jun 12 2018 15:55 UTC
who the material guys?
I wasn't big on material UI at first but once I got the hang of it, it's been pretty great. being able to specify your primary and secondary colors then letting the library handle the rest is pretty great
Nate Mallison
@NJM8
Jun 12 2018 16:01 UTC
no the business with the sub-par website
Christopher McCormack
@cmccormack
Jun 12 2018 16:02 UTC
@NJM8 I wish you hadn't mentioned the image generation, now I"ll be thinking about doing it haha
Nate Mallison
@NJM8
Jun 12 2018 16:02 UTC
:smile:
Christopher McCormack
@cmccormack
Jun 12 2018 16:02 UTC
I always tell myself I'm going to try and knock these out quickly but then I find myself wanting to throw everything at it near the end
Nate Mallison
@NJM8
Jun 12 2018 16:02 UTC
if you haven't built a custom search engine for google it's a pain, probably there is an easier way
I wonder if the google maps api would let you pull the business image, they usually have something
yup. Voting app took me three weeks. I was like, ah I can do that in a few days
Christopher McCormack
@cmccormack
Jun 12 2018 16:04 UTC
took me like 6 months!
But I spent far less time on it than most other projects, each day at least
Nate Mallison
@NJM8
Jun 12 2018 16:06 UTC
yeah you have a job
Jason Luboff
@JLuboff
Jun 12 2018 16:06 UTC
I think voting app took me 2-3 weeks (in reality longer as I took some time between the API's to it), the next two projects took about 2 weeks, then the last two took 1-1.5 months I think
Christopher McCormack
@cmccormack
Jun 12 2018 16:07 UTC
I think using React made it take a lot longer as I didn't fully understand how to make everything work together for a long time
Christopher McCormack
@cmccormack
Jun 12 2018 16:08 UTC
@NJM8 maybe the user will be smart enough to click the map url and go find images themselves :D
Nate Mallison
@NJM8
Jun 12 2018 16:10 UTC
that's a lot to ask in this climate
hahahaaa
Christopher McCormack
@cmccormack
Jun 12 2018 16:12 UTC
haha well too bad for them I'm not adding another api call, slow enough as it is :D
Jason Luboff
@JLuboff
Jun 12 2018 16:16 UTC
Lazy
Christopher McCormack
@cmccormack
Jun 12 2018 16:16 UTC
maybe
Jason Luboff
@JLuboff
Jun 12 2018 16:17 UTC
Nah...I don't blame you
Simon Cordova
@gbsimon87
Jun 12 2018 16:32 UTC
Hey all! Long time :)
Christopher McCormack
@cmccormack
Jun 12 2018 16:33 UTC
Hi!
Jason Luboff
@JLuboff
Jun 12 2018 16:44 UTC
@gbsimon87 Hey hows it going
Simon Cordova
@gbsimon87
Jun 12 2018 16:46 UTC
@JLuboff
I'm good man, looking for a job with a sponsorship now before my time in the UK is up haha
how's it going with you?
Christopher McCormack
@cmccormack
Jun 12 2018 16:52 UTC
@gbsimon87 you're in the UK now working?
Jason Luboff
@JLuboff
Jun 12 2018 17:01 UTC
@gbsimon87 Not bad, staying busy at work myself. Getting close to completing my first Node production app. I figured you were from the UK, i'm guessing thats not the case?
Simon Cordova
@gbsimon87
Jun 12 2018 17:05 UTC

@cmccormack I've been here for 2.5 years but my work permit just recently expired so need a sponsorship if I am to stay back

@JLuboff Good stuff man, I've been so concentrated on React have barely touched Node.
And no, I'm actually from Toronto, Canada.

Kaz Baig
@kbaig
Jun 12 2018 17:10 UTC
@gbsimon87 what visa were you on before?
Jason Luboff
@JLuboff
Jun 12 2018 17:11 UTC
@gbsimon87 React is still on my plate...but been focusing on the project/ MS SQL for work so.. its been on the back burner for a while.. lol
@kbaig The type that you can't buy anything with
Kaz Baig
@kbaig
Jun 12 2018 17:12 UTC
@JLuboff ugh thanks dad
Jason Luboff
@JLuboff
Jun 12 2018 17:12 UTC
:smile:
My dad joke game is getting stronger
Simon Cordova
@gbsimon87
Jun 12 2018 17:17 UTC
@kbaig youth mobility visa, it's available for commonwealth citizens 30 and under
Im going to be 31 this month :(
Kaz Baig
@kbaig
Jun 12 2018 17:19 UTC
@NJM8 took me a while to get the second one :/
@gbsimon87 Damn Pakistan doesn't count as part of the commonwealth :/
I'll be going on a tier 2 visa next month
Simon Cordova
@gbsimon87
Jun 12 2018 17:20 UTC
Actually, Pakistan is Commonwealth indeed
Kaz Baig
@kbaig
Jun 12 2018 17:20 UTC
It's not on the eligibility list for that visa
Simon Cordova
@gbsimon87
Jun 12 2018 17:20 UTC
Oh damn, shucks
Kaz Baig
@kbaig
Jun 12 2018 17:21 UTC
Tier 2 prob the better way to go anyways
Simon Cordova
@gbsimon87
Jun 12 2018 17:21 UTC
I'm looking for tier 2 atm, almost there actually, have had two strong interviews with a company that has sponsored people from many places
tier 2, mmmm, you're stuck to that company, with the youth mobility visa I could work for whomever
Kaz Baig
@kbaig
Jun 12 2018 17:22 UTC
@gbsimon87 I don't plan on being with my company for more than another year anyways so I'm good
Simon Cordova
@gbsimon87
Jun 12 2018 17:25 UTC
Fair enough.
If it's in the UK and they need a front-end dev, you know who to contact! lol
Kaz Baig
@kbaig
Jun 12 2018 17:25 UTC
Too bad it's a sales-only office :(
Christopher McCormack
@cmccormack
Jun 12 2018 17:25 UTC
@gbsimon87 @NJM8 think I figured out the spacing issue - https://material-ui.com/layout/grid/#negative-margin good to know if you ever use this very nice library
Simon Cordova
@gbsimon87
Jun 12 2018 17:28 UTC
@cmccormack good stuff man.
Grid is great but one caveat...
image.png
Christopher McCormack
@cmccormack
Jun 12 2018 17:28 UTC
@gbsimon87 it's material ui grid using flexbox
hopefully better supported
I love flexbox the more I use it
Kaz Baig
@kbaig
Jun 12 2018 17:29 UTC
@gbsimon87 the bigger thing for me is that subgrids aren't a thing yet
Hopefully soon
Simon Cordova
@gbsimon87
Jun 12 2018 17:29 UTC
Oh sorry buds just seen the grid part...
Flexbox is amazing, I prefer grid though as you can have items in a div go both directions
Christopher McCormack
@cmccormack
Jun 12 2018 17:29 UTC
@gbsimon87 what do you mean both directions?
Simon Cordova
@gbsimon87
Jun 12 2018 17:29 UTC
But Flexbox is just fine too tbh, and it's supported by ReactJS and Native so no drama here
Christopher McCormack
@cmccormack
Jun 12 2018 17:31 UTC
@gbsimon87 hah I'm not going to read all that to try to figure out what you meant :p
Simon Cordova
@gbsimon87
Jun 12 2018 17:31 UTC
It's really a tiny thing as you can emulate the behaviour with flexbox by adding a nested div and changing the flex-direction
Christopher McCormack
@cmccormack
Jun 12 2018 17:31 UTC
@gbsimon87 that's basically all I do
Simon Cordova
@gbsimon87
Jun 12 2018 17:31 UTC
Just this part really...
'The basic difference between CSS Grid Layout and CSS Flexbox Layout is that flexbox was designed for layout in one dimension - either a row or a column. Grid was designed for two-dimensional layout - rows, and columns at the same time. The two specifications share some common features, however, and if you have already learned how to use flexbox, the similarities should help you get to grips with Grid.'
Christopher McCormack
@cmccormack
Jun 12 2018 17:31 UTC
my buttons group changes three times depending on the viewport
i'll have to go back and do the grid froggy again soon, can't remember all the syntax as it's a bit more confusing than flexbox
Simon Cordova
@gbsimon87
Jun 12 2018 17:32 UTC
It is indeed, tbh I like it but I just use flexbox in practice
I don't have a need for Grid neither at work nor personal projects, at least not until it receives more browser support
People still using IE :worried:
Christopher McCormack
@cmccormack
Jun 12 2018 17:33 UTC
@gbsimon87 yeah that's the key, especially if both can do very similar things
Kaz Baig
@kbaig
Jun 12 2018 17:36 UTC
@cmccormack the quickest way to explain the value of grid is exactly that you shouldn't have to create child divs that are different direction flexboxes
That's how Rachel Andrew has explained it for a long time now
Simon Cordova
@gbsimon87
Jun 12 2018 17:38 UTC
I think CSS tricks has a great article on it, I'll search for it
Kaz Baig
@kbaig
Jun 12 2018 17:40 UTC
Love me some css-tricks complete guides
the flexbox one is the only thing i needed to learn flexbox
Christopher McCormack
@cmccormack
Jun 12 2018 17:41 UTC
it's actually a little over my head how you could build something like my search result component using grid if you needed different subcomponents to flow a different way
@kbaig yeah I refer back to it pretty often
Simon Cordova
@gbsimon87
Jun 12 2018 17:41 UTC
@kbaig It's my go to for every flexbox reminder I need
Kaz Baig
@kbaig
Jun 12 2018 17:42 UTC
:)
Christopher McCormack
@cmccormack
Jun 12 2018 17:50 UTC
@gbsimon87 @NJM8 can you check the overflow issue once more when you get a chance? button flow and overflow should be fixed but hoping for another pair of eyes to verify
@JLuboff did you host your nightlife app on heroku or glitch?
Simon Cordova
@gbsimon87
Jun 12 2018 17:52 UTC
@JLuboff He's got it on heroku
@cmccormack will check it for ya
Simon Cordova
@gbsimon87
Jun 12 2018 18:00 UTC

@cmccormack
When you switch from portrait to landscape, there is a lag in the re rendering and at times you see a long white space on the right, but then it fixes itself. This happens on both Chrome 67 and Samsung Galaxy S7.
I've got a feeling this may be a rendering issue and not to do with your code though.

The 'x going div' and 'I want to go' are displaying properly though on all sizes :)

Another quick suggestion...
If the user isn't signed in, you get the feeling that nobody is going anywhere.
Perhaps set a condition that if the user isn't signed in, the 'x people going' says 'sign in to see who's going'
This way it doesn't give the impression that nobody wants to go to any of these places.
Hope that makes sense
Christopher McCormack
@cmccormack
Jun 12 2018 18:05 UTC
@gbsimon87 not sure I understand the last part - it should still show people going even if not signed in
Is it just the colors?
Simon Cordova
@gbsimon87
Jun 12 2018 18:08 UTC
Hmmmm...
Jason Luboff
@JLuboff
Jun 12 2018 18:08 UTC
@cmccormack Actually I have nightlife on glitch...but...uh...seems that my project has been cleared...
Christopher McCormack
@cmccormack
Jun 12 2018 18:08 UTC
@JLuboff oh no!
Simon Cordova
@gbsimon87
Jun 12 2018 18:08 UTC
@cmccormack
I just signed in to Twitter and clicked 'I want to go'
I signed back out, searched for the same place again, and it shows 0 going
signed in with Twitter**
I've now signed back in and it shows 0 still
Christopher McCormack
@cmccormack
Jun 12 2018 18:09 UTC
@gbsimon87 that's weird I'm not seeing that behavior
Simon Cordova
@gbsimon87
Jun 12 2018 18:09 UTC
Sorry buds, QA is a pain lol
Let me try incognito
Christopher McCormack
@cmccormack
Jun 12 2018 18:10 UTC
Make sure it actually updates - the I want to go button has some delay as it has to hit the backend and the database so it's a little slow
Simon Cordova
@gbsimon87
Jun 12 2018 18:11 UTC
Cool
Worked! :)
Christopher McCormack
@cmccormack
Jun 12 2018 18:12 UTC
the delay sucks, I may need to find a way to optimize that a little but I didn't want to cheat and update it immediatly until I knew the backend/database calls were all successful
Simon Cordova
@gbsimon87
Jun 12 2018 18:12 UTC
Yep, tried both, did work
Christopher McCormack
@cmccormack
Jun 12 2018 18:12 UTC
@gbsimon87 that's great thank you for confirming!
Simon Cordova
@gbsimon87
Jun 12 2018 18:12 UTC
What are you using for backend anyway?
Christopher McCormack
@cmccormack
Jun 12 2018 18:13 UTC
node/express
passport-twitter for auth
Jason Luboff
@JLuboff
Jun 12 2018 18:14 UTC
Grrr...trying to get nightlife app back up and I forget what my enivornment variables were hah
Christopher McCormack
@cmccormack
Jun 12 2018 18:15 UTC
@JLuboff haha hope you have them locally!
@JLuboff how did you force it to redirect to https? did you do it in node or twitter?
Jason Luboff
@JLuboff
Jun 12 2018 18:16 UTC
...Good question. Most likely in twitter but cant recall
Simon Cordova
@gbsimon87
Jun 12 2018 18:16 UTC
damn, I'm so far behind.
I've resorted to firebase to save some time but even that is a monster itself
Christopher McCormack
@cmccormack
Jun 12 2018 18:16 UTC
@gbsimon87 behind on what?
Simon Cordova
@gbsimon87
Jun 12 2018 18:16 UTC
the full stack premise
Been doing some Node and Mongo beginner tuts but React apps take a lot of my time.
At least Im finally on the advanced aspects of it
Christopher McCormack
@cmccormack
Jun 12 2018 18:18 UTC
@JLuboff I think maybe you pass the entire url in your callbackurl from your env variable but I can't see it to verify
that may be my problem - I'm passing a relative path
Brad
@bradtaniguchi
Jun 12 2018 18:19 UTC
behind WHO, or your own goal?
Jason Luboff
@JLuboff
Jun 12 2018 18:20 UTC
@cmccormack Let me check my pinterest app since I use twitter for that
Christopher McCormack
@cmccormack
Jun 12 2018 18:20 UTC
@gbsimon87 don't think you'll ever catch up, you'll just move on haha
Nate Mallison
@NJM8
Jun 12 2018 18:20 UTC
@cmccormack Looks good to me
Christopher McCormack
@cmccormack
Jun 12 2018 18:21 UTC
@NJM8 thanks man
what happened to cbot he die?
Nate Mallison
@NJM8
Jun 12 2018 18:21 UTC
also see you fixed the vertical scroll when not needed. :+1:
Christopher McCormack
@cmccormack
Jun 12 2018 18:21 UTC
@NJM8 I did?
great!
Nate Mallison
@NJM8
Jun 12 2018 18:21 UTC
haha
Christopher McCormack
@cmccormack
Jun 12 2018 18:22 UTC
that may be related to the horizontal scroll as it was an issue with spacing in all directions
Nate Mallison
@NJM8
Jun 12 2018 18:22 UTC
yup
Brad
@bradtaniguchi
Jun 12 2018 18:22 UTC
@bradtaniguchi thanks, cbot giveme monies
Is it bad if my test-case file is 1k+ lines
Christopher McCormack
@cmccormack
Jun 12 2018 18:25 UTC
@bradtaniguchi nope my understanding is that Google, for their CI/CD testing pipeline, has millions of lines of test code
Brad
@bradtaniguchi
Jun 12 2018 18:26 UTC
In 1 freaken file :cry: how do you even open that thing?
Christopher McCormack
@cmccormack
Jun 12 2018 18:26 UTC
doubt it's one file haha
but I think it's public in their monorepo
don't know where they host it though :)
Brad
@bradtaniguchi
Jun 12 2018 18:27 UTC
polly github, I've walked into the Angular repo, which is a monorepo, and got scared and ran out haha
I can only image the google-core repo tho...
Christopher McCormack
@cmccormack
Jun 12 2018 18:28 UTC
right?
but it's pretty awesome that they can pretty much deploy anytime because they have so much testing in place
Brad
@bradtaniguchi
Jun 12 2018 18:29 UTC
Thats like my dream XD
Simon Cordova
@gbsimon87
Jun 12 2018 18:31 UTC
@cmccormack
Very true, no catch ups needed, everyones got their own progress rate
Jason Luboff
@JLuboff
Jun 12 2018 18:33 UTC
@cmccormack I just checked my .env, heres what I have: CALLBACKURL=https://jlpinterest.glitch.me/auth/twitter/callback
Christopher McCormack
@cmccormack
Jun 12 2018 18:34 UTC
@JLuboff dude we have the same callback path! :)
Jason Luboff
@JLuboff
Jun 12 2018 18:34 UTC
;)
Christopher McCormack
@cmccormack
Jun 12 2018 18:35 UTC
Thanks man that was very helpful
Jason Luboff
@JLuboff
Jun 12 2018 18:36 UTC
No problem
ugh. Can't get my damn nightlife app to connect to mlab
Oh! Got it finally
Brad
@bradtaniguchi
Jun 12 2018 18:38 UTC
How does glitch hosting work anyhow? Is it like a full-hosting environment or something like codepen?
Jason Luboff
@JLuboff
Jun 12 2018 18:38 UTC
@bradtaniguchi Its like heroku
but...has an editor
Christopher McCormack
@cmccormack
Jun 12 2018 18:39 UTC
yeah like glitch it uses your start script in your package.json to determine what to do
Brad
@bradtaniguchi
Jun 12 2018 18:39 UTC
Uh, is the editor perk worth it? I was testing out deploying an app my friend wanted to make, and I re-did the backend recently. I never decided where we were going to deploy it tho, I was going with heroku cuse its free
Christopher McCormack
@cmccormack
Jun 12 2018 18:39 UTC
yeah it can be worth it for testing
Simon Cordova
@gbsimon87
Jun 12 2018 18:40 UTC
Guys the lady's home, in other words my time's up lol - Good luck to all!
Kaz Baig
@kbaig
Jun 12 2018 18:40 UTC
:)
Jason Luboff
@JLuboff
Jun 12 2018 18:40 UTC
See ya
Christopher McCormack
@cmccormack
Jun 12 2018 18:40 UTC
@gbsimon87 see ya and thanks for your help!
@bradtaniguchi heroku will update as soon as you push to github but glitch requires you pull it down when you want to update it
I have my nightlife app on both currently
Jason Luboff
@JLuboff
Jun 12 2018 18:41 UTC
@bradtaniguchi I found that sometimes an app would deploy on Glitch that wouldn't on heroku or visa-versa. I do like the editor to be able to do a quick edit/debug versus heroku that I ahve to redeploy to. The nice think with heroku is it will listen for github updates though where as glitch requires you to manually do so
Christopher McCormack
@cmccormack
Jun 12 2018 18:41 UTC
.env file on heroku is done via settings which can be a little confusing at first
Jason Luboff
@JLuboff
Jun 12 2018 18:41 UTC
@cmccormack or can be set via the CLI
but... I never liked the CLI
Christopher McCormack
@cmccormack
Jun 12 2018 18:43 UTC
yeah I dont' want to have to learn the cli for every platform so I avoid it if I can
@JLuboff I believe I fixed the https issue
Jason Luboff
@JLuboff
Jun 12 2018 18:43 UTC
Agreed
Christopher McCormack
@cmccormack
Jun 12 2018 18:44 UTC
@JLuboff were you able to get your twitter avatar to show up? If in firefox you may have to click the little shield to the left of the url and disable protection for that site
Jason Luboff
@JLuboff
Jun 12 2018 18:45 UTC
Ya, if I disable it, it works
Christopher McCormack
@cmccormack
Jun 12 2018 18:46 UTC
Thanks for all the help I think I"m going to submit and move on
Jason Luboff
@JLuboff
Jun 12 2018 18:47 UTC
:+1:
Good work
Christopher McCormack
@cmccormack
Jun 12 2018 18:48 UTC
Thanks :)
Brad
@bradtaniguchi
Jun 12 2018 18:49 UTC
Our setup doesn't seem that complicated, and I noticed heroku has a lot of integrations it seems likes. Might hook it up with some CI if its free so I can do all that nice CI
Christopher McCormack
@cmccormack
Jun 12 2018 18:50 UTC
@bradtaniguchi let us know how it goes
Brad
@bradtaniguchi
Jun 12 2018 18:54 UTC
I will :D
Brad
@bradtaniguchi
Jun 12 2018 19:04 UTC
grrr, my test cases are failing... I don't know how >.>
Jason Luboff
@JLuboff
Jun 12 2018 19:05 UTC
I'd say there's somethings wrong
Christopher McCormack
@cmccormack
Jun 12 2018 19:08 UTC
test file for your test cases
Brad
@bradtaniguchi
Jun 12 2018 19:40 UTC
The thing I was testing was wrong, I copy pasted my "negated" code without negating it, thus everything was failing haha
Jason Luboff
@JLuboff
Jun 12 2018 20:27 UTC
@bradtaniguchi See, told you somethings wrong
Brad
@bradtaniguchi
Jun 12 2018 20:30 UTC
@JLuboff Damn your right, amazing intuition
Jason Luboff
@JLuboff
Jun 12 2018 20:31 UTC
:smile:
Mel Macaluso
@MelMacaluso
Jun 12 2018 21:30 UTC
Hello guys, anyone confident with Express Node server on a remote server?
Jason Luboff
@JLuboff
Jun 12 2018 21:34 UTC
@MelMacaluso I might be able to answer a question
Mel Macaluso
@MelMacaluso
Jun 12 2018 21:35 UTC
thanks jason, is actually a quick one...
I am using Laravel forge (and AWS)
I made a server (express that listens to a port) and everything works LOCALLY with a separate frontend app
as soon as I deployed that to the server not even the simpliest express app.get('/') would work
either ssh-ing into there and starting it (node server.js) or using daemons to keep it running would suffice
Jason Luboff
@JLuboff
Jun 12 2018 21:37 UTC
So is the server currently running or you're not sure?
I've never worked with AWS/Laravel
Mel Macaluso
@MelMacaluso
Jun 12 2018 21:37 UTC
Basically Laravel forge is nothing but a deployment aid for AWS, it creates automatically servers in AWS
could it be its nginx configuration?
or a ssl problem, or the fact that the domain exists as a A record through cloudflare CDN point to its public IPV4?
Christopher McCormack
@cmccormack
Jun 12 2018 21:38 UTC
Do you have any middleware to log requests to the endpoints?
Mel Macaluso
@MelMacaluso
Jun 12 2018 21:39 UTC
I have a super basic one on the server (on my local the form submits to express server then it uses the req.body to perform some actions and returns to the frontend, all good)
even that one wouldn't work on the server
funnily enough when i ssh into it and start the node server.js it logs to the ssh console that the server started
ie. even that wouldn't work
(server side)
app.get('/', (req, res) => res.send('Hello World!'))
Jason Luboff
@JLuboff
Jun 12 2018 21:40 UTC
What are you using as your port?
Mel Macaluso
@MelMacaluso
Jun 12 2018 21:40 UTC
// Utils 
require('dotenv').config()

// Server setup
const express = require('express')
const bodyParser = require('body-parser')

const app = express()

app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())
app.use(function (req, res, next) {
  // This needs to be restricted in the future, can't allow random CORS
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
  next();
});


app.get('/', function(req, res){
  res.send("Hello World!");
});

app.listen(3000, process.env.PRIVATE_IP );
Jason Luboff
@JLuboff
Jun 12 2018 21:41 UTC
try process.env.PORT instead
Mel Macaluso
@MelMacaluso
Jun 12 2018 21:41 UTC
thing is PRIVATE_IP is an .env variable I myself defined
which poitns to the private ip of the server
Jason Luboff
@JLuboff
Jun 12 2018 21:43 UTC
Which thats fine, but AWS may not be letting port 3000 used (not sure)
Christopher McCormack
@cmccormack
Jun 12 2018 21:43 UTC
did you setup your nginx configuration to point to the right port when the endpoint is hit?
Mel Macaluso
@MelMacaluso
Jun 12 2018 21:44 UTC
some interesting parts regarding that @cmccormack
Christopher McCormack
@cmccormack
Jun 12 2018 21:45 UTC
should have a line in there somewhere that looks like
        location / {

                proxy_pass http://localhost:3000;
Mel Macaluso
@MelMacaluso
Jun 12 2018 21:45 UTC
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/MYWEBSITE.com/before/*;

server {
    listen 80

    server_name server.flete-alas.com;
    root /home/forge/MYWEBSITE.com/;

    # FORGE SSL (DO NOT REMOVE!)
    # ssl_certificate
    # ssl_certificate_key

    # ssl_protocols TLSv1.2;
    # ssl_ciphers [MYWEBSITE'S CHYPERS];
    # ssl_prefer_server_ciphers on;
    # ssl_dhparam /etc/nginx/dhparams.pem;

    # add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    # index index.html index.htm index.php;

    charset utf-8;

    # FORGE CONFIG (DO NOT REMOVE!)
    include forge-conf/MYWEBSITE.com/server/*;

    location / {
        proxy_pass http://PRIVATEIPOFSERVER:3000/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
     }

    # location = /favicon.ico { access_log off; log_not_found off; }
    # location = /robots.txt  { access_log off; log_not_found off; }

    # access_log off;
    # error_log  /var/log/nginx/server.flete-alas.com-error.log error;

    # error_page 404 /index.php;

    # location ~ \.php$ {
    #     fastcgi_split_path_info ^(.+\.php)(/.+)$;
    #     fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
    #     fastcgi_index index.php;
    #     include fastcgi_params;
    # }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/MYWEBSITE.com/after/*;
that's my nginx config
Christopher McCormack
@cmccormack
Jun 12 2018 21:48 UTC
@MelMacaluso you should add a few log statements in your server config so you know it came up, and add a middleware above your first route that logs the incoming request, at least to assist in troubleshooting
Do you have access to the active server log ?

anyone good at regex? https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/match-characters-that-occur-zero-or-more-times

let chewieQuote = "Aaaaaaaaaaaaaaaarrrgh!";
let chewieRegex = /[aA]*/; // Change this line
let result = chewieQuote.match(chewieRegex);

its not passing the last two tests - am i missing something

how am i not supposed to match anything in those strings with what is asked
Brad
@bradtaniguchi
Jun 12 2018 21:51 UTC
@moT01 well right now it looks like your matching a and A, 1 or more times
but that doesn't pass the rgh and ! characters
Christopher McCormack
@cmccormack
Jun 12 2018 21:51 UTC
0 or more times
Brad
@bradtaniguchi
Jun 12 2018 21:51 UTC
^
right
Christopher McCormack
@cmccormack
Jun 12 2018 21:52 UTC
right
Jason Luboff
@JLuboff
Jun 12 2018 21:52 UTC
right
Christopher McCormack
@cmccormack
Jun 12 2018 21:52 UTC
so don't match specific letters
:)
it says its not supposed to match anything in the strings of the last two tests
Christopher McCormack
@cmccormack
Jun 12 2018 21:52 UTC
what are the last two tests?
oh sorry you linked it
Brad
@bradtaniguchi
Jun 12 2018 21:52 UTC
left :{
instructions...
Create a regex chewieRegex that uses the * character to match all the upper and lower"a" characters in chewieQuote. Your regex does not need flags, and it should not match any of the other quotes.
tests...
Your regex should not match any characters in "He made a fair move. Screaming about it can't help you."
Your regex should not match any characters in "Let him have it. It's not wise to upset a Wookiee."
Mel Macaluso
@MelMacaluso
Jun 12 2018 21:53 UTC
Here I am sorry guys, had to pee
ahaha
@cmccormack I have full control basically, would you now where to find that?
right
Mel Macaluso
@MelMacaluso
Jun 12 2018 21:55 UTC
and also @cmccormack would you know how to add such said middleware to log the requesdt? would be helpful
Christopher McCormack
@cmccormack
Jun 12 2018 21:55 UTC
@moT01 ah it wants you to be more explicit, look at the go* example
@MelMacaluso I keep one like this before my first route:
  app.use((req, res, next) => {
    console.debug(`DEBUG originalUrl: ${req.originalUrl}`)
    next()
  })
ahh
Christopher McCormack
@cmccormack
Jun 12 2018 21:56 UTC
Aaaaaaahhh
thanks @cmccormack @bradtaniguchi
moT01 @moT01 sends brownie points
Mel Macaluso
@MelMacaluso
Jun 12 2018 21:56 UTC
Will surely try out, that's helpful thanks!
Christopher McCormack
@cmccormack
Jun 12 2018 21:57 UTC
@MelMacaluso Take it one step at a time if you can though, first make sure your DNS name resolves, then make sure you can reach the server on port 80, then see if your express App sees the request
@MelMacaluso you can just put your log statement in the first app.use you already have to set the headers as well
Mel Macaluso
@MelMacaluso
Jun 12 2018 21:58 UTC
DNS name resolves, I did that, I believe, by adding it in cloudflare as a A record that points there (is a subdomain of a main domain), i put there a random index.php just to see if it resolves
Christopher McCormack
@cmccormack
Jun 12 2018 21:58 UTC
35.177.181.73 is the server?
Mel Macaluso
@MelMacaluso
Jun 12 2018 21:58 UTC

@MelMacaluso you can just put your log statement in the first app.use you already have to set the headers as well

Could you elaborate slightly

yep is a AWS EC2 instance
Christopher McCormack
@cmccormack
Jun 12 2018 21:59 UTC
@MelMacaluso yeah just put a lot like I have in mine in the same middleware you're already using to set the headers for cors
Mel Macaluso
@MelMacaluso
Jun 12 2018 21:59 UTC
created through laravel forge
Brad
@bradtaniguchi
Jun 12 2018 21:59 UTC
@moT01 np :D
Christopher McCormack
@cmccormack
Jun 12 2018 22:00 UTC
@MelMacaluso do you go through AWS to manage the nginx config or can you do that all manually?
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:00 UTC
I can do that manually through laravel forge, it provides a sort of editor for nginx config
mine is posted up here
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:01 UTC
I exactly followed that one
but unfourtunately it seems that something is interfering
Christopher McCormack
@cmccormack
Jun 12 2018 22:02 UTC
so you have your symlinks setup and you restarted the server?
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:02 UTC
I wonder if that's cloudflare
"symlinks" unfourtunately not aware of what are those
re restarting yes I do restart almost every edit and wait
Christopher McCormack
@cmccormack
Jun 12 2018 22:02 UTC
ln -s /etc/nginx/sites-available/server.flete-alas.com /etc/nginx/sites-enabled/
something like that
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:03 UTC
ah yeahs that's done in forge (the ngfinx config) they automate it I believe
Christopher McCormack
@cmccormack
Jun 12 2018 22:05 UTC
@MelMacaluso PRIVATEIPOFSERVER is that something you blanked out for us or is that how it's actually configured?
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:05 UTC
no no that;s blanked out
is basically the ipv4 private ip
I found in amazon
Bjorn van de Peut
@bjorno43
Jun 12 2018 22:06 UTC
:wave:
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:06 UTC
Also I can't even test now properly any new changes as cloudflare is still propagaing the ssl
not to mention that the whole config changes drastically if everything is under SSL
Didn't expect launching a simple node server was that overkill honestly
I might just use php :joy:
Bjorn van de Peut
@bjorno43
Jun 12 2018 22:07 UTC
I didn't quite follow the conversation. What's the issue @MelMacaluso ?
Jason Luboff
@JLuboff
Jun 12 2018 22:07 UTC
Don't go to the darkside!
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:08 UTC
Ahahahahh Jason
Bjorn van de Peut
@bjorno43
Jun 12 2018 22:08 UTC
Yes! Do come to the darkside! We have cookies!
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:08 UTC
Sure, in a very tl;dr
locally my node express server communicates perfectly with my frontend app
Christopher McCormack
@cmccormack
Jun 12 2018 22:08 UTC
I have mine setup for https only
I haven't used cloudflare does it expect the request to be https?
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:08 UTC
server wise everything got screwed and can't sortout
That's a good point, yes I'd like to use https only
In cloudflare you can force that so I belive setting it for https only would be alright
Bjorn van de Peut
@bjorno43
Jun 12 2018 22:09 UTC
Meh, unfortunetely I know very little about NodeJS. I just use apache. Much easier, lol
Christopher McCormack
@cmccormack
Jun 12 2018 22:09 UTC
well you have what appears to be port 80 only atm so maybe try to do http first
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:10 UTC
when I issue the SSL in forge
it then listens to 443 instead
Christopher McCormack
@cmccormack
Jun 12 2018 22:10 UTC
it does the cert stuff too?
Bjorn van de Peut
@bjorno43
Jun 12 2018 22:10 UTC
Ye, obviously. SSL = 443 (default)
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:11 UTC
some a couple of questions so that maybe in the near future (200years) wil be able to sort it
thanks Bjorn, actually didn;t know that lol
"app.listen(3000);" do I need to specify something else in there as second parameter?
in the digitalocean article they say to put there the private ipv4
or can I just get away with localhost? or nothing at all
Bjorn van de Peut
@bjorno43
Jun 12 2018 22:12 UTC
That just means your server listens for requests on port 3000. So it would respond if ppl would visit your_website.com:3000
Christopher McCormack
@cmccormack
Jun 12 2018 22:12 UTC
I set mine up like
const app = express()
app.set("port", process.env.PORT || 3000)
//...
const server = app.listen(app.get("port"), () => {
  const {port, address, } = server.address()
  console.info(`Express server started on ${address}:${port}`)
})
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:14 UTC
is that a env variable you define somewhere else? process.env.PORT
Christopher McCormack
@cmccormack
Jun 12 2018 22:14 UTC
yes
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:14 UTC
any clue of what that port could be in my case
Christopher McCormack
@cmccormack
Jun 12 2018 22:14 UTC
with backend apps you want to keep environment specific data in a separate file, most use a .env file
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:14 UTC
yep that's what I did for some parts of it
(As I am committing the file too)
Christopher McCormack
@cmccormack
Jun 12 2018 22:15 UTC
but process.env is derived from the environment that the app was run in I believe
and you can pass properties when you start the server
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:16 UTC
I thought process.env is something from dotenv npm
Christopher McCormack
@cmccormack
Jun 12 2018 22:16 UTC
Many of use use dotenv package to easily bind the .env file
require("dotenv").config({path: path.resolve(__dirname, ".env"), })
I believe dotenv just merges your .env file with the process.env
check for yourself, log process.env at the top of your app and see what's in it
log everything
Jason Luboff
@JLuboff
Jun 12 2018 22:17 UTC
@cmccormack You use dotenv in production?
Christopher McCormack
@cmccormack
Jun 12 2018 22:19 UTC
should I not?
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:19 UTC
I guess is fine Otherwise how would you obscure sensible data?
Jason Luboff
@JLuboff
Jun 12 2018 22:20 UTC
I was under the impression its mainly meant for dev for some reason
Christopher McCormack
@cmccormack
Jun 12 2018 22:22 UTC
@JLuboff don't see why you shouldn't, it's a pretty barebones utility - https://github.com/motdotla/dotenv/blob/master/lib/main.js
that's the entire code
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:22 UTC
Wow
I expected much more
Christopher McCormack
@cmccormack
Jun 12 2018 22:24 UTC
the simpler the better :)
Jason Luboff
@JLuboff
Jun 12 2018 22:24 UTC
@cmccormack :+1:
Christopher McCormack
@cmccormack
Jun 12 2018 22:24 UTC
@JLuboff so how do you add your variables in prod?
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:32 UTC
uninstalling the whole lot
on the server / cloduflare
and starting from scratch
is gonna be a long night...
Jason Luboff
@JLuboff
Jun 12 2018 22:34 UTC
@cmccormack Hmmm... Guess I haven't needed to at this point besides via Heroku/Glitch
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:35 UTC
I might do that in heroku at this point :joy:
Christopher McCormack
@cmccormack
Jun 12 2018 22:36 UTC
@MelMacaluso well when you get it working you can tell everyone else :)
Jason Luboff
@JLuboff
Jun 12 2018 22:36 UTC
hmmm...gotta remind myself how to use PM2
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:37 UTC
I heard forever is pretty good and simplier
but offer let's control
(ie. forge has inbuilt daemons with supervisor, which apparently don't work :joy: )
Christopher McCormack
@cmccormack
Jun 12 2018 22:41 UTC
@JLuboff pm2 start --name [appname] [apppath]
pm2 is super easy
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:41 UTC
@cmccormack out of curiosity what' your job title?
Christopher McCormack
@cmccormack
Jun 12 2018 22:41 UTC
@MelMacaluso network engineer
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:41 UTC
seems like you're super confident with servers etc.
makes sense..
I am a frontend developer but when it comes to server and anything that revolves around it
I get scared
ie. I shit my pants
ahahah
Christopher McCormack
@cmccormack
Jun 12 2018 22:42 UTC
I'm not really, I just happened to update my server today to add a new app I finished haha
Jason Luboff
@JLuboff
Jun 12 2018 22:42 UTC
@cmccormack I need to pull the latest from my repo
so had to stop it (I think)
and then remember where it lives
Christopher McCormack
@cmccormack
Jun 12 2018 22:43 UTC
pm2 show should tell you where it lives
regex
Christopher McCormack
@cmccormack
Jun 12 2018 22:43 UTC
if you remember the app name
Jason Luboff
@JLuboff
Jun 12 2018 22:43 UTC
It does :smile:
pm2 list to get name, pm2 describe <name> to get info
Christopher McCormack
@cmccormack
Jun 12 2018 22:44 UTC
@MelMacaluso I play with raspberry pis a lot for home use, that gets you more comfortable with servers
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:44 UTC
that's one to try yet
raspberry
Had always a fetish for that
is the the baby step for a full ironman armor, isns'it
:joy:
been meaning to turn my pi into a server for some practice
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:46 UTC
people turning things into servers and I can't even get a virtual one up and running
nice one :joy:
Christopher McCormack
@cmccormack
Jun 12 2018 22:47 UTC
@moT01 you're overthinking it
@MelMacaluso well you can break a local server as much as you want and learn from repairing it haha
Jason Luboff
@JLuboff
Jun 12 2018 22:47 UTC
argghh... package.json is locked not letting me pull the latest lol
thanks - got it
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:48 UTC
Not when cloudflare cached my DNS and not I cannot get neither the SSL version or the normal HTTP
dammit cloudflare
time to hit the bed / netflix I guess :joy:
Oh{3,6} no
Christopher McCormack
@cmccormack
Jun 12 2018 22:49 UTC
@moT01 :thumbsup:
If cloudflare is resolving the correct IP then it's not a dns issue @MelMacaluso
@JLuboff how does that work?
Jason Luboff
@JLuboff
Jun 12 2018 22:50 UTC
@cmccormack I dunno. It was keeping me from pulling from my remote repo so I had to stash it
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:54 UTC
current aim
get your level of confidence server-wise
jesus chirst
:shipit:
Christopher McCormack
@cmccormack
Jun 12 2018 22:55 UTC
is that a gerbil in a trenchcoat?
I don't get it
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:55 UTC
Me neither
I had to zoom
ahahha
people with coats are server-ish
Christopher McCormack
@cmccormack
Jun 12 2018 22:56 UTC
yeah why not haha
Mel Macaluso
@MelMacaluso
Jun 12 2018 22:57 UTC
could I run the express server simply inside my normal website?
just calling it through a daemon pointing to the .js
?
or I need a subdomain / different ip
I guess not? so that I can use localhost / ports easier? and less setup?
did I drink too much :coffee: ? probably.
Christopher McCormack
@cmccormack
Jun 12 2018 23:00 UTC
it needs to be running on the server
do you mean something like node app.js?
in your daemon?
Mel Macaluso
@MelMacaluso
Jun 12 2018 23:00 UTC
yep
instead of creating:
Christopher McCormack
@cmccormack
Jun 12 2018 23:01 UTC
that's how an express server works, but you would need it running on port 80 or 443 to take http/https requests
Mel Macaluso
@MelMacaluso
Jun 12 2018 23:01 UTC
uhm but when we do then listen(3000) shouldn't then we define listen(80)?
Christopher McCormack
@cmccormack
Jun 12 2018 23:01 UTC
the user is going to try and hit those ports externally - nginx acts as the proxy to point to the server on whatever port its running on so you can have multiple apps running
You can try it
Jason Luboff
@JLuboff
Jun 12 2018 23:21 UTC
@cmccormack If you have any reason to take a Microsoft exam, they have a good deal on the Voucher + retakes
Christopher McCormack
@cmccormack
Jun 12 2018 23:23 UTC
I hope I don't have to haha
Alright I gotta run ttyl
Jason Luboff
@JLuboff
Jun 12 2018 23:23 UTC
See ya
bitlishuaifei
@bitlishuaifei
Jun 12 2018 23:43 UTC
My answer is right;but can't pass
Return Largest Numbers in Arrays
Jason Luboff
@JLuboff
Jun 12 2018 23:44 UTC
Show what you have
bitlishuaifei
@bitlishuaifei
Jun 12 2018 23:44 UTC

function largestOfFour(arr) {
// 请把你的代码写在这里
//第一步判断数组元素个数

for(var i=0;i<arr.length;i++){ for(var j=1;j<arr[i].length;j++){ if(arr[i][j-1]>arr[i][j]){
arr[i][j]= arr[i][j-1];
}
arr[i]=arr[i][j];
}
}
//第二部循环取出每个数组的元素并且比较数组元素大小

return arr;
}

largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]);

Return Largest Numbers in Arrays this function
Mel Macaluso
@MelMacaluso
Jun 12 2018 23:45 UTC
wow
bitlishuaifei
@bitlishuaifei
Jun 12 2018 23:46 UTC
why?
BUG?
Jason Luboff
@JLuboff
Jun 12 2018 23:46 UTC
@bitlishuaifei No, your code is not correct
It only works for the first case
Mel Macaluso
@MelMacaluso
Jun 12 2018 23:46 UTC
No idea, link the challenge?
bitlishuaifei
@bitlishuaifei
Jun 12 2018 23:48 UTC
@JLuboff I test is right
Mel Macaluso
@MelMacaluso
Jun 12 2018 23:48 UTC
Link the challenge please?
or the untouched code challenge here?
Mel Macaluso
@MelMacaluso
Jun 12 2018 23:48 UTC
wrapped in ``` (before and after)
Thanks lol
Jason Luboff
@JLuboff
Jun 12 2018 23:50 UTC
@bitlishuaifei This line here arr[i][j]= arr[i][j-1]; is part of your issue. I would recomend assigning that to a new variable and work from there
bitlishuaifei
@bitlishuaifei
Jun 12 2018 23:51 UTC
ok I will test
Jason Luboff
@JLuboff
Jun 12 2018 23:52 UTC
You'll want that variable to sit between the two loops too, so its only being reset when the first loop iterates
bitlishuaifei
@bitlishuaifei
Jun 12 2018 23:55 UTC
thanks arr[i][j]= arr[i][j-1]; you're right
Jason Luboff
@JLuboff
Jun 12 2018 23:56 UTC
I gotta go. Good luck. IF you really want to challenge yourself...it can be done in one line ;)