- 1
https://github.com/kagami-ryuuji/kuroneko
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−4
https://github.com/kagami-ryuuji/kuroneko
По просьбам пользователей
+2
Searching 43077 files for "PROPERTY_96"
D:\OpenServer\domains\aproject.local\public_html\bitrix\templates\aproject\components\aproject\catalog.section\list\template.php:
19 // говнокод, говнокодом не испортить :)
20 $itSitno = 0;
21: if ($arElement['PROPERTY_96'] > 0)
22 {
23 $itSitno = 1;
замечательный проект.. Искал тут свойство в интернет магазине (типа макдака), которое отвечает за тип добавки к заказу (соус, мясо, и т.п.).
Называется это свойство вот так: PROPERTY_96 встречается в нескольких местах, в самом проекте 43077 файлов.
вообщем у меня бомбануло через 30 минут когда я его таки смог найти.
да это битрикс :(
+10
http://ideone.com/VODKA
Генерятся ж иногда адреса как надо
+923
public class AnyNotNull<T> {
public T get(T... args) {
for(T t : args) {
if (t != null)
return t;
}
return null;
}
public T getOrThrow(T... args) {
T t = get(args);
if(t == null)
throw new NullPointerException("AnyNotNull. everything is null");
return t;
}
}
класс утилита
+129
for(const auto & row : table; const auto & element : row) {
handle(element);
}
// versus
for(const auto & row : table) {
for(const auto & element : row) {
handle(element);
}
}
Всякого ненужного говна в новые крестостандарты насовали, а о простых вещах не подумали. Ну ведь удобней же было бы!
Но не-ет, нам нужна функциональщина в крестах, ведь нам мало мозгоклюйства с другими языками; а давайте засунем в стандартную библиотеку либкайро, чтобы разработчики стандартных библиотек соревновались, кто быстрее запилит частичную поддержку в 95% случаев ненужной либы полутра операционными системами, куда-ах-тах-тах!
Забавно, только что узнал, что в vs2013 есть шорткат ^ko, который переключает между заголовком и реализацией. ^ko^ko^ko
−406
Код конца 2014 года
CGSize iOSDeviceScreenSize = [[UIScreen mainScreen] bounds].size;
if (iOSDeviceScreenSize.height == 480)
isRetina = true;
else
isRetina = false;5
+80
public class лаба22 {
int i;
лаба22(int k){
i=k;}
int [] a = new int [i];
void длина(){
System.out.println(a.length);
}
public static void main(String[] args) {
лаба22 s = new лаба22(5);
s.длина();
}
}
Студеньтики... тупоголовые как и их преподы
+165
foreach ($user as $field => $value) {
if ($field == 'username') {
$user[$field] = md5($value);
}
}
Обучаю стажера, который целый год кодил на битрикс, частенько у него проскользает такой подход для обновления значений в ассоциативном массиве.
+131
module Main:
program factorial:
algorithm factorial:
description of the algorithm:
factorial of n is the algorithm that calculates the product of all the positive integers less than or equal to n.
end of description of the algorithm.
example of usage of the algorithm:
var1 is equal to call algorithm with parameter n which is equal to 5;
begin of a comment:
var1 is now1 120 = 5*4*3*2*1.
end of a comment.
end of example of usage of the algorithm.
description of author of the algorithm:
name: John.
surname: Smith.
date of writing of the algorithm: 2009.
end of description of author of the algorithm.
properties of the algorithm:
callable from other modules.
callable from this module.
can be used in expressions.
end of properties of the algorithm.
parameters of the algorithm:
data n: type is positive integer.
end of parameters of the algorithm.
variables of the algorithm:
data res: type is positive integer.
data now1: type is positive integer.
end of variables of the algorithm.
initialization of the variables of the algorithm:
res is equal to 1.
now1 is equal to n.
end of initialization of the variables of the algorithm.
begin of the algorithm:
cycle: while now1 is not 1, repeat:
res is equal to multiply res by now1.
now1 is equal to subtract 1 from now1.
end of cycle.
result of the algorithm is res
end of the algorithm.
algorithm main:
description of the algorithm:
main algorithm that shows the factorial of the inputted number.
end of description of the algorithm.
example of usage of the algorithm:
end of example of usage of the algorithm.
description of author of the algorithm:
name: John.
surname: Smith.
date of writing of the algorithm: 2009.
end of description of author of the algorithm.
properties of the algorithm:
callable from the system.
end of properties of the algorithm.
parameters of the algorithm:
data arguments: type is array of strings.
end of parameters of the algorithm.
variables of the algorithm:
end of variables of the algorithm.
initialization of the variables of the algorithm:
end of initialization of the variables of the algorithm.
begin of the algorithm:
call algorithm writeInteger with parameter str which is equal to
call algorithm factorial with parameter n which is equal to
call algorithm readInteger without parameters.
result of the algorithm is 0.
end of the algorithm.
Небольшой ответ набирающему популярность WCT. Новый язык программирования LOOOONG:
- Отступы обязательны.
- Все блоки в функциях ("алгоритмах") обязательны.
- блоки нужно записывать именно в таком порядке.
- Имена параметров необходимо помнить, когда вызываешь "алгоритм".
- Ключевых слов ОЧЕНЬ МНОГО.
−163
Если ЗначениеЗаполнено(Сделка) И ЛЕВ(Сделка.Ссылка, 10) = "Заказ пост" Тогда
//другой говнокод
КонецЕсли;
Правильная проверка типов