- 1
- 2
- 3
- 4
- 5
- 6
catch (com.google.gwt.event.shared.UmbrellaException ex) {
Iterator<Throwable> it = ex.getCauses().iterator();
while (it.hasNext()) {
Throwable msg = it.next();
System.out.println(msg.getStackTrace());
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+66
catch (com.google.gwt.event.shared.UmbrellaException ex) {
Iterator<Throwable> it = ex.getCauses().iterator();
while (it.hasNext()) {
Throwable msg = it.next();
System.out.println(msg.getStackTrace());
}
обрабатываем exception......
+70
if(rightTable.isCellPresent(0, 0))
for(int i = 0; i < rightTable.getRowCount(); i++)
if(((CheckBox)((HorizontalPanel)rightTable.getWidget(i, 0)).getWidget(0)).getValue())
{ isChanged = true;
leftTableList.add(currentTemplate.getColumns().get(i));
for(int j = 0; j < resultTable.getCellCount(0); j++)
if(((Label)((HorizontalPanel)resultTable.getWidget(0, j)).getWidget(1)).getText().compareTo(new Integer(currentTemplate.getColumns().get(i).getOrder()).toString()) == 0)
resultTable.removeCell(0, j);
System.out.println(resultTable.getCellCount(0));
rightTable.removeRow(i);
currentTemplate.getColumns().remove(i);
i--;
}
+78
private function isRussianCar($car){
# Определялка российских машин.
if ($car['make_id'] == '107') return true;
if ($car['make_id'] == '108') return true;
if ($car['make_id'] == '109') return true;
if ($car['make_id'] == '110') return true;
if ($car['make_id'] == '111') return true;
if ($car['make_id'] == '112') return true;
if ($car['make_id'] == '113') return true;
if ($car['make_id'] == '114') return true;
if ($car['make_id'] == '115') return true;
if ($car['make_id'] == '116') return true;
if ($car['make_id'] == '117') return true;
return false;
}
Нашёл в одном из проектов
+71
$template_archive_footer = stripslashes(get_option('poll_template_pollarchivefooter'));
$template_archive_footer = str_replace("%POLL_START_DATE%", $poll_start_date, $template_archive_footer);
$template_archive_footer = str_replace("%POLL_END_DATE%", $poll_end_date, $template_archive_footer);
$template_archive_footer = str_replace("%POLL_TOTALVOTES%", number_format_i18n($polls_question['totalvotes']), $template_archive_footer);
$template_archive_footer = str_replace("%POLL_TOTALVOTERS%", number_format_i18n($polls_question['totalvoters']), $template_archive_footer);
$template_archive_footer = str_replace("%POLL_MOST_ANSWER%", $poll_most_answer, $template_archive_footer);
$template_archive_footer = str_replace("%POLL_MOST_VOTES%", number_format_i18n($poll_most_votes), $template_archive_footer);
$template_archive_footer = str_replace("%POLL_MOST_PERCENTAGE%", $poll_most_percentage, $template_archive_footer);
$template_archive_footer = str_replace("%POLL_LEAST_ANSWER%", $poll_least_answer, $template_archive_footer);
$template_archive_footer = str_replace("%POLL_LEAST_VOTES%", number_format_i18n($poll_least_votes), $template_archive_footer);
$template_archive_footer = str_replace("%POLL_LEAST_PERCENTAGE%", $poll_least_percentage, $template_archive_footer);
wp-polls. пиздец.
+62
if($col == "#eeeeee"){
$col = "#ffffff";
}else{
$col = "#eeeeee";
}
Нашел на просторах интернета скрипт, а в нем вот это. $col нигде не присваивается.
+58
if ($who == 'student') $answerArray['student_id'] = $this->people->id;
if ($who == 'teacher') $answerArray['teacher_id'] = $this->people->id;
if ($who == 'student') $answerArray['student_text'] = $post_array['message'];
if ($who == 'teacher') $answerArray['teacher_text'] = $post_array['message'];
if ($who == 'student') $answerArray['student_date'] = date('Y-m-d H:i:s');
if ($who == 'teacher') $answerArray['teacher_date'] = date('Y-m-d H:i:s');
if ($who == 'student' && $files) $answerArray['student_file'] = $files[0]['name'];
if ($who == 'teacher' && $files) $answerArray['teacher_file'] = $files[0]['name'];
if ($who == 'student' && $files) $answerArray['student_file_orig_name'] = $files[0]['orig_name'];
if ($who == 'teacher' && $files) $answerArray['teacher_file_orig_name'] = $files[0]['orig_name'];
if ($who == 'student') $answerArray['status'] = 0;
if ($who == 'teacher') $answerArray['status'] = 1;
Обнаружил в корпоративном коде. )
+71
/**
* Get the river's access where clause
*
* @return string
* @since 1.8.0
* @access private
*/
function elgg_river_get_access_sql() {
// rewrite default access where clause to work with river table
return str_replace("and enabled='yes'", '',
str_replace('owner_guid', 'rv.subject_guid',
str_replace('access_id', 'rv.access_id', get_access_sql_suffix())));
}
Кусок из ядра фремворка Elgg, Sql запрос подправляется с помощью str_replace
+93
if (indSpec == false || indZone == false || (FRof != null && FRof == 2)) result = 1;
Нашли в проекте вот такое "женское" условие. Видимо, префиксом "ind" автор намекала на своё происхождение.
+105
if (wasteClass != null && wasteClass == 5)
Все же знают, что целочисленные переменные бывают равны null и 5 одновременно.
+116
IsAutoUpdate ? 1.ToString() : 0.ToString()
Практически классика.