- 1
- 2
- 3
if(memberIdList == null || memberIdList.size() < 0) {
return setOfThousandMembers;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+143
if(memberIdList == null || memberIdList.size() < 0) {
return setOfThousandMembers;
}
+144
10 MEDIAN=0
15 FOR Q=1 TO 10000 REM Lifes
20 TOTAL=0 REM Money
25 FOR I=1 TO 100
30 M=RND
35 IF M<0.5 THEN N=INT(10*RND)
40 IF M>=0.5 THEN N=-INT(10*RND)
45 TOTAL=TOTAL+N
50 NEXT I
55 MEDIAN=MEDIAN+TOTAL
60 PRINT Q,"MEDIAN="MEDIAN/Q
65 NEXT Q
GW-BASIC
"Жизнь по генератору случайных чисел: стратегия успеха"
автор: Евгений Золотов
+170
header("HTTP/1.1 404 OK");
+142
<?php
class ModelCheckoutOrder extends Model {
public function addOrder($data) {
$this->event->trigger('pre.order.add', $data);
$this->db->query("INSERT INTO `" . DB_PREFIX . "order` SET invoice_prefix = '" . $this->db->escape($data['invoice_prefix']) . "', store_id = '" . (int)$data['store_id'] . "', store_name = '" . $this->db->escape($data['store_name']) . "', store_url = '" . $this->db->escape($data['store_url']) . "', customer_id = '" . (int)$data['customer_id'] . "', customer_group_id = '" . (int)$data['customer_group_id'] . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', custom_field = '" . $this->db->escape(isset($data['custom_field']) ? serialize($data['custom_field']) : '') . "', payment_firstname = '" . $this->db->escape($data['payment_firstname']) . "', payment_lastname = '" . $this->db->escape($data['payment_lastname']) . "', payment_company = '" . $this->db->escape($data['payment_company']) . "', payment_address_1 = '" . $this->db->escape($data['payment_address_1']) . "', payment_address_2 = '" . $this->db->escape($data['payment_address_2']) . "', payment_city = '" . $this->db->escape($data['payment_city']) . "', payment_postcode = '" . $this->db->escape($data['payment_postcode']) . "', payment_country = '" . $this->db->escape($data['payment_country']) . "', payment_country_id = '" . (int)$data['payment_country_id'] . "', payment_zone = '" . $this->db->escape($data['payment_zone']) . "', payment_zone_id = '" . (int)$data['payment_zone_id'] . "', payment_address_format = '" . $this->db->escape($data['payment_address_format']) . "', payment_custom_field = '" . $this->db->escape(isset($data['payment_custom_field']) ? serialize($data['payment_custom_field']) : '') . "', payment_method = '" . $this->db->escape($data['payment_method']) . "', payment_code = '" . $this->db->escape($data['payment_code']) . "', shipping_firstname = '" . $this->db->escape($data['shipping_firstname']) . "', shipping_lastname = '" . $this->db->escape($data['shipping_lastname']) . "', shipping_company = '" . $this->db->escape($data['shipping_company']) . "', shipping_address_1 = '" . $this->db->escape($data['shipping_address_1']) . "', shipping_address_2 = '" . $this->db->escape($data['shipping_address_2']) . "', shipping_city = '" . $this->db->escape($data['shipping_city']) . "', shipping_postcode = '" . $this->db->escape($data['shipping_postcode']) . "', shipping_country = '" . $this->db->escape($data['shipping_country']) . "', shipping_country_id = '" . (int)$data['shipping_country_id'] . "', shipping_zone = '" . $this->db->escape($data['shipping_zone']) . "', shipping_zone_id = '" . (int)$data['shipping_zone_id'] . "', shipping_address_format = '" . $this->db->escape($data['shipping_address_format']) . "', shipping_custom_field = '" . $this->db->escape(isset($data['shipping_custom_field']) ? serialize($data['shipping_custom_field']) : '') . "', shipping_method = '" . $this->db->escape($data['shipping_method']) . "', shipping_code = '" . $this->db->escape($data['shipping_code']) . "', comment = '" . $this->db->escape($data['comment']) . "', total = '" . (float)$data['total'] . "', affiliate_id = '" . (int)$data['affiliate_id'] . "', commission = '" . (float)$data['commission'] . "', marketing_id = '" . (int)$data['marketing_id'] . "', tracking = '" . $this->db->escape($data['tracking']) . "', language_id = '" . (int)$data['language_id'] . "', currency_id = '" . (int)$data['currency_id'] . "', currency_code = '" . $this->db->escape($data['currency_code']) . "', currency_value = '" . (float)$data['currency_value'] . "', ip = '" . $this->db->escape($data['ip']) . "', forwarded_ip = '" . $this->db->escape($data['forwarded_ip']) . "', user_agent = '" . $this->db->escape($data['user_agent']) . "', accept_language = '" . $this->db->escape($data['accept_language']) . "', date_added = NOW(), date_modified = NOW()");
Я вас еще немного помучаю, хорошо?
3978 символов, считая отступы
https://github.com/opencart/opencart/blob/d5f66b0d75a5adf35815e333e45598bbc38750d0/upload/catalog/model/checkout/order.php#L6
+147
void Write_Char(char ch)
{
switch(ch)
{
case 'a':
{
set_mode_data;
set_db4_0;
set_db5_1;
set_db6_1;
set_db7_0;
strobe();
set_mode_data;
set_db4_1;
set_db5_0;
set_db6_0;
set_db7_0;
strobe();
return;
}
case 'b':
{
set_mode_data;
set_db4_0;
set_db5_1;
set_db6_1;
set_db7_0;
strobe();
set_mode_data;
set_db4_0;
set_db5_1;
set_db6_0;
set_db7_0;
strobe();
return;
}
case 'c':
{
set_mode_data;
set_db4_0;
set_db5_1;
set_db6_1;
set_db7_0;
strobe();
set_mode_data;
set_db4_1;
set_db5_1;
set_db6_0;
set_db7_0;
strobe();
return;
}
case 'd':
{
set_mode_data;
set_db4_0;
set_db5_1;
set_db6_1;
set_db7_0;
strobe();
set_mode_data;
set_db4_0;
set_db5_0;
set_db6_1;
set_db7_0;
strobe();
return;
}
case 'e':
{
set_mode_data;
set_db4_0;
set_db5_1;
set_db6_1;
set_db7_0;
strobe();
set_mode_data;
set_db4_1;
set_db5_0;
set_db6_1;
set_db7_0;
strobe();
return;
}
case 'f':
{ set_mode_data;
set_db4_0;
set_db5_1;
set_db6_1;
set_db7_0;
strobe();
set_mode_data;
set_db4_0;
set_db5_1;
set_db6_1;
set_db7_0;
strobe();
return;
}
//еще ~800 строк.
Ну почему тут только 100 строк можно вводить? Я хочу поделиться этим со всем миром, ведь это так легко - наговнокодить на Си.(из программы общения с дисплеем hd44780 для STM32)
+142
if ((subchannel == undefined || "none") && (subsubchannel == undefined || "none")) {
subchannel = channel;
subsubchannel = subchannel;
} else if ((subchannel != undefined || "none") && (subsubchannel == undefined || "none")) {
subsubchannel = subchannel;
} else if ((subchannel == undefined || "none") && (subsubchannel != undefined || "none")) {
subchannel = channel;
} else {
subchannel = subchannel;
channel = channel;
}
Скопировал из похожего проекта не глядя, и потом удевляюсь что херня получается. А там ведь как-то работает, бля...
+142
#include <inttypes.h>
#include <stdio.h>
typedef union
{
struct
{
#define BITG(n) uint8_t bit##n : 1
BITG(0);
BITG(1);
BITG(2);
BITG(3);
BITG(4);
BITG(5);
BITG(6);
BITG(7);
#undef BITG
} bits;
uint8_t value;
}getbit;
uint8_t bit_sum(uint8_t, uint8_t);
uint8_t bit_sum(uint8_t a, uint8_t b)
{
getbit op1, op2, opr;
uint8_t carry;
op1.value=a; op2.value=b;
#define OP1(n) op1.bits.bit##n
#define OP2(n) op2.bits.bit##n
#define OPR(n) opr.bits.bit##n
#define XOR(a,b) ((a)^(b))
#define AND(a,b) ((a)&(b))
OPR(0) = XOR(OP1(0), OP2(0));
carry = AND(OP1(0), OP2(0));
#define SETBIT(n) \
OPR(n) = XOR \
( \
carry, \
XOR(OP1(n), OP2(n)) \
);
#define CARRYBIT(n) \
carry = XOR \
( \
AND(OP1(n), OP2(n)), \
AND \
( \
XOR(OP1(n), OP2(n)), \
carry \
) \
);
SETBIT(1);
CARRYBIT(1);
SETBIT(2);
CARRYBIT(2);
SETBIT(3);
CARRYBIT(3);
SETBIT(4);
CARRYBIT(4);
SETBIT(5);
CARRYBIT(5);
SETBIT(6);
CARRYBIT(6);
SETBIT(7);
return opr.value;
#undef SETBIT
#undef CARRYBIT
#undef OP1
#undef OP2
#undef OPR
#undef XOR
#undef AND
}
int main (int argc, char *argv[], char *envp[])
{
uint8_t a, b, c;
scanf ("%"SCNu8"%"SCNu8, &a, &b);
c = bit_sum(a,b);
printf("%"PRIu8"\n", c);
return 0;
}
Побитовое сложение двух 8-битных чисел по схеме двоичного сумматора
+135
Кажется сбылась чья-то мечта. Калькулятор на чистом css
http://habrahabr.ru/company/paysto/blog/255511/
http://experiments.hertzen.com/css3calculator/
+890
Int64 iObjectId;
public Int64 ObjectId
{
get { return iObjectId; }
set {
if (iObjectId == null) { value = 0; } else value = iObjectId;
}
}
Помимо того, что условие (iObjectId == null) никогда не выполняется, сеттер еще и делает свойство ObjectId фактически readonly.
(Авторское форматирование кода сохранено.)
−124
if __name__ == "__main__":
def f():
pass
Динамичненько