- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
Make Sean moan
Worship Carrie's feet
Bind Amy to Saint Andrew's Cross
Have Amy hogtie Sean
If Amy is Carrie's bitch
Make Slave scream Sean's name
Make Sean moan
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+1
Make Sean moan
Worship Carrie's feet
Bind Amy to Saint Andrew's Cross
Have Amy hogtie Sean
If Amy is Carrie's bitch
Make Slave scream Sean's name
Make Sean moan
https://github.com/Property404/fetlang
+1
function xhr(method, url, async, user, password) {
let r = new XMLHttpRequest();
r.open(method, url, async, user, password);
r.timeout = 10;
}
Аффтар данной конструкции задаёт типа загадку:
"Есть у нас обертка над XMLHttpRequest. Отгадайте что может пойти не так?"
Ссыль: https://pikabu.ru/story/zagadka_po_js_5383775
ps. Учи стандарты JS фокусник!
+1
#include <iostream>
#include <restinho/all.hpp>
int main()
{
restinho::http_server_t<> http_server{
restinho::create_child_io_context(1),
[](auto & settings) {
settings.port(8080).address("localhost")
.request_handler([](auto req) {
req->create_response().set_body("answer").done();
return restinho::request_accepted();
});
}};
http_server.open();
std::cin.ignore();
http_server.close();
return 0;
}
https://habrahabr.ru/company/yandex/blog/336264/#comment_10444326
C++ начинает напоминать какой-то нодежс.
+1
https://github.com/ruby/ruby/blob/trunk/parse.y
Как распарсить Руби код.
+1
(* /*
C > /) 2> /dev/null & echo hello world!; exit
* This file is correct input for:
* sh, cc, pc, f77
*/ main(program)) { puts("hello world!"); /*
*) program main(output);begin writeln('hello world!')end. {
write( *, '("hello world!")')
end
*/ return &program; }
Bash: https://ideone.com/HKy5RJ
C: https://ideone.com/KFbJsK
Pascal (fpc): https://ideone.com/4zcc51
+1
(*a/*/ % #)(PostScript)/Helvetica 40 selectfont 9 400 moveto show%v"f"a0
true showpage quit%#) 2>/dev/null;echo bash;exit #*/);int main()/*>"eb"v
%a*0)unless print"perl\n"__END__*/{printf("C\n");/*>>#;"egnu">:#,_@;,,,<
*)begin writeln(*\output={\setbox0=\box255}\eject\shipout\hbox{\TeX}\end
*)('pascal');end.{*/return 0;}
C: https://ideone.com/Ntu3S0
Pascal (fpc): https://ideone.com/A9qZ0x
Bash: https://ideone.com/TYr7cu
Perl: https://ideone.com/fAUhiv
+1
(*O/*_/
Cu #%* )pop mark/CuG 4 def/# 2 def%%%%@@P[TX---P\P_SXPY!Ex(mx2ex("SX!Ex4P)Ex=
CuG #%* *+Ex=
CuG #%*------------------------------------------------------------------*+Ex=
CuG #%* POLYGLOT - a program in eight languages 15 February 1991 *+Ex=
CuG #%* 10th Anniversary Edition 1 December 2001 *+Ex=
CuG #%* *+Ex=
CuG #%* Written by Kevin Bungard, Peter Lisle, and Chris Tham *+Ex=
CuG #%* *+Ex=
CuG #%* Polyglot suports the following languages: *+Ex=
CuG #%* 1. COBOL (ANSI) *+Ex=
CuG #%* 2. Pascal (ISO) *+Ex=
CuG #%* 3. Fortran (ANSI, f77) *+Ex=
CuG #%* 4. C (ANSI-ish) *+Ex=
CuG #%* 5. PostScript *+Ex=
CuG #%* 6. Linux/Unix shell script (bash, sh, csh) *+Ex=
CuG #%* 7. x86 machine language (MS-DOS, Win32, Linux) *+Ex=
CuG #%* 8. Perl (version 5) *+Ex=
CuG #%* *+Ex=
CuG #%* Usage: *+Ex=
CuG #%* 1. Rename this file to polyglot.[cob|pas|f77|c|ps|sh|com|pl] *+Ex=
CuG #%* *+Ex=
CuG #%* 2. Compile and run with your favorite compiler and operating *+Ex=
CuG #%* system. *+Ex=
CuG #%* *+Ex=
CuG #%* Notes: *+Ex=
CuG #%* 1. We have attempted to use only standard language features. *+Ex=
CuG #%* *+Ex=
CuG #%* 2. Without the -traditional flag gcc will issue a warning. *+Ex=
CuG #%* *+Ex=
CuG #%* 3. When transferring from Unix to DOS make sure that a LF *+Ex=
CuG #%* is correctly translated into a CR/LF. *+Ex=
CuG #%* *+Ex=
CuG #%* 4. Keep the black lines at the start of the program. They *+Ex=
CuG #%* are important. *+Ex=
CuG #%* *+Ex=
CuG #%* 5. This text is a comment block in all eight languages. *+Ex=
CuG #%* *+Ex=
CuG #%* Please mail any comments, corrections or additions to *+Ex=
CuG #%* [email protected] *+Ex=
CuG #%* *+Ex=
CuG #%*------------------------------------------------------------------*QuZ=
CuG #%* *+Ex=
CuG #%*!Mx)ExQX5ZZ5SSP5n*5X!)Ex+ExPQXH,B+ExP[-9A-9B(g?(gA'UTTER_XYZZXX!X *+
CuG #(* *(
C # */); /*(
C # *) program polyglot (output); (*+
C # identification division.
C # program-id. polyglot.
C #
C # data division.
C # procedure division.
C #
C # * ))cleartomark /Bookman-Demi findfont 36 scalefont setfont (
C # * (
C #
C # * hello polyglots$
C # main.
C # perform
C /# * ) 2>_$$; echo "hello polyglots"; rm _$$; exit;
C # * (
C #
C *0 ) unless print "hello polyglots\n"; __END__
print
C stop run.
-*, 'hello polyglots'
C
C print.
C display "hello polyglots". (
C */ int i; /*
C */ main () { /*
C */ i=printf ("hello polyglots\n"); O= &i; return *O; /*
C *) (*
C *) begin (*
C *) writeln ('hello polyglots'); (*
C *) (* )
C * ) pop 60 360 (
C * ) pop moveto (hello polyglots) show (
C * ) pop showpage ((
C *)
end .(* )
C)pop% program polyglot. *){*/}
C: https://ideone.com/LzLeJH
Pascal (gpc): https://ideone.com/J7VAQk
Perl: https://ideone.com/AmODLG
К сожалению, не все языки удалось проверить имеющимися интерпретаторами/компиляторами.
+1
#ifdef _MSC_VER
# if ( _MSC_VER <= 1800) // MSVC 2012 / 2013
typedef std::vector<char>& vector_ref;
# else
typedef std::vector<char>&& vector_ref;
# endif
#else
typedef std::vector<char>&& vector_ref;
#endif
auto func = std::bind([this](vector_ref v) { /* ... */ }, std::placeholders::_1);
тут говна вагон и маленькая тележка
Во-первых, версии студии, компилятора студии и _MSC_VER всегда разные. Сложно даже представить человека который решил "а давайте распространять компилятор по версии SDK, а проверять по левому числу, не являющемуся ни тем ни другим?"
Во-вторых, поддержка c++11 в msvc 2012/2013 удручает. В 2012 нет даже type aliases, потому и typedef.
В-третьих, кривая реализация bind (rvalue-версия не соберется в студиях 12/13, lvalue - в более поздних).
+1
$parent = (new \yii\db\Query())
->select(['parent','parent_1','parent_2'])
->from('user')
->where(['id' => "$user_id",])
->all();
$sum_for_parent = (new \yii\db\Query())
->select(['first_parent'])
->from('referal_control')
->all();
$sum_for_parent = $sum_for_parent[0]['first_parent'];
$sum_for_parent_1 = (new \yii\db\Query())
->select(['second_parent'])
->from('referal_control')
->all();
$sum_for_parent_1 = $sum_for_parent_1[0]['second_parent'];
$sum_for_parent_2 = (new \yii\db\Query())
->select(['third_parent'])
->from('referal_control')
->all();
$sum_for_parent_2 = $sum_for_parent_2[0]['third_parent'];
Обращение к одной записи к 3-м полям через три запроса
+1
<?
if(!$_POST){//mpre("Не аякс запрос");
}elseif(!$name = mpquot(get($_POST, 'name'))){mpre("Регистрационное имя не указано");
}elseif(!$pass = get($_POST, 'pass')){mpre("Пароль для регистрации не указан");
}elseif(get($_POST, 'pass') != get($_POST, 'pass2')){mpre("Пароли не совпадают");
}elseif($users = rb("{$conf['db']['prefix']}users","name","[{$name}]")){mpre("Пользователь уже зарегистрирован");
}elseif(!$sess = get($conf, 'user', 'sess')){mpre("Ошибка полученя сессии текущего пользователя");
}elseif(!$mphash = mphash($name, $pass)){mpre("Ошибка генерации пароля");
}elseif(!$users = fk("{$conf['db']['prefix']}users", $w = array("name"=>$name), $w += array("type_id"=>1, "pass"=>$mphash, "reg_time"=>time(), "last_time"=>time(), "email"=>get($_POST, 'email'), "ref"=>get($conf, 'user', 'sess', 'ref'), "refer"=>get($conf, 'user', 'sess', 'refer')))){mpre("Ошибка регистрации пользователя");
}elseif(!$grp = get($conf, 'settings', 'user_grp')){mpre("Ошибка определения пользовательской группы");
}elseif(!$users_grp = rb("users-grp", "name",$w = "[{$grp}]")){mpre("Ошибка выборки группы {$w}");
}elseif(!$users_mem = fk("users-mem", $w = ["uid"=>$users['id'], "grp_id"=>$users_grp['id']], $w)){mpre("Ошибка добавления пользователя `{$users["name"]}` в группу '{$users_grp["name"]}'");
}elseif(!$sess = fk("{$conf['db']['prefix']}sess", ["id"=>$sess["id"]], null, ['uid'=>$users["id"]])){mpre("Ошибка обновления сессии пользователя");
}else{ mpevent("Регистрация нового пользователя", $name, $users['id'], $_POST);
exit(json_encode($users));
}
Страница регистрации