- 1
- 2
- 3
Здравствуйте-здравствуйте, дорогие инкубаторы! С рождеством!
Самое время поздравить родных, поцеловать богомольный знак на пузе попа или искупаться в проруби.
Эх, люблю я свою работу!..
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−2
Здравствуйте-здравствуйте, дорогие инкубаторы! С рождеством!
Самое время поздравить родных, поцеловать богомольный знак на пузе попа или искупаться в проруби.
Эх, люблю я свою работу!..
Хочу, чтобы Хуйло изгнали. Нам не нужен презик-хуйло, это атавизм.
Пусть презиком будет кто-то из знатоков, например, Борис Бурда.
+3
#!/usr/bin/env escript
-mode(compile).
main(["-p"|Filenames]) ->
put(pretend, true),
main(Filenames);
main(Filenames) ->
case get(pretend) of
true -> ok;
_ -> put(pretend, false)
end,
Albums = lists:filtermap(fun parse_name/1, Filenames),
lists:foreach(fun process_album/1, Albums).
process_album({Zip, Artist, Album}) ->
Dir = filename:absname(filename:join(Artist, Album)),
case filelib:wildcard(Dir ++ "/cover.*") of
[] ->
io:format("Will create ~p~n", [Dir]),
get(pretend) orelse do_process_album(Dir, Zip, Album);
_ ->
io:format("Ignoring ~p : ~p~n", [Artist, Album])
end.
do_process_album(Dir, Zip, Album) ->
ok = filelib:ensure_dir(Dir ++ "/fake"),
0 = exec(Dir, "/usr/bin/unzip", [Zip, "-d", Dir]),
postprocess(Album, Dir).
postprocess(Album, Dir) ->
Files = filelib:wildcard(Dir ++ "/*-*[0-9]*.flac"),
lists:foreach(fun(I) -> rename_flac(Album, I) end, Files).
rename_flac(Album, OldFile) ->
Dir = filename:dirname(OldFile),
OldName = filename:basename(OldFile),
Options = [{capture, all_but_first, list}],
{ok, RE} = re:compile(Album ++ " - ([0-9]+.*\\.flac)", [unicode]),
case re:run(OldName, RE, Options) of
{match, [NewName]} ->
io:format("New name: ~p~n", [NewName]),
NewFile = filename:join(Dir, NewName),
ok = file:rename(OldFile, NewFile);
nomatch ->
ok
end.
parse_name(Filename) ->
Opts = [{capture, ['band', album], list}],
case re:run(filename:basename(Filename), "(?<band>[^-]+) - (?<album>.*)\\.zip", Opts) of
{match, [Band, Album]} ->
{true, {filename:absname(Filename), Band, Album}};
nomatch ->
false
end.
-spec exec(file:filename(), file:filename(), [string() | binary()]) -> integer().
exec(Dir, CMD, Args) ->
Port = open_port( {spawn_executable, CMD}
, [ exit_status
, binary
, stderr_to_stdout
, {args, Args}
, {cd, Dir}
, {line, 300}
]
),
collect_port_output(Port, filename:basename(CMD)).
-spec collect_port_output(port(), string()) -> integer().
collect_port_output(Port, CMD) ->
receive
{Port, {data, {_, Data}}} ->
io:format("~s: ~s~n", [CMD, Data]),
collect_port_output(Port, CMD);
{Port, {exit_status, ExitStatus}} ->
ExitStatus
end.
0
function test<T>(t: T) {
return t;
}
function main() {
print(test<number>(11), test<string>("Hello1"));
print("done.");
}
Продолжаем генерить говно... ну вот подъехали первые генерики для функций... толи еще будет гимороя :)
+1
import java.text.SimpleDateFormat;
import java.util.Date;
public class Main {
public static void main(String[] args) {
System.out.println(new SimpleDateFormat("yyyy-MM-dd").format(new Date(2022 - 1900, 0, 1, 20, 30)));
System.out.println(new SimpleDateFormat("YYYY-MM-dd").format(new Date(2022 - 1900, 0, 1, 20, 30)));
}
}
А что там у Jawa-блядей за отсос должен был случиться 1 января? Я что-то не могу воспроизвести:
https://www.programmersought.com/article/47096700076/
+3
Пиздец-оффтоп #41
#11: https://govnokod.ru/27129 https://govnokod.xyz/_27129
#12: https://govnokod.ru/27184 https://govnokod.xyz/_27184
#13: https://govnokod.ru/27286 https://govnokod.xyz/_27286
#14: https://govnokod.ru/27298 https://govnokod.xyz/_27298
#15: https://govnokod.ru/27322 https://govnokod.xyz/_27322
#16: https://govnokod.ru/27328 https://govnokod.xyz/_27328
#17: https://govnokod.ru/27346 https://govnokod.xyz/_27346
#18: https://govnokod.ru/27374 https://govnokod.xyz/_27374
#19: https://govnokod.ru/27468 https://govnokod.xyz/_27468
#20: https://govnokod.ru/27469 https://govnokod.xyz/_27469
#21: https://govnokod.ru/27479 https://govnokod.xyz/_27479
#22: https://govnokod.ru/27485 https://govnokod.xyz/_27485
#23: https://govnokod.ru/27493 https://govnokod.xyz/_27493
#24: https://govnokod.ru/27501 https://govnokod.xyz/_27501
#25: https://govnokod.ru/27521 https://govnokod.xyz/_27521
#26: https://govnokod.ru/27545 https://govnokod.xyz/_27545
#27: https://govnokod.ru/27572 https://govnokod.xyz/_27572
#28: https://govnokod.ru/27580 https://govnokod.xyz/_27580
#29: https://govnokod.ru/27738 https://govnokod.xyz/_27738
#30: https://govnokod.ru/27751 https://govnokod.xyz/_27751
#31: https://govnokod.ru/27754 https://govnokod.xyz/_27754
#32: https://govnokod.ru/27786 https://govnokod.xyz/_27786
#33: https://govnokod.ru/27801 https://govnokod.xyz/_27801
#34: https://govnokod.ru/27817 https://govnokod.xyz/_27817
#35: https://govnokod.ru/27822 https://govnokod.xyz/_27822
#36: https://govnokod.ru/27826 https://govnokod.xyz/_27826
#37: https://govnokod.ru/27827 https://govnokod.xyz/_27827
#38: https://govnokod.ru/27833 https://govnokod.xyz/_27833
#39: https://govnokod.ru/27862 https://govnokod.xyz/_27862
#40: https://govnokod.ru/27869 https://govnokod.xyz/_27869
+2
struct S { struct Inner { }; };
template<int N> struct X;
auto refl = ˆS;
auto tmpl = ˆX;
void f() {
typename [:refl:] * x; // OK: declares x to be a pointer-to-S
[:refl:] * x; // error: attempt to multiply int by x
[:refl:]::Inner i; // OK: splice as part of a nested-name-specifier
typename [:refl:]{}; // OK: default-constructs an S temporary
using T = [:refl:]; // OK: operand must be a type
struct C : [:refl:] {}; // OK: base classes are types
template [:tmpl:]<0>; // OK: names the specialization
[:tmpl:] < 0 > x; // error: attempt to compare X with 0
}
и да, это приняли.
https://lists.isocpp.org/sg7/2021/04/0226.php
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2320r0.pdf
−3
Астрологи объявили неделю getCurrentLanguageName();
−2
not' = isInfinite . (1/)
0
class Node<T> {
v: T;
k: string;
next: Node<T>;
}
function main()
{
let n = new Node<number>()
n.next = n
n.k = "Hello";
n.v = 10.0;
print("done.");
}
Вы не поверите как сложно сделать простые вещи в LLVM. встречаем рекурсивные типы :)
−1
const files = {
"main.pcg": "funcTion text print hello;startFunction text;"
};
const functions = {};
const values = {};
function startc(text) {
var code = text.trim();
let strings = code.split(";");
for(var i = 0; i < strings.length; i++) {
let currentString = strings[i];
let words = currentString.split(" ");
if(words[0].toLowerCase() == "print") {
console.log(words[1]);
};
if(words[0].toLowerCase() == "printValue") {
console.log(values[words[1]]);
};
if(words[0].toLowerCase() == "value") {
values[words[1]] = words[2];
};
if(words[0].toLowerCase() == "ws") {
values[words[1]] = new WebSocket(words[2]);
};
if(words[0].toLowerCase() == "printcycle") {
for(var i = 0; i < words[1]; i++) {
console.log(words[2]);
};
};
if(words[0].toLowerCase() == "function") {
functions[words[1]] = words[2] + " " + words[3];
};
if(words[0].toLowerCase() == "startfunction") {
startc(functions[words[1]]);
};
};
};
function start(file) {
startc(files[file]);
};