- 1
- 2
- 3
- 4
- 5
- 6
- 7
luabind::object FlowerEventModel::RewardInfo(int index) const {
luabind::object result = luabind::newtable(Core::luaState);
if (index < 0 && index >= (int)_presents.size()) {
return result;
}
return result;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+2
luabind::object FlowerEventModel::RewardInfo(int index) const {
luabind::object result = luabind::newtable(Core::luaState);
if (index < 0 && index >= (int)_presents.size()) {
return result;
}
return result;
}
0
Разупоритесь-тред.
Под какой файкой нынче сидит доктор[]инхо[/s]?
+3
const arr = [['govno', 'shit'], ['kod', 'code']]
//we expect it to be {'govno': 'shit', 'kod' : 'code'}
//unsupported(yet)
Object.fromEntries = arr =>
Object.assign({}, ...Array.from(arr, ([k, v]) => ({[k]: v}) ));
const res1 = Object.fromEntries(arr)
const res2 = arr.reduce((res, [key, value]) => Object.defineProperty(res, key, {'value': value, 'enumerable': true}), {})
const res3 = {}
arr.forEach(([key, value]) => res3[key] = value)
А как превратить массив пар ключ-значение в ассоциативный на Вашем языке?
+2
#include <stdio.h>
typedef int return;
typedef char *break;
typedef return continue(return argc, break *argv);
continue main
{
break s = "Именно поэтому я за \"Си\"";
puts(s);
}
В моём любимом tcc работает
−1
У меня из-за этого бессоница:
Стою я как-то на светофоре, жду когда загорится зелёный, и тут подходит ко мне девушка с сумкой и просит проводить её до какой-то там улицы. Я чуть не обосрался: со мной редко кто разговаривает, тем более девушки. Но я набрался смелости и сказал что не знаю где это, а она сказала что покажет. Я нихуя не понял, зачем тогда её провожать. "Ну ладно", сказал я. Мы дождались зелёного, она немного постояла зачем-то, потупила, потом взяла сумку и мы пошли, перешли дорогу, прошли буквально несколько метров, как она говорит: "ну ладно, дальше я сама дойду, а там меня встретят". Я опять ничего не понял, но сказал: "ну ладно". Какое-то время мы ещё шли рядом, нам было по-пути, потом она куда-то свернула.
Джва месяца я онализировал это проишествие и пришёл к выводу: ей походу надо было помочь сумку понести?
+1
if($form_action=="register") {
if($coo_coo=="tootoo") {
if($myusername) {
if($mypassword) {
if($mypassword==$myrepeat) {
$uLength = strlen($myusername);
$pLength = strlen($mypassword);
if($uLength >= 3 && $uLength <= 30) {
$return_error = "";
} else {
$return_error = "Username must be between 3 and 30 characters.";
}
if($pLength >= 3 && $pLength <= 30) {
$return_error = "";
} else {
$return_error = "Password must be between 3 and 30 characters.";
}
if($return_error == "") {
if($db_found) {
$mypassword = md5($mypassword);
$SQL = "SELECT * FROM users WHERE username='$myusername'";
$result = mysql_query($SQL);
$num_rows = mysql_num_rows($result);
if($num_rows==1) {
$return_error = "Username already taken.";
} else {
if(!mysql_query("INSERT INTO users (id,date,ip,username,password) VALUES ('','$date','$ip','$myusername','$mypassword')")){
$return_error = "System error.";
} else {
$return_error = "Logged in.";
$_SESSION['user_session'] = $myusername;
header ("Location: index.php");
}
}
}
}
} else {
$return_error = "Passwords did not match";
}
} else {
$return_error = "No password was entered.";
}
} else {
$return_error = "No username was entered.";
}
} else {
$return_error = "Registrations are disabled.";
}
}
"Сам кусок регистрации"
Ошибка начинается с первой строки...
+2
СообщениеСМС = Перечисления.СостоянияСообщенияSMS.Исходящее;
Для каждого СообщениеСМС Из СообщениеSMS.Услуги Цикл
СообщениеСМС.СостояниеСообщения = Перечисления.СостоянияСообщенияSMS.Исходящее;
КонецЦикла;
1С:Медицина. Поликлинка
+2
ТекЧас = Строка(Час(Дата2));
ТекЧас = Прав("00" + ТекЧас, 2);
ТекМин = Строка(Минута(Дата2));
ТекМин = Прав("00" + ТекМин, 2);
ТекВремя = ТекЧас + ":" + ТекМин;
Это способ получить время в формате "чч:мм" из даты и времени (переменная Дата2).
Заменяется этим:
ТекВремя = Формат(Дата2, "ДФ=hh:mm");
+1
;;; the toplevel operators of each equation in the system
;;; type : array[term]
(defmacro match-acz-state-methods (state__) `(svref ,state__ 0))
;;; functional terms
;;; type : array[term]
(defmacro match-acz-state-lhs-f (state__) `(svref ,state__ 1))
;;; variables on the LHS
;;; type : array[term]
(defmacro match-acz-state-lhs-v (state__) `(svref ,state__ 2))
;;; contants on the RHS
;;; type : array[term]
(defmacro match-acz-state-rhs-c (state__) `(svref ,state__ 3))
;;; functional terms on RHS
;;; type : array[term]
(defmacro match-acz-state-rhs-f (state__) `(svref ,state__ 4))
;;; notes repeated functional terms of LHS
;;; type : array[bool]
(defmacro match-acz-state-lhs-f-r (state__) `(svref ,state__ 5))
;;; notes repeated variables of LHS
;;; type : array[bool]
(defmacro match-acz-state-lhs-v-r (state__) `(svref ,state__ 6))
;;; notes repeated constants of RHS
;;; type : array[bool]
(defmacro match-acz-state-rhs-c-r (state__) `(svref ,state__ 7))
;;; notes repreated funcational terms of RHS
;;; type : array[bool]
(defmacro match-acz-state-rhs-f-r (state__) `(svref ,state__ 8))
;;; variables and funs acocunted for by RHS-c-sol
;;; type : fixnum
(defmacro match-acz-state-lhs-mask (state__) `(svref ,state__ 9))
;;; funs accounted for by RHS-c-sol
;;; type : fixnum
(defmacro match-acz-state-lhs-f-mask (state__) `(svref ,state__ 10))
;;; bit vector of all repeated (> 0) terms on LHS
(defmacro match-acz-state-lhs-r-mask (state__) `(svref ,state__ 11))
;;; solution matrix for constants
;;; type : array[fixnum]
(defmacro match-acz-state-rhs-c-sol (state__) `(svref ,state__ 12 ))
;;; max value of elements of RHS-C-sol
;;; type : fixnum
(defmacro match-acz-state-rhs-c-max (state__) `(svref ,state__ 13))
;;; solutions matrix; functional terms
;;; type : array[fixnum]
(defmacro match-acz-state-rhs-f-sol (state__) `(svref ,state__ 14))
;;; max value of elements of RHS-f-sol
;;; type : fixnum
(defmacro match-acz-state-rhs-f-max (state__) `(svref ,state__ 15))
;;; type : fixnum 11111 ... 1111
(defmacro match-acz-state-rhs-full-bits (state__) `(svref ,state__ 16))
;;; array of compatibility bitvectors; constants
;;; type : array[fixnum]
(defmacro match-acz-state-rhs-c-compat (state__) `(svref ,state__ 17))
;;; array of compatibility bitvectors; funcs
;;; type : array[fixnum]
(defmacro match-acz-state-rhs-f-compat (state__) `(svref ,state__ 18))
;;; number of constants on LHS after simplification
;;; type : fixnum
(defmacro match-acz-state-lhs-c-count (state__) `(svref ,state__ 19))
;;; number of functions on LHS after simplification
;;; type : fixnum
(defmacro match-acz-state-lhs-f-count (state__) `(svref ,state__ 20))
;;; number of variables on LHS after simplification
;;; type : fixnum
(defmacro match-acz-state-lhs-v-count (state__) `(svref ,state__ 21))
;;; number of constants on RHS after simplification
;;; type : fixnum
(defmacro match-acz-state-rhs-c-count (state__) `(svref ,state__ 22))
;;; number of functions on RHS after simplification
;;; type : fixnum
(defmacro match-acz-state-rhs-f-count (state__) `(svref ,state__ 23))
;;; t iff all solutions have been reported.
(defmacro match-acz-state-no-more (state__) `(svref ,state__ 24))
https://github.com/CafeOBJ/cafeobj/blob/master/chaos/e-match/match-acz.lisp
0
class Cat {
constructor(
public name: string) {
}
toCoolCat(coolness: number): CoolCat {
return new CoolCat(this.name, coolness);
}
}
// ...
class CoolCat extends Cat {
constructor(
name: string,
public coolness: number) {
super(name);
}
}
//...
function addCoolCat(coolness: number, cat: Cat): void {
this.coolCats.push(cat.toCoolCat(coolness);
}
//...
addCoolCat(80, {name: 'Greycat'});
Вроде TypeScript, а на самом деле NotCompletelyTypeScript.
Во время выполнения получим ошибку "cat.toCoolCat is not a function". Тем не менее, компилятор TypeScript позволяет это (а конкретно, строку 23) скомпилировать. Хотелось бы, чтобы не позволял.