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
Allister
@AlyxMoon
Yeah I didn't go that deep.
Gersho
@Gersho
@piteto i didn't look to be honest :D
piteto
@piteto
230 lines of code are hard to go through in a few minutes
Gersho
@Gersho
oh they already have similar logic but turned the other way around
(for input check i mean)
piteto
@piteto
@ivanabojic maybe you can help narrow down where you're trying to enable/disable clicks - what function/lines of code
Gersho
@Gersho
i didn't even know about.off().on(
Allister
@AlyxMoon
Ah okay, so in the part where it's commented // enable further clicks
The code itself runs really fast, you are setting that variable back to true in an inconsequential amount of time after you've set it false. The sound, in comparison, is going to take a second or so. You just want a timer to delay the setting of clickEnabled to true.
Gersho
@Gersho
can we set up a promise in such a case ? (is there an event when an audio is done playing ?)
Geekomatic
@Geekomatic
@ivanabojic Try disabling the click function after each click, and reenabling whenever applicable.
Allister
@AlyxMoon
@Justin25 I'm not sure exactly what you mean by 'render'. Are you talking about switching the class set on an element? And are you using jQuery?
Gersho
@Gersho
@Justin25 with a click event handler in the class ? and use a prop or state (that's react i think Allister)
Justin25
@Justin25
Does anyone know of a way to change between render two different classes in react on a button click. For example, I want to render class 1, then when I click a button, it will render class 2 instead.
Will White
@willnwhite
Will using dangerouslySetInnerHTML on the Markdown Previewer project "inadvertently expose your users to a cross-site scripting (XSS) attack"?
@Justin25 Sure.
@Justin25 Make a class whose render function chooses between class 1 or class 2.
Allister
@AlyxMoon
@Justin25 Okay, so like showing two different components. The way I would think to tackle it:
Use a parent and child class/component. Have one component that can render both class 1 and class 2. Give it an onClick handler that toggles a variable between some value, like true and false or however you want to handle it. In the render method, check that variable and display either class 1 or class 2 as appropriate.
Gersho
@Gersho
@Justin25 there's a good lesson about it on CodeAcademy (this.state in React part 1) but since we can't access it right away i'll paste their exemple code
import React from 'react';
import ReactDOM from 'react-dom'

const green = '#39D1B4';
const yellow = '#FFD712';

class Toggle extends React.Component {
  constructor(props){
    super(props);
    this.state={ color: green };
        this.changeColor = this.changeColor.bind(this);
  }

  changeColor(){
        const newColor = this.state.color == green ? yellow : green;
    this.setState({ color: newColor });
  }

  render() {
    return (
      <div style={{background: this.state.color}}>
        <h1>
          Change my color
        </h1>
         <button onClick={this.changeColor}>
          Change color
        </button>
      </div>
    );
  }
}



ReactDOM.render(<Toggle/>,document.getElementById("app"));
ivanabojic
@ivanabojic
Thank you @Geekomatic, I was thinking alogn those lines. I do not understand timing well as @AlyxMoon mentioned. I might even enable click too fast.
CamperBot
@camperbot
ivanabojic sends brownie points to @geekomatic and @alyxmoon :sparkles: :thumbsup: :sparkles:
:cookie: 371 | @geekomatic |http://www.freecodecamp.com/geekomatic
:cookie: 414 | @alyxmoon |http://www.freecodecamp.com/alyxmoon
Geekomatic
@Geekomatic
Anyone mind checking for bugs on my simon game ? https://codepen.io/Geekomatic/pen/YrwmvW?editors=0010
Gersho
@Gersho
trying to break stuff ? i'm in
Geekomatic
@Geekomatic
Code is dirty, try at your own peril.
Gersho
@Gersho
when we switch to strict mode, game doesn't reset, so you could possibly play in easy until lvl 19 and switch to strict to get hard mode victory (i don't know how an actual simon responds in this case)
Geekomatic
@Geekomatic
Yeah same, I just rolled with it
Gersho
@Gersho
the stuff that usually breaks easily seems to work fine here (spamming button mostly)
Pete Givens
@petegivens
Anybody here with experience using Material-UI ?
Jan Shah
@JanShah
@petegivens yes, what do you need?
Ismail Hozain
@ismailhozain
can anyone help me with deploying my website from vim using surge cause im having issues
?
Tom
@moT01
@Geekomatic seems to all be working, ...well done
Geekomatic
@Geekomatic
@moT01 Ty
CamperBot
@camperbot
geekomatic sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 862 | @mot01 |http://www.freecodecamp.com/mot01
Tom
@moT01
could use a little more style, but doesn't need or require it
like maybe a background and a border on that start button
Justin25
@Justin25
@Gersho This doesn't work in my situation because I want to switch between rendering two separate classes, not just change something in a singular class
Alexx Martínez
@AlexxMart

Hello, I'm working on the weather app challenge and I can't seem to find a way to use the JSON information in my HTML treating it like a regular object.

When I try to add the information to my page it simply does nothing

the problem is between the lines 55 and 59 of my Javascript
piteto
@piteto
@AlexxMart textContent is a pure javascript method, use jquery's .text() instead: newTemp.text(celsius);
Or use JavaScript instead of jQuery:
var newTemp = document.getElementsByClassName('temp')[0];
newTemp.textContent = celsius;
Alexx Martínez
@AlexxMart
Thanks @piteto that did the trick
CamperBot
@camperbot
alexxmart sends brownie points to @piteto :sparkles: :thumbsup: :sparkles:
:cookie: 146 | @piteto |http://www.freecodecamp.com/piteto
Alexx Martínez
@AlexxMart
I never stopped to realize that there was a different method for jquery or JS, I always used the one I had there at first but I never had jQuery in my document before
piteto
@piteto
It can get confusing switching between the two - usually best to use one or the other :)