- 1
- 2
- 3
Политота.
Ребята, девчонки и петухи. Завтра будем голосовать, выбирать себе хозяина еще на 4 года. У кого какие соображение на этот счет?
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−27
Политота.
Ребята, девчонки и петухи. Завтра будем голосовать, выбирать себе хозяина еще на 4 года. У кого какие соображение на этот счет?
−4
if ($memberInfo['member_profile_image'] != ''):
$memberInfo['photoCount'] = $memberInfo['photoCount'] ;
else:
$memberInfo['photoCount'] = $memberInfo['photoCount'];
endif;
6 строчек кода, а этот код не делает ничего. От слова совсем
−1
public function syncStock() {
$locked = file_exists(__DIR__ . '/lock/gk_sync_stock');
if ($locked) {
$this->logger->log("Attempt to sync locked stock");
return;
}
file_put_contents(__DIR__ . '/lock/gk_sync_stock', current_time('mysql'));
$changed = $this->_syncStock();
unlink(__DIR__ . '/lock/gk_sync_stock');
$this->logger->log("Sync stock complete, $changed changed");
}
Тут может произойти дедлок, или ни один из синхронных запросов не выполнится?
−2
assert exec("from my_runtime_analyze_lib import do_amazing_magic") or True
if __name__ == '__main__':
do_smth()
assert do_amazing_magic()
do_smth_else()
Как вхерачить в код любую ересь для dev окружения, а потом отключить на продакшене. Только не забыть бы на проде при запуске флаг оптимизации.
−1
Antony Polukhin
in
pro.cxx
Кстати, в EWG одобрили constexpr контейнеры http://open-std.org/JTC1/SC22/WG21/docs/papers/2018/p0784r1.html
так что есть все шансы к С++20 писать:
constexpr std::string result = foo();
t.me/ProCxx
/184343
Mar 16 at 10:47
Library pragmatism
Current implementations of standard libraries sometimes perform various raw storage operations through interfaces other than the standard allocator and allocator traits. That may make it difficult to make the associated components usable in constexpr components. Based on a cursory examination of current practices, we therefore propose to start only with the requirement that the container templates in the [containers] clause be usable in constexpr evaluation, when instantiated over literal types and the default allocator. In particular, this excludes std::string, std::variant, and various other allocating components. Again, it is our hope we will be able to extend support to more components in the future.
With regards to the default allocator and allocator traits implementation, the majority of the work is envisioned in the constexpr evaluator: It will recognize those specific components and implement their members directly (without necessarily regarding the library definition).
We might, however, consider decorating the class members with the constexpr keyword. Also, some implementations provide extra members in these class templates (such as libc++'s allocator_traits<A>::__construct_forward ) that perform non-constexpr-friendly operations (memcpy, in particular). Lifting such members to standard status would help interoperability between library and compiler implementations.
−5
Внимание!
Сегодня день числа Пи.
Давайте все дружно поздравим 3.14159265дара 14 марта в 1:59:27
+2
Pyhton 2:
>>> (2**54/1) + 10 - 10 == 2**54
True
>>> (2**64/1) + 10 == 2**64
False
Pyhton 3:
>>> (2**54/1) + 10 - 10 == 2**54
False
>>> (2**64/1) + 10 == 2**64
True
Pyhton 2: https://ideone.com/iqwl8L
Pyhton 3: https://ideone.com/ltG9Fq
Ну охуеть теперь.
x + 10 - 10 != x в общем случае - это норма?
Я всё понимаю - тяжёлое детство, инты, прибитые к железу, но на кой чёрт в современных интерпретируемых языках такое говнище?
0
public function insert(array $data)
{
$hstoreData = array();
if (isset($data['description'])) {
$hstoreData['description'] = $data['description'];
unset($data['description']);
}
if (isset($data['developer'])) {
$hstoreData['developer'] = $data['developer'];
unset($data['developer']);
}
if (isset($data['localizer'])) {
$hstoreData['localizer'] = $data['localizer'];
unset($data['localizer']);
}
if (isset($data['gameplay_video'])) {
$hstoreData['gameplay_video'] = $data['gameplay_video'];
unset($data['gameplay_video']);
}
if (isset($data['news_community_id'])) {
$hstoreData['news_community_id'] = $data['news_community_id'];
unset($data['news_community_id']);
}
if (isset($data['bg_color'])) {
$hstoreData['bg_color'] = $data['bg_color'];
unset($data['bg_color']);
}
if (isset($data['bg_image'])) {
$hstoreData['bg_image'] = $data['bg_image'];
unset($data['bg_image']);
}
if (isset($data['bg_link'])) {
$hstoreData['bg_link'] = $data['bg_link'];
unset($data['bg_link']);
}
$result = parent::insert($data);
$this->updateByID($result, $hstoreData);
return $result;
}
Это зачем, интересно?
+1
#!/usr/bin/env escript
%% -*- erlang -*-
%%! -smp enable -debug verbose
-include_lib("xmerl/include/xmerl.hrl").
-export([main/1, install_mod/1]).
-record(mod_info, { name :: string()
, links :: [{file:filepath(), file:filepath()}]
}).
main(Args) ->
[ModeDir, GameDir] = Args,
VirtualInstall = filename:absname(ModeDir ++ "/VirtualInstall/"),
RealPath = filename:absname(GameDir),
VirtualModCfg = VirtualInstall ++ "/VirtualModConfig.xml",
io:format( "Mode dir: ~p~n"
"Install dir: ~p~n"
"Current dir: ~p~n"
, [VirtualInstall, RealPath, element(2, file:get_cwd())]),
{Doc, []} = xmerl_scan:file(VirtualModCfg),
Mods = get_mods(VirtualInstall, RealPath, Doc),
[install_mod(I) || I <- Mods],
ok.
get_mods(VirtPath, RealPath, Doc) ->
[ #mod_info
{ name = xpath("/modInfo/@modName", Mod)
, links = get_links(VirtPath, RealPath, Mod)
}
|| Mod <- xmerl_xpath:string( "/virtualModActivator/modList/modInfo"
, Doc)].
get_links(VirtPath, RealPath, Doc) ->
[{ filename:absname( unixify(xpath("/fileLink/@realPath", FL))
, VirtPath)
, filename:absname( unixify(xpath("/fileLink/@virtualPath", FL))
, RealPath)
}
|| FL <- xmerl_xpath:string( "//fileLink[isActive = 'True']"
, Doc)].
xpath(Query, Doc) ->
case xmerl_xpath:string(Query, Doc) of
[#xmlAttribute{value = Val}] ->
Val
end.
unixify(Path) ->
lists:map(
fun($\\) -> $/;
(A) -> A
end,
Path).
install_mod(#mod_info{name = Name, links = Links}) ->
io:format("Installing ~s...~n", [Name]),
lists:foreach(
fun({From, To}) ->
filelib:ensure_dir(To),
file:make_symlink(From, To)
end,
Links).
+6
https://www.opennet.ru/opennews/art.shtml?num=48234
Создатели редактора кода Atom из компании GitHub развивают новый
экспериментальный текстовый редактор Xray, который также построен
с использованием фреймворка Electron, но примечателен тем, что для
повышения надёжности и производительности ядро редактора с
реализацией базовой логики написано на языке Rust, интерфейс
оформлен на JavaScript/CSS с применением фреймворка React, а для
отрисовки текста применяется WebGL.
Чем вообще руководствуются люди, делающие IDE из кусков браузера? Нахрена там JavaScript/CSS, нахрена там React? Еще и Rust приплели зачем-то.
Может это чтоб всякие фронтенд-разрабы возрадовались, потому что теперь их умение писать хуиту на жабаскрипте применимо для написания говноплагинов к этой хуите? А как же бекенд? Пусть дополнительно встроят туда PHP MySQL чтоб никто не ушел обиженным.