Mistři v programování na #hovnokod


Anonymous,

I get: Error. ReferenceError: `bot` is not defined

  const isAdmin = (chat, user) => {
    var status = bot.telegram.getChatMember(chat, user);
    return status.then(function(result) {
      if (result.status == "creator" || result.status == "administrator") {
        return true;
      } else {
        return false;
      }
    });
  }

  module.exports = {
    isAdmin
  };

Anonymous,

vsimnete si chybejiciho return ;)

	/**
	 * Gets account.
	 *
	 * @param int|Account $account
	 *
	 * @return Account|null
	 */
	private function getAccount($account)
	{
		if (is_object($account)) {
			return $account;
		}
		$this->accountRepository->findOneBy(['id' => $account]);
	}

Anonymous,

fíjó!

		// Shift keys
		if ($this.hasClass('left-shift') || $this.hasClass('right-shift')) {
			$('.letter').toggleClass('uppercase');
			$('.symbol span').toggle();

			shift = (shift === true) ? false : true;
			capslock = false;
			return false;
		}
		}

		// Remove shift once a key is clicked.
		if (shift === true) {
			$('.symbol span').toggle();
			if (capslock === false)
				$('.letter').toggleClass('uppercase');

			shift = false;
		}

		// Add the character
		$passwordField.val($passwordField.val() + character);
		$passwordField.trigger("change");

Anonymous,

když jste líní přepisovat u konstanty modifikátor private na public...

class GenericValidationClass {
    private static final String VALIDATION_PARAM_NAME = "businessValidations";
...
}

// somewhere else in the SAME CODEBASE!!!
    public static String getBusinesseValidationParamName() {
        try {
            Field field = GenericValidationClass .class.getDeclaredField("VALIDATION_PARAM_NAME");
            if (field != null) {
                field.setAccessible(true);
                return (String) field.get(GenericValidationClass .class);
            }
        } catch (NoSuchFieldException ex) {
            Logger.getLogger(ProcessingClass.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SecurityException ex) {
            Logger.getLogger(ProcessingClass.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalArgumentException ex) {
            Logger.getLogger(ProcessingClass.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            Logger.getLogger(ProcessingClass.class.getName()).log(Level.SEVERE, null, ex);
        }
        return null;
    }

Anonymous,