Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:33
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • May 10 09:13
    @bjorno43 banned @zhaokunhaoa
  • Apr 25 17:12
    @mstellaluna banned @cmal
  • Apr 01 18:11
    thecodingaviator labeled #31179
  • Apr 01 18:11
    thecodingaviator labeled #31179
  • Apr 01 18:09
    thecodingaviator commented #31179
  • Apr 01 18:09
    thecodingaviator labeled #31182
  • Apr 01 18:09
    thecodingaviator labeled #31182
  • Apr 01 18:07
    thecodingaviator commented #31182
  • Apr 01 18:07
    thecodingaviator labeled #31190
  • Apr 01 18:07
    thecodingaviator labeled #31190
  • Apr 01 18:07
    thecodingaviator commented #31190
  • Apr 01 18:05
    thecodingaviator commented #31157
  • Apr 01 18:04

    thecodingaviator on master

    remove A (#31157) (compare)

  • Apr 01 18:04
    thecodingaviator closed #31157
  • Apr 01 18:04
    thecodingaviator closed #33788
  • Apr 01 18:04
    thecodingaviator commented #33788
  • Apr 01 18:02
    thecodingaviator closed #31059
  • Apr 01 18:02
    thecodingaviator commented #31059
TWoerner94
@TWoerner94
I tried to do that with clearInterval(countdown) but it doesnt seem to work
Ronique Ricketts
@RoniqueRicketts
@Blauelf cool
Ronique Ricketts
@RoniqueRicketts
I have some questions for nodejs/php developers. When you setting up an app from scratch lets say you buy a domain name and you also buy a serverspace. What do you do next to get coding building up the back-end so you can start serving pages? Anyone has any documentation for nodejs that I could read to get some info?
Christopher McCormack
@cmccormack
@TWoerner94 probably a scoping issue, move var countdown outside your click handler so it's global
@TWoerner94 and don't forget to set clicked to false again in your else
TWoerner94
@TWoerner94
Oh cool thanks I'll try that thanks @cmccormack
CamperBot
@camperbot
twoerner94 sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
api offline
TWoerner94
@TWoerner94
How do i do that though? I want countdown to be triggered on click
Christopher McCormack
@cmccormack
  var countdown
  //start stop button functionality
  $('#start').click(function() {
    if (!clicked) {
      clicked = true;
      let timer = len * 60;
      countdown = setInterval(function() {
        timer--;
        $('#remain').html(timer);
        if (timer === 0) {
          alarm.play();
          timer = brk * 60;
        }
      }, 1000);
    } else {
      clearInterval(countdown);
      clicked=false
    } 
  });
TWoerner94
@TWoerner94
Ohh just declaring the name, not a value
That makes sense thanks again @cmccormack
Christopher McCormack
@cmccormack
Right, sorry I wasn't more specific
CamperBot
@camperbot
twoerner94 sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
api offline
Christopher McCormack
@cmccormack
np
TWoerner94
@TWoerner94
Worked perfectly :D
I was under the impression that var would be hoisted up to a higher level anyways
But maybe i just misunderstand hoisting
Jason Luboff
@JLuboff
@RoniqueRicketts I haven't looked too much into it myself, but you would need to purchase serverspace as opposed to web server space since with node you're creating the web server. I'm not entirely sure how that works since I've only used free hosts at this point (heroku and glitch)
Christopher McCormack
@cmccormack
@TWoerner94 it will hoist to the top of the scope, but I believe the scope is your callback function, and when you click it again you're calling it with a new callback function
Ronique Ricketts
@RoniqueRicketts
@JLuboff even that i've never uset it before can i do it :)
Jason Luboff
@JLuboff
@RoniqueRicketts I normally build up everything locally, and while doing so constantly (atleast once a day if not multiple times a day) push my code up to github. When I'm ready to deploy, I deploy from my github repo to either heroku or glitch
Christopher McCormack
@cmccormack
For my server I'm using godaddy, for my url I'm using Hover. Godaddy gives you a full unix interface to install what you need to do the backend stuff
Ronique Ricketts
@RoniqueRicketts
I wanna mess around with an application concept I have
@cmccormack So I just install node then I can install packages with npm?
Jason Luboff
@JLuboff
@RoniqueRicketts I would just do it locally then, no reason not to
Ronique Ricketts
@RoniqueRicketts
@JLuboff I wanna know how to use a server
Jason Luboff
@JLuboff
Thats the thing...with node, you're creating the server. Setting it up is roughly the same when doing it locally on your machine or doing it on a remote machine (only difference might be installing node as its going to be sliughtly different between windows/mac/linux)
Ronique Ricketts
@RoniqueRicketts
@JLuboff OMG YOUR JOKING RIGHT!!!!?????
Jason Luboff
@JLuboff
I mean, there might be a few extra steps for a true production environment but ya its not like setting up a windows web server with cpanel or what not
Christopher McCormack
@cmccormack
@RoniqueRicketts dang you now I'm digging into AWS services for hosting and I bet I'm going to end up spending :moneybag: today...
Beanstalk appears to have a preconfigured node.js platform which may be nice
Ronique Ricketts
@RoniqueRicketts
@cmccormack not my fault
Christopher McCormack
@cmccormack
@RoniqueRicketts little bit your fault :)
I agree with @JLuboff though, set it up locally, a server is just a computer. If you want to try it with unix/linux, install a virtual machine
Gersho
@Gersho
wait what ? shouldn't you always use a VM for hosting ?
Christopher McCormack
@cmccormack
Your question is too general @Gersho
Ronique Ricketts
@RoniqueRicketts
@cmccormack nice I can install nodejs and also set up the scripts for a server
Gersho
@Gersho
@cmccormack i meant, that no matter what OS you use, you should have your whatever server in a VM, not your main system
expect if it's a system you don't use ofc
Christopher McCormack
@cmccormack
I'm not certain why you would think that - maybe it's a good practice for ensuring your environment is clean and replicatable but for just playing with a node server you can run it on the local OS if you like I imagine.
Ronique Ricketts
@RoniqueRicketts
@JLuboff so lets say I go on heruku and sign up should i just select a random server and then make it work.
Gersho
@Gersho
oh yeah if it's only for tests there's no problem (oh and on top of being clean/replicable, it also limits the posibility of rights elevation in case the vm is compromised)
Jason Luboff
@JLuboff
@RoniqueRicketts Heroku does not have an editor (as far as I know), so you need to develop locally. Glitch does have an editor, so you may want to try that out
Speaking of VM's...I just built one 20 minutes ago heh
Ronique Ricketts
@RoniqueRicketts
@JLuboff thanks man. I wanna try out some things i know ;) I got some apps I might try to develelop
CamperBot
@camperbot
roniquericketts sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:star2: 2185 | @jluboff |http://www.freecodecamp.com/jluboff
Jason Luboff
@JLuboff
!!!!!!