- 1
(*items)[item] += 1;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+49
(*items)[item] += 1;
указатель на map + operator[]
такое
+78
public void initializeMap() {
for(Point p: getPoints()) {
{
Address address = p.getAddress();
LatLng position = new LatLng(address.getLatitude(), address.getLongitude());
//...
} // (2)
for (Item item : items) {
Address address = item.getAddress();
LatLng position = new LatLng(address.getLatitude(), address.getLongitude());
//...
}
}
}
автору лень придумывать вменяемые имена переменных, для кода ниже. по сему, он просто оборачивает верний код в новый блок и вуаля - можно реюзать те самые имена.
не совсем уверен говнокод ли это, но как минимум это - глупо.
+157
foreach($arDataToCsv[$i] as $key => $value)
{
if ($key == 'birth_date' && $value != 'Логин' && $value != '0000-00-00')
{
$date = new DateTime($value);
$value = $date->format('d.m.Y');
}
if ($key == 'birth_date' && $value != 'Логин' && $value == '0000-00-00')
$value = '01.01.0001';
if ($key == 'firstname' && $value == '')
$value = 'Undefined';
if ($key == 'lastname' && $value == '')
$value = 'Undefined';
$arDataToCsv[$i][$key] = iconv(mb_detect_encoding($value), "CP1251", $value);
}
Чувак обрабатывает данные перед записью в csv.
+159
var existingDates=new Array();
existingDates[11]=new Array();
existingDates[11][3]=[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28];
existingDates[11][4]=[3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,19,21,22,23,24,25,26,28,29,30,31];
existingDates[11][5]=[1,2,4,5,6,7,8,9,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30];
existingDates[11][6]=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31];
existingDates[11][7]=[1,2,3,4,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31];
existingDates[11][8]=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30];
existingDates[11][9]=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31];
existingDates[11][10]=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30];
existingDates[11][11]=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31];
/*... */
existingDates[24][1]=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28];
existingDates[24][2]=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31];
existingDates[24][3]=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30];
existingDates[24][4]=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31];
existingDates[24][5]=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30];
existingDates[24][6]=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31];
existingDates[24][7]=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31];
existingDates[24][8]=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30];
existingDates[24][9]=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31];
existingDates[24][10]=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30];
existingDates[24][11]=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31];
existingDates[25]=new Array();
existingDates[25][0]=[5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31];
existingDates[25][1]=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28];
existingDates[25][2]=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31];
existingDates[25][3]=[1];
/* ... */
Src: http://www.kommersant.ru/archive/news/77/2015-04-01
+139
...
// GRAY SCALE:
#define ER_COLOR_BLACK_DEEP3 ccc3(0, 0, 0)
#define ER_COLOR_BLACK_DEEP4 ccc4(0, 0, 0, 255)
#define ER_COLOR_BLACK3 ccc3(38, 38, 38)
#define ER_COLOR_BLACK4 ccc4(38, 38, 38, 255)
#define ER_COLOR_SIDEMENU_SELECTED3 ccc3(47, 47, 47)
#define ER_COLOR_LETTER_VIEW3 ccc3(51, 51, 51)
#define ER_COLOR_SIDEBAR_BG3 ccc3(58, 58, 58)
#define ER_COLOR_SIDEBAR_BG4 ccc4(58, 58, 58, 255)
#define ER_COLOR_BAR_BG_GRAY3 ccc3(82, 82, 82)
#define ER_COLOR_AUTHOR_NAME3 ccc3(103, 103, 103)
#define ER_COLOR_SIDE_WIDGET3 ccc3(255, 255, 255)
#define ER_COLOR_SIDE_WIDGET4 ccc4(255, 255, 255, 255)
#define ER_COLOR_GRAY_TUT3 ccc3(115, 115, 115)
#define ER_COLOR_GRAY3 ccc3(130, 130, 130)
#define ER_COLOR_PULL_LABEL3 ccc3(142, 142, 142)
#define ER_COLOR_SEND_BG4 ccc4(158, 158, 158, 255)
#define ER_COLOR_SEND_BG3 ccc3(158, 158, 158)
#define ER_COLOR_BADGE_GRAY3 ccc3(149, 149, 149)
#define ER_COLOR_BADGE_GRAY4 ccc4(149, 149, 149, 255)
#define ER_COLOR_SEPARATOR3 ccc3(195, 195, 195)
#define ER_COLOR_LABELS_GRAY3 ccc3(170, 170, 170)
#define ER_COLOR_AUTHOR_CAPTION3 ccc3(173, 173, 173)
#define ER_COLOR_SAFE_EXIT_BG4 ccc4(189, 189, 189, 255)
#define ER_COLOR_SAFE_EXIT_BG3 ccc3(189, 189, 189)
#define ER_COLOR_MENU_GRAY_ONE3 ccc3(204, 204, 204)
#define ER_COLOR_PUSHED_ELEMENT3 ccc3(205, 205, 205)
#define ER_COLOR_GRAY_208_3 ccc3(208, 208, 208)
#define ER_COLOR_GRAY_208_4 ccc4(208, 208, 208, 255)
#define ER_COLOR_MENU_GRAY_TWO3 ccc3(216, 216, 216)
#define ER_COLOR_NEW_GAME_BACK3 ccc3(216, 216, 216)
#define ER_COLOR_NEW_GAME_BACK4 ccc4(216, 216, 216, 255)
#define ER_COLOR_WHITE_222_3 ccc3(222, 222, 222)
#define ER_COLOR_WHITE_232_3 ccc3(232, 232, 232)
#define ER_COLOR_WHITE_MY_PLATE3 ccc3(243, 243, 243)
#define ER_COLOR_WHITE_INTRO4 ccc4(232, 232, 232, 255)
#define ER_COLOR_WHITE3 ccc3(255, 255, 255)
#define ER_COLOR_WHITE4 ccc4(255, 255, 255, 255)
50 оттенков серого в нашем приложении.
−403
if (indexPath.row == 0) {
if (![centerViewController isKindOfClass:[T7DUserInfoViewController class]]) {
T7DUserInfoViewController *userViewController = [[T7DUserInfoViewController alloc] init];
[navigationController popViewControllerAnimated:NO];
[navigationController pushViewController:userViewController animated:NO];
}
}
if (indexPath.row == 1) {
if (![centerViewController isKindOfClass:[T7DMapViewController class]]) {
T7DMapViewController *mapViewController = [[T7DMapViewController alloc] init];
[navigationController popViewControllerAnimated:NO];
[navigationController pushViewController:mapViewController animated:NO];
}
}
if (indexPath.row == 2) {
if (![centerViewController isKindOfClass:[T7DOrderListViewController class]]) {
T7DOrderListViewController *orderListViewController = [[T7DOrderListViewController alloc] init];
[navigationController popViewControllerAnimated:NO];
[navigationController pushViewController:orderListViewController animated:NO];
}
}
if (indexPath.row == 3) {
if (![centerViewController isKindOfClass:[T7DCurrentOrderViewController class]]) {
T7DCurrentOrderViewController *orderViewController = [[T7DCurrentOrderViewController alloc] init];
[orderViewController setOrderType:T7DOrderTypeCurrent];
[orderViewController setOrder:[T7DOrder currentOrder]];
[navigationController popViewControllerAnimated:NO];
[navigationController pushViewController:orderViewController animated:NO];
}
}
if (indexPath.row == 4) {
if (![centerViewController isKindOfClass:[T7DMessagesViewController class]]) {
T7DMessagesViewController *messagesViewConroller = [[T7DMessagesViewController alloc] init];
[navigationController popViewControllerAnimated:NO];
[navigationController pushViewController:messagesViewConroller animated:NO];
}
}
if (indexPath.row == 5) {
[self logout];
return;
}
Мудаки.
+59
int getObjectsCount() const { ... }
...
void restoreObjects()
{
...
const unsigned int objectsCount = restoreInt();
assert(objectsCount == objects.getObjectsCount());
...
}
Ансайнд, туда и обратно
+137
for (i = 1; i < argc; i++) {
p = argv[i];
if ((*p != '-') && (*p != '/'))
{
printf("Unknown option %s\n", p);
return 1;
}
p++;
if (strncmp(p, "pcir=", 5) == 0)
{
sscanf(p+5, "%lli", &pci_raddr);
opt |= 1;
}
if (strncmp(p, "pciw=", 5) == 0)
{
sscanf(p+5, "%lli", &pci_waddr);
opt |= 2;
}
if (strncmp(p, "rwlen=", 6) == 0)
sscanf(p+6, "%i", &rwlen);
if (strncmp(p, "count=", 6) == 0)
sscanf(p+6, "%i", &count);
if (strncmp(p, "ch=", 3) == 0)
channel = p+3;
if (strncmp(p, "poll", 4) == 0)
poll = 1;
if (strncmp(p, "fpga_read=", 10) == 0)
{
sscanf(p+10, "%i", &offset);
fpga_read_flag = 1;
}
if (strncmp(p, "fpga_write=", 11) == 0)
{
sscanf(p+11, "%i", &offset);
fpga_write_flag = 1;
}
if (strncmp(p, "data=", 5) == 0)
{
sscanf(p+5, "%i", &data);
data_valid = 1;
}
if (strncmp(p, "dump_to_file=", 13) == 0)
{
filename = p+13;
dump_to_file = 1;
}
if (strncmp(p, "loadnios", 8) == 0)
{
filename = p+8;
load_nios = 1;
}
if (strncmp(p, "DUMP", 4) == 0) // -DUMP
dump = 1;
if (strncmp(p, "flash_read", 10) == 0) // -flash_read
{
flash_read_flag = 1;
}
if (strncmp(p, "file_to_flash", 13) == 0) // -file_to_flash
file_to_flash = 1;
if (strncmp(p, "file=", 5) == 0) // -file
{
fname = p+5;
}
if (strncmp(p, "base=", 5) == 0) // -base
{
sscanf(p+5, "%i", &base);
basevalid = 1;
}
if (strncmp(p, "card=", 5) == 0) // -crd
sscanf(p+5, "%i", &card);
if (strncmp(p, "ver", 3) == 0)
ver = 1;
if (strncmp(p, "dev=", 4) == 0) // -deм
dev = p+4;
}
"А я напишу свой собственный комманд лайн парсер, с хуитой и говном"
+157
var times, source_date,
date = "20.11.2014";
if (date) {
times = date.split('.');
source_date = new Date();
source_date.setFullYear(parseInt(times[2]));
source_date.setMonth(parseInt(times[1]) - 1);
source_date.setDate(parseInt(times[0]));
}
return source_date ;
+166
public function isRequisitesCorrect()
{
switch (true) {
case $this->isRequisitesSigned() :
return true;
default:
return false;
}
}