Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
Darth Skywalker
@adityaparab
@trieucrew what do you mean when i click military ?
trieucrew
@trieucrew
like the time on the page
the time that is displayed
DavidMinAZ
@DavidMinAZ
@jamespayne You have no idea how relieved I am to have someone that stumbled along with the solution to my exact issue. I posted in three rooms and didn't get the usual instant response so I went back to looking at it for hours... what a relief!
Darth Skywalker
@adityaparab
@trieucrew : You will have to do something like this
$(document).ready(function(){
  var int = setInterval(updateTime.bind(this, military),1000,military);
  $("#time").click(function(){
    if(int) {
      clearInterval(int);
      int = setInterval(updateTime.bind(this, military),1000,military);
    }
    military = !military;
  });
});
your military variable was not getting passed as a parameter (format) in your updateTime function.
trieucrew
@trieucrew
can you explain what bind does
I remember seeing this somewhere
Darth Skywalker
@adityaparab
additionally, since your military is a global variable, you can also do
function updateTime(){
  var d = new Date(),
      hours = d.getHours(),
      displayHours = military == true ? hours : hours % 12,
      minutes = d.getMinutes() > 9 ? d.getMinutes() : ("0" + d.getMinutes()),
      time = displayHours + ":" + minutes;
  if(hours < 12){
    time += " a.m.";
  }else{
    time += " p.m.";
  }
  $("#time").html(time);
}
$(document).ready(function(){
  $("#time").click(military, function(){
    military = !military;
  });
  setInterval(updateTime,1000);
});
trieucrew
@trieucrew
oh okay
just wondering is it good technique to keep military as a global or does it not matter
Darth Skywalker
@adityaparab
@trieucrew keeping things global is generally a bad practice
bind does what bind means.
It will bind scope and parameters to be passed to a function.
but bind will not call the function
when you call the function, whatever is bound to the function using .bind will be reflected in your function.
trieucrew
@trieucrew
okay i think that helps alot
I've been having trouble with asynchronous function and I think that solves my problem
Darth Skywalker
@adityaparab
1st argument to bind is the scope (it will be value of this inside your function) and then 2nd arguments onward are parameters to be passed.
:+1:
Hesham Ismail
@uaefame
Hello, i am trying to build a tribute page for my first html challenge, question? Am i suppose to build one with image, text and URL ? Any other thing to include or these 3 elements
Darth Skywalker
@adityaparab
@uaefame It's your creation. Do whatever you want.As long as it fulfills all the use cases
Hesham Ismail
@uaefame
Alright thanks @adityaparab
CamperBot
@camperbot
uaefame sends brownie points to @adityaparab :sparkles: :thumbsup: :sparkles:
:cookie: 766 | @adityaparab |http://www.freecodecamp.com/adityaparab
trieucrew
@trieucrew
thanks @adityaparab
CamperBot
@camperbot
:cookie: 767 | @adityaparab |http://www.freecodecamp.com/adityaparab
trieucrew sends brownie points to @adityaparab :sparkles: :thumbsup: :sparkles:
grantknaver
@grantknaver
Ok I am stumped can someone help me out
I dont know how to do this
any help would be appreciated
looking on how to accomplish two different AJAX requests
grantknaver
@grantknaver
any help
Kevin
@KevinBruland
sure, are you working on a specific project @grantknaver
grantknaver
@grantknaver
ya @KevinBruland hopefully you can help me
I am working the Twitch problem. Do you think you can help
?
Kevin
@KevinBruland
sure
want to link what you have?
grantknaver
@grantknaver
awesome3
Ill post the link right now
Kevin
@KevinBruland
I have some guesses as to what your problem is, I remember running into issues on that
awesome
Ok here are the problems I am running into
I am trying to post a ajax request for the chanels that are online and the channels that are offline
Kevin
@KevinBruland
side note real quick, .bind is depreciated
grantknaver
@grantknaver
the online is not a problem - or at least it does not seem to be
Kevin
@KevinBruland
so use .on() instead
grantknaver
@grantknaver
gotcha