- 1
openDialog.addEventListener(Dialog.CLOSE_DIALOG, eventCloseOpenDialog);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−105
openDialog.addEventListener(Dialog.CLOSE_DIALOG, eventCloseOpenDialog);
Если причитаться конечно понятно что оно делает, но при первом взгляде просто вводит в ступор.
+168
if ($sum == 30) {
return 24;
} else {
return $sum * 0.8;
}
+160
function bigplus(){
$args = func_get_args();
$maxlength = 0;
$mlkey = 0;
$inmind = 0;
foreach($args as $key=>$arg){
$args[$key] = array_reverse(str_split($arg));
$length = count($args[$key]);
if($maxlength<$length){
$maxlength = $length;
$mlkey = $key;
}
}
for($pos=0; $pos<$maxlength; $pos++){
$c = 0;
for($i=0; $i<count($args); $i++){
if(!isset($args[$i][$pos])){
$args[$i][$pos]=0;
}
$c+=$args[$i][$pos];
}
$args[0][$pos] = $c+$inmind;
$inmind = floor(($args[0][$pos])/10);
$args[0][$pos] %= 10;
}
if($inmind>0){
$args[0][] = $inmind;
}
return implode(array_reverse($args[0]));
}
Народ, знаю что говнокод, помогите советом как исправить?
Функция выводит результат сложения любого числа положительных чисел произвольной длины.
Не придумал ничего умнее, чем реализовать сложение "в столбик".
+135
<div class="block_container s3 b-text b-static-text user_css_130018946673 user_css_130028521958 user_css_130028524445 user_css_130028527350 user_css_130028529275 user_css_130028546858 user_css_13002855067 user_css_13002855515 user_css_130028558859 user_css_130028563869 user_css_130028573655 user_css_130028575861 user_css_130028716271 " id="e_130012850667">
С одного narod'овского сайта на готовом шаблоне. Я на измене.
−87
index_photo = ThumbnailField(
verbose_name=_('Photo in catalog'),
upload_to='uploads/girls/index/',
size=(172, 253),
help_text=_('This photo is shown in a list of girls. Size 172x252.'))
Кажется кто-то кого-то пытается обмануть
+166
class r{
r(const r&);
r& operator=(const r&);
public:
r(){}
template<class t>
r& operator,(t *v){
return this->operator<<(*v);
}
template<class t>
r& operator<<(t &o){
crash_if_fail(dynamic_cast<const void*>(&o));
int l = 0;
int n = 0, n_ = sizeof(o) / sizeof(void*);
while (n < n_){
void **a = *((void***)&o + n++);
if (IsBadReadPtr(a, sizeof(void*)) || is_stack(a)){
continue;
}
int c = 0;
void *d = a[c];
while (is_code_segment__(d)){
print_info(&l, o, n, d, c, a);
d = a[++c];
}
}
return *this;
}
template<class t>
void print_info(int *l, const t &o, int n, void *d, int c, void **a){
if (!*l){
puts("///////////////////////////////////////////////////");
printf("object address %p\n", &o);
*l = 1;
}
if (!c){
puts("-=-=-=-=-=-=-=-=-=-");
printf("%15.1s%p:__vfptr %p\n", "+", ((char*)((void***)&o + n - 1)) - (char*)&o, a);
}
printf("%32.p\n", d);
}
};
+161
// Подходы различной национальности
/* Первый */
function filesize_format($bytes, $format = '', $force = ''){
$force = strtoupper($force);
$defaultFormat = '%01d %s';
if (strlen($format) == 0)
$format = $defaultFormat;
$bytes = max(0, (int) $bytes);
$units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB');
$power = array_search($force, $units);
if ($power === false)
$power = $bytes > 0 ? floor(log($bytes, 1024)) : 0;
return sprintf($format, $bytes / pow(1024, $power), $units[$power]);
}
/* Второй */
function files_size( $size )
{
$name = array('Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
$mysize = $size ? round( $size / pow(1024, ( $i = floor( log( $size, 1024 ) ) ) ), 2) .' ' .$name[$i] : $size.' Bytes';
return $mysize;
}
/* Третий */
function humanSize($size) {
$a = array("bytes", "kb", "Mb", "Gb", "Tb", "Pb");
$pos = 0;
while ($size >= 1024) {
$size /= 1024;
$pos++;
}
return round($size,2)." ".$a[$pos];
}
Вопрос: Определите географические координаты места написания каждого...
+120
public void PauseCheck(int x)
{
for (int i = 0; i < (x / 10); i++)
{
Thread.Sleep(10);
}
}
+72
public class MyActivity extends Activity {
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.content_layout_id);
final CheckBox checkBox = (CheckBox) findViewById(R.id.checkbox_id);
if (checkBox.isChecked()) {
checkBox.setChecked(false);
}
}
}
+163
if(empty($value)) {
$empty_colls++;
$value = $value = str_replace(" ", "", $value);
} else {
$haystack=mb_convert_encoding($format_value, 'UTF-8', mb_detect_encoding($format_value));
$needle=mb_convert_encoding('грн', "windows-1251", "UTF-8");
if (strpos($haystack, $needle)) $currency='грн';
else {
$needle=mb_convert_encoding('€', "windows-1251", "UTF-8");
if (strpos($haystack, $needle)) $currency= '€';
else {
$needle=mb_convert_encoding('$USD', "windows-1251", "UTF-8");
if (strpos($haystack, $needle)) $currency='USD';
}
}
$value = mb_convert_encoding($value,"UTF-8", mb_detect_encoding($value));
...
}
Даже не знаю с чего больше смеяться/плакать (исходники в UTF-8) :-)