-
Лучший говнокод
- В номинации:
-
- За время:
-
-
+2
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
// https://godbolt.org/z/dMT7v3
unsigned div_eq(unsigned a, unsigned b)
{
ALWAYS_TRUE(a == b);
return a/b;
}
unsigned div(unsigned a, unsigned b)
{
return a/b;
}
int test_array(unsigned char a[10])
{
for (int i = 1; i < 10; i++)
{
ALWAYS_TRUE(a[i-1] <= a[i]);
}
return a[0] <= a[2];
}
Refinement type
Можно этой хуйней ассерты позаменять попробовать, и компилятор возможно что-то сможет за счет этого соптимизировать
j123123,
26 Октября 2019
-
−1
- 1
- 2
- 3
- 4
ВЫРАЗИТЬ(ВЫРАЗИТЬ(РасчетыСКлиентамиОстатки.ЗаказКлиента КАК Документ.РеализацияТоваровУслуг).ЗаказКлиента КАК Документ.ЗаказКлиента) КАК ЗаказКлиента
Типично
Конфигурация 1С ERP Украина.
ChoaNyan,
11 Сентября 2019
-
0
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
// где-то в классе MyTable
public next() {
if (this.firstVisibleRow + this.currentRow < this.sortedData.length) {
this.firstVisibleRow = this.firstVisibleRow + this.currentRow;
}
this.sortTable();
}
public prev() {
if (this.firstVisibleRow - this.currentRow > 0) {
this.firstVisibleRow = this.firstVisibleRow - this.currentRow;
} else {
this.firstVisibleRow = 0;
}
this.sortTable();
}
public sortTable() {
this.sortedData.forEach((item, index) => {
for (let i = this.firstVisibleRow; i < (this.firstVisibleRow + this.currentRow); i++) {
if (i === index) {
this.visiblilityList[index] = true;
return;
}
}
this.visiblilityList[index] = false;
});
}
Коллега не прекращает удивлять )
Код компонента Таблица для Vue.
Кажется, в этом коде прекрасно всё.
Обратите внимание, как красиво выполняется метод sortTable.
Здесь visiblilityList используется для определения какие ряды в таблице нужно рисовать при пагинации. Про существование переменных page и rowsPerPage не слышал.
Удивительно, но это говно работает!
Планируем нашему коллеге по итогам года подарить грамоту "Качественный говнокод года" )
igpo,
09 Августа 2019
-
−2
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
SELECT country, QTY, MIN(launched)
FROM (SELECT country, launched, COUNT(name) QTY
FROM Classes c JOIN
Ships s ON c.class = s.class
GROUP BY country,launched
HAVING COUNT(name) = (SELECT MAX(qty)
FROM (SELECT country,launched,COUNT(name) qty
FROM Classes c1 JOIN
Ships s1 ON c1.class = s1.class
WHERE country = c.country
GROUP BY country,launched
)e
)
)T
GROUP BY t.qty, t.country;
-2 sql ex rating
я так понял необходимо ещё как-то добавить проверку на NULL?
5252mmr,
20 Мая 2019
-
+3
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
<?php
$css_fold = 'css/';
$js_fold = 'js/';
$css_files= scandir($css_fold);
$js_files= scandir($js_fold);
foreach ($js_files as $js_file) {
if(preg_match('/\.(js)/', $js_file)){
if (substr($js_file, -3)==".js") {
echo'<script src="js/'.$js_file.'"></script>'.PHP_EOL;
}
}
}
foreach ($css_files as $css_file) {
if(preg_match('/\.(css)/', $css_file)){
if (substr($css_file, -4)==".css") {
echo'<link rel="stylesheet" type="text/css" href="css/'.$css_file.'">'.PHP_EOL;
}
}
}
?>
Подтягиваем все из css и js
ZombiePm,
17 Мая 2019
-
0
- 1
- 2
- 3
https://habr.com/ru/post/448810/
Уж слишком анскильно )))
Не удивлюсь, если сам Юра - автор статьи.
AHCKuJlbHblu_nemyx,
20 Апреля 2019
-
0
- 1
- 2
fuse_blown() ->
whereis(?marker_process) =/= undefined.
Q: Какой механизм IPC в Erlang самый быстрый и безопасный?
Отвечает Снаут, основатель Стиля Вечно Ждущего Процесса: process registry.
CHayT,
17 Апреля 2019
-
0
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
$('.checkboxwrap').on('mousedown',e => {
if($(e.target)[0].tagName == 'LABEL' && $(e.target).children('input').prop('checked') || $(e.target)[0].tagName == 'INPUT' && $(e.target).prop('checked')){
conf($(e.target));
} else {
console.log(12)
}
});
function conf(e){
let check = confirm('Точно?'),
input = $('.checkboxwrap input');
if(e[0].tagName == 'LABEL'){
if(check) {
input.eq($('label').index(e)).prop('checked',false);
console.log(13)
} else {
input.eq($('label').index(e)).prop('checked',true);
}
}
else{
if(check) {
input.eq($('input').index(e)).prop('checked',false);
console.log(14)
} else {
input.eq($('input').index(e)).prop('checked',true);
}
}
}
Автор скрипта написал, что не во всех браузерах работает... наверно ожидал, что ещё добавят!
А тут...
$(".checkbox").on("change", ({ target }) => {
if(!target.checked)
target.checked = !confirm('Точно?');
});
Однако!
P. S. Скрипт к таким фрагментам...
<label class="checkboxwrap">
<input type="checkbox" class="checkbox">
Husband
</label>
unicorn,
30 Марта 2019
-
+2
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
private bool IsOsTurn()
{
if (turn.Text.Equals(oString))
return true;
return false;
}
private bool ADiagonalIsSame()
{
if (LeftToRightDiagonalIsSame()) { return true; }
if (RightToLeftDiagonalIsSame()) { return true; }
return false;
}
private bool IsAWin()
{
if (ARowIsSame() || AColumnIsSame() || ADiagonalIsSame())
return true;
else return false;
}
Взято из кода "крестики-нолики", работающем через DataGridView // <- да, это изврат!
Такое чувство, что автор сука не умеет работать с булевыми значениями.
Удивлен, что не встретил что-то вроде:
if (turn.Text.Equals(oString) == true)
groser,
28 Марта 2019
-
−1
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
@charset "UTF-8";
/*!
* 文件名称:Hui.css
* 文件版本:Version 0.3.4 2016-05-18
* 文件作者:新生帝
* 编写日期:2016年04月15日
* 版权所有:中山赢友网络科技有限公司
* 企业官网:http://www.winu.net
* 开源协议:MIT License
* 文件描述:一切从简,只为了更懒!
* 讨论群区:一起改变中国IT教育 18863883
* 开源地址:https://git.oschina.net/winu.net/Hui.git
*/
3_15dar,
02 Марта 2019