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
LydaTech
@lydatech
@mradil16 background-size: cover; will fix it. Remove the center center no-repeat and add the cover
@mradil16 youre also losing your images in the "Still showing properties ?" section on resize
ect
Ghost
@ghost~55a04b725e0d51bd787af54c
Hey guys :smile: I was wondering if you guys could leave some feedback on my chrome web app?
linkin-park
@linkin-park
chrome web app ?
whats that
Ghost
@ghost~55a04b725e0d51bd787af54c
Just a website with a fancy name (it's called a web app because it's designed to work on mobile devices as well, but it may still have a few bugs)
linkin-park
@linkin-park
what does it do :)
Ghost
@ghost~55a04b725e0d51bd787af54c
So it's basically a bookmarking app for your new tab page. You can also click the Simplify button to make the website into a sort of relaxing screensaver, for productivity purposes, or likewise.
Justin25
@Justin25
@mradil16 That looks great, you could easily make much more than 350$ a month
Sorry for the late reply
ivanabojic
@ivanabojic

Hi, I need help with Simon Memory game.
How can I prevent or ignore further clicks after a wrong sound is played? At the moment, my code plays more than one example melody in paralel. When wrong note is clicked exmaple melody starts playing. If note is clicked before the end second example melody plays at the same time. Third could be added the same way.

Here is the link:
https://codepen.io/Jo-anna/pen/LzENyX

Strict mode is not implemented yet. Player's notes are not held in an array, but checked against example melody as they are pressed.
Gersho
@Gersho
@ivanabojic i don't really know what's best practice on this, but i used boolean checks to prevent user input
for exemple, at the start of your function that plays the melody after an error, put melodyPlaying = true
Allister
@AlyxMoon
@ivanabojic How I would handle it is to use a variable along with a timer to track when you are playing a sound back, and you don't want the user to be able to do anything.
For example, once they click something and you are giving feedback in the form of sound, set a variable givingFeedback or something to true and create a timer at the moment to set it false after some amount of time, after sound would be done.
Then, when you are getting user input, check whether givingFeedback is true or not. If it's true, don't do anything.
Gersho
@Gersho
and at the stat of your click functions a check if it's true or not, and return right away if it is
(and of course set if to false when you're done)
Allister
@AlyxMoon
@Gersho Great minds think alike :D
piteto
@piteto
I don't know if you two are looking at the code, but they are using clickEnabled = true;
they need help with getting that to work, it seems
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