1. JavaScript / Говнокод #17248

    +159

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    request.done(function(data){			 
    			 if (data){
                                            <...много кода с кучей вложенных if else ..>
    				    	noty({type: "success", text: 'Заказ взят с биржи'});
    				  	setTimeout(location.reload(), 2000);
    				  }
    		   	 } else if (data.error) {
    				 console.log(data);
    				 noty({type: "error", text: data.error["message"]});				
    			 }
    	});

    i had n1ce debug time

    heyzea1, 03 Декабря 2014

    Комментарии (4)
  2. Куча / Говнокод #17247

    +135

    1. 1
    <html class=" js flexbox flexboxlegacy hashchange history rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity flash no-touch no-opera cssanimations csscolumns cssgradients no-cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio localstorage applicationcache performance mediaqueries" lang="ru-RU" xml:lang="ru-RU" style="">

    kyzi007, 03 Декабря 2014

    Комментарии (8)
  3. ActionScript / Говнокод #17246

    −84

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    public function equals(newSprite:SpriteVO): Boolean
    {
    	return (newSprite.x == this.x &&
    	newSprite.y == this.y &&
    	newSprite.width == this.width &&
    	newSprite.height == this.height &&
    	newSprite.scaleX == this.scaleX &&
    	newSprite.scaleY == this.scaleY &&
    	newSprite.rotation == this.rotation &&
    	newSprite.assetId == this.assetId &&
    	newSprite.asset == this.asset &&
    	newSprite.track == this.track &&
    	newSprite.flipped == this.flipped)
    	
    }

    Почему-то у меня есть впечатление, что люди которые пытаются писать на языке используя приемы из другого языка, это в первую очередь люди, которые не поняли оригинальную задумку в другом языке.

    wvxvw, 03 Декабря 2014

    Комментарии (7)
  4. Си / Говнокод #17245

    +136

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    int Sys_FunctionCmp(void *f1, void *f2) {
    
    	int i, j, l;
    	byte func_end[32] = {0xC3, 0x90, 0x90, 0x00};
    	byte *ptr, *ptr2;
    	byte *f1_ptr, *f2_ptr;
    
    	ptr = (byte *) f1;
    	if (*(byte *)ptr == 0xE9) {
    		//Com_Printf("f1 %p1 jmp %d\n", (int *) f1, *(int*)(ptr+1));
    		f1_ptr = (byte*)(((byte*)f1) + (*(int *)(ptr+1)) + 5);
    	}
    	else {
    		f1_ptr = ptr;
    	}
    	//Com_Printf("f1 ptr %p\n", f1_ptr);
    
    	ptr = (byte *) f2;
    	if (*(byte *)ptr == 0xE9) {
    		//Com_Printf("f2 %p jmp %d\n", (int *) f2, *(int*)(ptr+1));
    		f2_ptr = (byte*)(((byte*)f2) + (*(int *)(ptr+1)) + 5);
    	}
    	else {
    		f2_ptr = ptr;
    	}
    	//Com_Printf("f2 ptr %p\n", f2_ptr);
    
    #ifdef _DEBUG
    	sprintf((char *)func_end, "%c%c%c%c%c%c%c", 0x5F, 0x5E, 0x5B, 0x8B, 0xE5, 0x5D, 0xC3);
    #endif
    	for (i = 0; i < 1024; i++) {
    		for (j = 0; func_end[j]; j++) {
    			if (f1_ptr[i+j] != func_end[j])
    				break;
    		}
    		if (!func_end[j]) {
    			break;
    		}
    	}
    #ifdef _DEBUG
    	l = i + 7;
    #else
    	l = i + 2;
    #endif
    	//Com_Printf("function length = %d\n", l);
    
    	for (i = 0; i < l; i++) {
    		// check for a potential function call
    		if (*((byte *) &f1_ptr[i]) == 0xE8) {
    			// get the function pointers in case this really is a function call
    			ptr = (byte *) (((byte *) &f1_ptr[i]) + (*(int *) &f1_ptr[i+1])) + 5;
    			ptr2 = (byte *) (((byte *) &f2_ptr[i]) + (*(int *) &f2_ptr[i+1])) + 5;
    			// if it was a function call and both f1 and f2 call the same function
    			if (ptr == ptr2) {
    				i += 4;
    				continue;
    			}
    		}
    		if (f1_ptr[i] != f2_ptr[i])
    			return qfalse;
    	}
    	return qtrue;
    }

    Хмм...

    gost, 03 Декабря 2014

    Комментарии (5)
  5. Си / Говнокод #17244

    +132

    1. 1
    2. 2
    3. 3
    #ifndef M_PI
    #define M_PI		3.14159265358979323846f	// matches value in gcc v2 math.h
    #endif

    Сишкопроблемы.

    gost, 03 Декабря 2014

    Комментарии (15)
  6. JavaScript / Говнокод #17243

    +215

    1. 1
    if (new Boolean(false)) {

    Отвратная вещь этот new.

    3.14159265, 03 Декабря 2014

    Комментарии (63)
  7. C++ / Говнокод #17242

    +53

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    void MainWindow::on_actionHelp_triggered()
    {
        bool helpNoWritten = 0;
        QDir d(QCoreApplication::applicationDirPath()+QDir::separator()+"help");
        d.makeAbsolute();
        if (d.exists() && d.entryList(QDir::Files).size())
            helpNoWritten = !QDesktopServices::openUrl(QUrl::fromUserInput(QFileInfo(d.entryList(QDir::Files).at(0)).absoluteFilePath()));
        else
            helpNoWritten++;
        if (helpNoWritten)
            QMessageBox::warning(0,"Warning",QString::fromUtf8("Похоже документацию так никто и не написал... можете почитать исходники.\nЕсли напишете положите в папку help рядом с программой"), QString::fromUtf8("Okay..."));
    }

    Код вроде бы хороший, читается не очень да не суть... дело тут не в коде.

    kin63camapa, 03 Декабря 2014

    Комментарии (10)
  8. ActionScript / Говнокод #17241

    −85

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    public static function getItemIndex(array: Object, item: Object): int
    {
    	var result: int = -1;
    
    	if (array is Array)
    		array = new ArrayCollection(array as Array);
    
    	if (array is ArrayCollection)
    	{
    		var collection: ArrayCollection = ArrayCollection(array);
    
    		result = collection.getItemIndex(item);
    
    	/*	if (result == -1 && item is IEquals)
    		{
    			for (var index: int = 0; index < collection.length; index++)
    			{
    				var obj: Object = collection.getItemAt(index);
    
    				if (obj == item || (obj is IEquals && IEquals(item).equals(IEquals(obj))))
    				{
    					result = index;
    					break;
    				}
    			}
    		}*/
    	}
    	return result;
    }

    Душа настойчиво требовала Яву, но под рукой ничего подходящего не оказалось.

    Для тех, кто не в курсе, это очередная попытка авторов супербиблиотеки изобрести Array.indexOf.

    wvxvw, 02 Декабря 2014

    Комментарии (1)
  9. C++ / Говнокод #17240

    +58

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    
    struct t_point {
        int i,j;
    };
    #define stack_len 50000000
    long int head, tail;
    t_point *steck;
    
    // long int take_border( short int*arr, int h1, int w1, int deep ){
    long int take_border( short int*arr, int h1, int w1 ){
        long int k=0;
        //int i,j,m,n,ii,jj;
        int i,j,m,ii,n,jj;
        steck = (t_point*) malloc(tail*sizeof(t_point));
        if(! steck ){
            //ui->teDebug->setText("out of Memory");
            return 0;
        }
        {
           QFile file("buffer.dat");
           file.open(QIODevice::ReadOnly);
           unsigned int size = sizeof(t_point)* tail;
           QDataStream in(&file);   // we will serialize the data into the file
           in.readRawData((char*) steck, size );
        }
    // <...>
    }

    Это чувство когда сишник взялся писать на Qt.

    overloop, 02 Декабря 2014

    Комментарии (21)
  10. 1C / Говнокод #17239

    −124

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    Попытка
          ТекущийЭлемент = ЭлементыФормы[АктивныйРеквизит];
          ТекущийЭлемент.АктивиризоватьПоУмолчанию();
    Исключение
    КонецПопытки;

    Это прекрасно...
    Автор - кто-то из 1С-Хомнет

    Aleksandr_N, 02 Декабря 2014

    Комментарии (5)