- 1
{% for item in object.items %}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
0
{% for item in object.items %}
Внезапно выяснилось, что ебаная жинжа пытается не делает object['items'], а сначала ищет метод items().
0
$('.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('Точно?');
});
<label class="checkboxwrap">
<input type="checkbox" class="checkbox">
Husband
</label>
+2
Админ, добавь язык "J".
Я собираюсь начать учить этот язык и пейсать на нём говнокоды.
Давайте пейсать в коменты кому ещё что нужно.
+2
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)
−1
# Чтение файла в "Python":
with open("suka") as blyat:
govno = blyat.read()
// Чтение файла в "PHP":
$govno = file_get_contents("suka");
Почему нету способа в одну функцию, и нужно добавлять лишнюю вложенность?
Это какой-то пиздец.
−1
if (userSettingsErrorType != null && userSettingsErrorType.getError() != null &&
userSettingsErrorType.getError().getMessage() != null && userSettingsErrorType.getError().getMessage().getName() != null &&
userSettingsErrorType.getError().getMessage().getName().length != 0) {
try {
getView().ifPresent(v -> v.setFieldErrorMessage(SettingsField.NAME,
userSettingsErrorType.getError().getMessage().getName()[0]));
} catch (Exception e) {
Crashlytics.logException(e);
}
}
наткнулся на сие чудо во время рефакторинга.
0
real life
0
static int Z2(bool[,] m, int X, int Y)
{
int count = 0;
int
x_ = Max(0, X - 1),
_x = Min(5, X + 1),
y_ = Max(0, Y - 1),
_y = Min(5, Y + 1);
for (int x = x_; x <= _x; x++)
for (int y = y_; y <= _y; y++)
if (m[x, y]) ++count;
if (m[X, Y]) --count;
return count;
}
Когда-то давно на олимпиаде искал таким образом на матрице M[6x6] количество зафлагованных соседей для элемента M[x,y].
+1
Вы такого еще не видали
https://paste.ubuntu.com/p/gpsMVPnd6T/
Отформатировано: https://paste.ubuntu.com/p/vF8hCGN6Z3/
20 уровней индентации, адовый копипаст.
0
integers =: adverb def 'i.u'
5 integers
0 1 2 3 4
plus =: adverb def '(}:u) + {:u'
2 3 plus
5
1 2 3 1 plus
2 3 4
inc =: adverb def '(u , 1) plus'
5 inc
6
5 integers inc
1 2 3 4 5
factorial =: integers inc product
0 factorial
1
7 factorial
5040
Так то лучше, а то надоело справа налево писать.