1. Лучший говнокод

    В номинации:
    За время:
  2. JavaScript / Говнокод #1376

    +146

    1. 1
    2. 2
    3. 3
    4. 4
    function refreshPage() {
     //alert(document.location);
     document.location = document.location;
    }

    Стырена с моего мира mail.ru

    guest, 16 Июля 2009

    Комментарии (1)
  3. Java / Говнокод #1362

    +146

    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
    /**
             * @see java.lang.Comparable#compareTo(java.lang.Object)
             */
            public int compareTo( HandValue pValue ) throws NullPointerException
            {
                    if(getCategory() == null || pValue.getCategory() == null || mTopCards == null)                
                            throw new NullPointerException();
                    
                    int toReturn = getCategory().compareTo(pValue.getCategory());
                    
                    if(toReturn != 0)
                            return toReturn;
                   
                    for(int i = 0; getCard(i) != null; i++)
                    {
                            toReturn = getCard(i).compareTo(pValue.getCard(i));
                            
                            if(toReturn != 0)
                                    return toReturn;
                    }
                    
                    return 0;
            }

    очень долго смеялся, увидев этот код.

    guest, 12 Июля 2009

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

    +146

    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
    <?php
    $link="http://cert.vatsim.net/cert/vatsimnet/idstatus.php?cid=111111";
    $contents = file_get_contents($link);
    
    if ($contents!=FALSE) {
    
        $xml = simplexml_load_string($contents);
    
        $output = "<code>".$contents."</code><br>LAST NAME: ".$xml->user->name_last;
        $output.="<br>EMAIL: ".$xml->user->email;
        
        return $output;
    }
    else {
        return "FAILED";
    }
    ?>

    Парсерчег XML статов из сети ВАТСИМ

    guest, 08 Июля 2009

    Комментарии (1)
  5. Куча / Говнокод #1320

    +146

    1. 1
    Товарищ, помни! Выкладывание кода сюда скорее всего нарушает права на интеллектуальную собственность твоего белого господина!

    guest, 03 Июля 2009

    Комментарии (5)
  6. PHP / Говнокод #1263

    +146

    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
    <?php
    
    class db {
    
    function db_conn ($host,$user,$pass,$db) {
    	if(!($this->link = @mysqli_connect($host,$user,$pass)))
    		{
    		echo "<font color=\"red\">Error:</font> connect to host: $host";
    		//exit();
    		}
    	if(!mysqli_select_db($this->link,$db))
    		{
    		echo "<font color=\"red\">Error:</font> select database $db";
    		exit();
    		}
    	return $this->link;
    	}
    
    function sql_query ($query) {
    	
    	$result = mysqli_query($this->link, $query);
    		if (!$result)
    			{
    			$this->error_msg = mysqli_error ($result);
    			return $this->error_msg;
    			}
    	return $result;
    	}
    
    function sql_fetch_assoc ($query) {
    		$res=$this->sql_query($query);
    		//$array = array();
    		$row = mysqli_fetch_array($res);
    		mysqli_free_result($res);
    		return $row;
    	}
    }
    
    ?>

    guest, 26 Июня 2009

    Комментарии (0)
  7. Pascal / Говнокод #1258

    +146

    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
    unit Unit2;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, Mask, DBCtrls, DB, DBTables, Grids, DBGrids;
    
    type
      TForm_magnituda = class(TForm)
        DataSource2: TDataSource;
        Table1: TTable;
        Label1: TLabel;
        Label2: TLabel;
        Button1: TButton;
        Button2: TButton;
        DBGrid1: TDBGrid;
        Table1Id: TStringField;
        Table1Data: TStringField;
        Table1Shirota: TStringField;
        Table1Dolgota: TStringField;
        Table1Magnituda: TStringField;
        Table1Glubina: TStringField;
        Table1Bal: TStringField;
        Table1Local: TStringField;
        procedure Button1Click(Sender: TObject);
        procedure Button2Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form_magnituda: TForm_magnituda;
    
    implementation
    uses unit1;
    {$R *.dfm}
    
    procedure TForm_magnituda.Button1Click(Sender: TObject);
    begin
    form1.show;
    form_magnituda.Hide;
    end;
    
    procedure TForm_magnituda.Button2Click(Sender: TObject);
    begin
    form_magnituda.Table1.Append;
    end;
    
    end.

    guest, 25 Июня 2009

    Комментарии (0)
  8. Куча / Говнокод #1195

    +146

    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
    (
     define
     (
      lazy-reader
      reader
     )
     (
      lambda
      (
       port
      )
      (
       make-lazy-list1
       (
        lambda
        (
        )
        
        (
         let
         (
          (
           it
           (
            reader
            port
           )
          )
         )
         (
          if
          (
           eof-object?
           it
          )
          '
          (
          )
          it
         )
        )
       )
      )
     )
    )

    Идиотское форматирование в Scheme

    guest, 12 Июня 2009

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

    +146

    1. 1
    ++$i--;

    операция "передёргивания"

    guest, 03 Июня 2009

    Комментарии (3)
  10. Куча / Говнокод #1091

    +146

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    #import "Hehe.h"
    
    @implementation Hehe
    - (IBAction)click {
        [textArea setText:(@"Hello World!")];
    }
    @end

    Objective-C =) Помойму самый красивый ейзык =)

    guest, 26 Мая 2009

    Комментарии (0)
  11. Си / Говнокод #914

    +146

    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
    #include <stdio.h>
    #include <ctype.h>
    
    unsigned int wordsCount(const char *str);
    
    int main(int argc, char *argv[]) {
    	char *chr;
    	if(argc != 2)
    		return 255;
    
    	puts(argv[1]);
    
    	if(wordsCount(argv[1]) > 1) {
    		chr = argv[1];
    		while(*chr) {
    			if (*chr == '*')
    				*chr = '3';
    			
    			if (*chr == '+')
    				*chr = '1';
    
    			if (*chr == '-')
    				*chr = '2';
    
    			chr++;
    		}
    	}
    	puts(argv[1]);
    	
    	return 0;
    }
    
    unsigned int wordsCount(const char *str) {
    	unsigned int wordsCount = 0;
    	char isWord = 0;
    
    	while(*str) {
    		if(isalpha(*str)) {
    			isWord = 1;
    		} else if(isWord) {
    			wordsCount++;
    			isWord = 0;
    		}
    		str++;
    	}
    	
    	if(isWord)
    		wordsCount++;
    
    	return wordsCount;
    }

    guest, 21 Апреля 2009

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