- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
function s(v: any): v is string
{
return typeof v === "string";
}
function main()
{
print(s("sss"));
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
0
function s(v: any): v is string
{
return typeof v === "string";
}
function main()
{
print(s("sss"));
}
А ты так можешь на С/C++ .. а я могу....
+4
#!/usr/bin/env instantfpc
program PrintCharTable;
const
space = ' '; { }
point = '.'; {.}
caret = '^'; {^}
vline = '|'; {│}
hline = '-'; {─}
cross = '+'; {┼}
hex_0 = ord('0');
hex_a = ord('A')-10;
function tohex(d: integer): char;
begin
if d < 10 then
tohex := chr(d+hex_0)
else
tohex := chr(d+hex_a)
end;
var
i, j: integer;
code: integer;
begin
write(space, space, vline);
for i := 0 to 15 do
write(space, point, tohex(i));
writeln;
write(hline, hline, cross);
for i := 0 to 15 do
write(hline, hline, hline);
writeln;
for i := 0 to 15 do begin
write(tohex(i), point, vline);
for j := 0 to 15 do begin
code := i * 16 + j;
if code < 32 then
write(space, caret, chr(code+64))
else if code = 127 then
write(space, caret, chr(code-64))
else
write(space, space, chr(code))
end;
writeln
end
end.
{
$ ./print_ascii.pas | iconv -f koi8-r
| .0 .1 .2 .3 .4 .5 .6 .7 .8 .9 .A .B .C .D .E .F
--+------------------------------------------------
0.| ^@ ^A ^B ^C ^D ^E ^F ^G ^H ^I ^J ^K ^L ^M ^N ^O
1.| ^P ^Q ^R ^S ^T ^U ^V ^W ^X ^Y ^Z ^[ ^\ ^] ^^ ^_
2.| ! " # $ % & ' ( ) * + , - . /
3.| 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
4.| @ A B C D E F G H I J K L M N O
5.| P Q R S T U V W X Y Z [ \ ] ^ _
6.| ` a b c d e f g h i j k l m n o
7.| p q r s t u v w x y z { | } ~ ^?
8.| ─ │ ┌ ┐ └ ┘ ├ ┤ ┬ ┴ ┼ ▀ ▄ █ ▌ ▐
9.| ░ ▒ ▓ ⌠ ■ ∙ √ ≈ ≤ ≥ ⌡ ° ² · ÷
A.| ═ ║ ╒ ё ╓ ╔ ╕ ╖ ╗ ╘ ╙ ╚ ╛ ╜ ╝ ╞
B.| ╟ ╠ ╡ Ё ╢ ╣ ╤ ╥ ╦ ╧ ╨ ╩ ╪ ╫ ╬ ©
C.| ю а б ц д е ф г х и й к л м н о
D.| п я р с т у ж в ь ы з ш э щ ч ъ
E.| Ю А Б Ц Д Е Ф Г Х И Й К Л М Н О
F.| П Я Р С Т У Ж В Ь Ы З Ш Э Щ Ч Ъ
}
Печатает таблицу нужной кодировки. Пример использования в комменте после end.
0
Три девицы вечерком
Чатились за коньячком…
Мысль у всех была ловка:
Схантить бы холостяка.
Чтобы в теле мускулистом
Был крутым специалистом,
Чтобы с опытом в айти
Лет так более пяти.
В корпорации, стартапе
Чтоб прошёл он все этапы,
Да на англицком на слоге
Пел на Хабре в своём блоге.
И в сообществе средь профи
Был желан, как кружка кофе.
Ну, короче, чтоб матёр
Был как истинный Senior.
...
https://m.habr.com/ru/post/552828/
Какое поэтство )))
0
public void startLoginService(User paramUser) {
if (paramUser != null) {
Intent intent = new Intent((Context)this, LoginService.class);
intent.putExtra("LOGIN_KEY", paramUser.getLogin());
intent.putExtra("PASSWORD_KEY", String.valueOf(paramUser.getId()));
startService(intent);
}
}
+2
def get_build_version():
"""Return the version of MSVC that was used to build Python.
For Python 2.3 and up, the version number is included in
sys.version. For earlier versions, assume the compiler is MSVC 6.
"""
prefix = "MSC v."
i = sys.version.find(prefix)
if i == -1:
return 6
i = i + len(prefix)
s, rest = sys.version[i:].split(" ", 1)
majorVersion = int(s[:-2]) - 6
if majorVersion >= 13:
# v13 was skipped and should be v14
majorVersion += 1
minorVersion = int(s[2:3]) / 10.0
# I don't think paths are affected by minor version in version 6
if majorVersion == 6:
minorVersion = 0
if majorVersion >= 6:
return majorVersion + minorVersion
# else we don't know what version of the compiler this is
return None
Определение версии конпелятора, которой был собран «CPython».
0
https://stackoverflow.com/questions/33569457/pymysql-returning-old-snapshot-values-not-rerunning-query
> Thanks. This saved my day.
> You are a hero to me, my country and the world in general. This saved my whole week. Also I did not found any other way to prevent this bug.
> Thanks a lot, this saved my day
Столкнулся с ровно такой же хуетой, как у стековерфлововца, но я делаю commit, и вижу изменения.
Кто-то скажет, что не надо было ставить "MySQL".
+2
error_logger:format("Cannot force master when other "
"node is up and is not a forced slave",[]),
Overriding leader election в случае disaster recovery это тот ещё BDSM.
−1
<?php
$i = -1;
while ($i == $i)
{
$i = $i + (1);
echo($i + "," + " ");
}
?>
KEK
−103
C++ — гниль
−2
https://sohabr.net/habr/post/424725/
https://sohabr.net/habr/post/423947/
Я не понял, жава платная или нет?