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

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

    +151

    1. 1
    $time_sh=date('Y-m-d H:i:s',  time());

    Stamm, 06 Мая 2011

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

    +132

    1. 1
    <span style="font-weight:bold"><span style="font-style:italic"><span style="text-decoration:underline"> Превед! </span></span></span>

    <b><i><u>? Не, не слышал

    jQuery, 04 Мая 2011

    Комментарии (11)
  4. C# / Говнокод #6515

    +113

    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
    public bool Read_XMl_File (XDocument Xml_Document, ref game_data Game_Data) { 
                bool Is_Success=false;          /* Captures this function's result */
    
                try { 
                    this.Xml_Data = (game_data)Game_Data;
    /*              Recursively read through entire XML Document */ 
                    Xml_Document.Root.RecursivelyProcess ( 
                        Process_Child_Element,
                        Process_Parent_Element_Open,
                        Process_Parent_Element_Close);
                    Is_Success = true;
                    }
    
                catch (Exception ex) { throw ex; }
    
                Game_Data = this.Xml_Data;    /* Pass the data back to Xml_Data */
                return Is_Success;
                }
     public static void RecursivelyProcess (
                    this XElement element,
                    Action<XElement, int> childAction,
                    Action<XElement, int> parentOpenAction,
                    Action<XElement, int> parentCloseAction) {  
                if (element == null) { throw new ArgumentNullException ("element"); } 
                element.RecursivelyProcess (0, childAction, parentOpenAction, parentCloseAction);  
                }  
    
     private static void RecursivelyProcess (  
                this XElement element,  
                int depth,  
                Action<XElement, int> childAction,  
                Action<XElement, int> parentOpenAction,  
                Action<XElement, int> parentCloseAction)  { 
     
                if (element == null)  { throw new ArgumentNullException ("element"); } 
                if (!element.HasElements) {         /* Reached the deepest child */
                    if (childAction != null) { childAction (element, depth); }  
                    }  
                else  {                             /* element has children */
                    if (parentOpenAction != null)  { parentOpenAction (element, depth); }  
                    depth++;  
                   
                    foreach (XElement child in element.Elements ())  {  
                        child.RecursivelyProcess ( depth,  childAction,  parentOpenAction,  parentCloseAction );  
                        }     
                    depth--;  
                    
                    if (parentCloseAction != null)  {  parentCloseAction (element, depth);  }
                    }  
                }
            }

    Avance, 29 Апреля 2011

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

    +130

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    <table>
      ...
      <tr>
        <td class="_r13 toggler" onclick='$("td").removeClass("selected"); $("._r13").addClass("selected")'>7</td>
        <td class="_r13 toggler" onclick='$("td").removeClass("selected"); $("._r13").addClass("selected")'>1</td>
        <td class="_r13">ПУ1</td>
        <td class="_r13">схр.</td>
        <td class="_r13">При &omega;=1; АМ=СчК</td>
        <td class="_r13">2, 4, 7, 8</td>
      </tr>
      ...
    </table>

    И так много-много раз ^^

    Surendil, 26 Апреля 2011

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

    +162

    1. 1
    2. 2
    <tr{if ($key+1)=="2" OR ($key+1)=="4" OR ($key+1)=="6" OR ($key+1)=="8" OR ($key+1)=="10" OR 
    ($key+1)=="12" OR ($key+1)=="14" OR ($key+1)=="16" OR ($key+1)=="18" OR ($key+1)=="20"} class="dark"{/if}>

    код с реального, довольно серьезного проекта) прогера называют оч толковым)

    i10k, 23 Апреля 2011

    Комментарии (11)
  7. Java / Говнокод #6360

    +74

    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
    64. 64
    public static final int TYPE_A_OK = 0;
    public static final int TYPE_R_OPEN = 1;
    public static final int TYPE_R_STOPSID = 2;
    public static final int TYPE_A_STOPSID = 3;
    //....
    public static final int TYPE_R_ALARM = 26;
    HashMap<String, Integer> typesMap = new HashMap<String, Integer>();
    
    //в конструкторе
    
    public Data() {
    typesMap.put("A_OK", TYPE_A_OK);
    typesMap.put("R_OPEN", TYPE_R_OPEN);
    typesMap.put("R_STOPSID", TYPE_R_STOPSID);
    //...
    typesMap.put("R_ALARM", TYPE_R_ALARM);
    //...
    }
    
    
    //в одном из методов
    
    public boolean processPacket(Packet pack) {
    //...
    StringTokenizer strt = new StringTokenizer(body, "\n");
    		try {
    			id = strt.nextToken();
    			sign = strt.nextToken();
    			type = typesMap.get(strt.nextToken());
    			try {
    				commBody = strt.nextToken();
    			} catch (Exception e) {
    				// System.out.println("ERR: " + id + "; " + sign + "; " + type
    				// + "; ");
    			}
    		} catch (Exception e) {
    			System.err.println(sdf.format(Calendar.getInstance().getTime()) +"packet parsing error");
    			outBody += "A_ERR\n" + e.getMessage();
    		}
    
    switch (type) {
    		case TYPE_A_OK:
    			dontsend = true;
    			break;
    		case TYPE_R_OPEN:
    			outBody = processROpen(comm);
    			break;
    		case TYPE_R_CLOSE:
    			outBody = processRClose(comm);
    			break;
    //...
    case TYPE_R_ALARM:
    			outBody = processRAlarm(comm);
    			break;
    default:
    			outBody += "A_ERR";
    			break;
    }
    //...
    if(debug)
    System.err.println(outBody);
    //...
    return true;
    }

    ява она такая. Вот так. Вынужденно-китайский код. Не умеет свич со строками работать... и не хочется с хэшем заморачиваться. А скоро типов будет больше...

    ark, 14 Апреля 2011

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

    +134

    1. 1
    2. 2
    <span id="chap">490</span>
    <img src="ch.php" style="margin-left:-5px;"> 23  </div>

    Вебкилловская капча. Это круто.
    В действии: http://webkill.ru/news/index.php?id=1
    Кстати, дизайн нравится, видно, что парень рисовать умеет.

    7ion, 13 Апреля 2011

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

    −154

    1. 1
    <img src="http://img199.imageshack.us/img199/5446/65715023.jpg" alt="">

    без комментариев))

    cdpoma, 13 Апреля 2011

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

    +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
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    [...]
    	switch (dssdev->type) {
    #ifdef CONFIG_OMAP2_DSS_DPI
    	case OMAP_DISPLAY_TYPE_DPI:
    #endif
    #ifdef CONFIG_OMAP2_DSS_RFBI
    	case OMAP_DISPLAY_TYPE_DBI:
    #endif
    #ifdef CONFIG_OMAP2_DSS_SDI
    	case OMAP_DISPLAY_TYPE_SDI:
    #endif
    #ifdef CONFIG_OMAP2_DSS_DSI
    	case OMAP_DISPLAY_TYPE_DSI:
    #endif
    #ifdef CONFIG_OMAP2_DSS_VENC
    	case OMAP_DISPLAY_TYPE_VENC:
    #endif
    #ifdef CONFIG_OMAP2_DSS_HDMI
    	case OMAP_DISPLAY_TYPE_HDMI:
    #endif
    		break;
    	default:
    		DSSERR("Support for display '%s' not compiled in.\n",
    				dssdev->name);
    		return;
    	}
    
    	switch (dssdev->type) {
    #ifdef CONFIG_OMAP2_DSS_DPI
    	case OMAP_DISPLAY_TYPE_DPI:
    		r = dpi_init_display(dssdev);
    		break;
    #endif
    #ifdef CONFIG_OMAP2_DSS_RFBI
    	case OMAP_DISPLAY_TYPE_DBI:
    		r = rfbi_init_display(dssdev);
    		break;
    #endif
    #ifdef CONFIG_OMAP2_DSS_VENC
    	case OMAP_DISPLAY_TYPE_VENC:
    		r = venc_init_display(dssdev);
    		break;
    #endif
    #ifdef CONFIG_OMAP2_DSS_SDI
    	case OMAP_DISPLAY_TYPE_SDI:
    		r = sdi_init_display(dssdev);
    		break;
    #endif
    #ifdef CONFIG_OMAP2_DSS_DSI
    	case OMAP_DISPLAY_TYPE_DSI:
    		r = dsi_init_display(dssdev);
    		break;
    #endif
    #ifdef CONFIG_OMAP2_DSS_HDMI
    	case OMAP_DISPLAY_TYPE_HDMI:
    		r = hdmi_init_display(dssdev);
    		break;
    #endif
    	default:
    		BUG();
    	}
    
    	if (r) {
    		DSSERR("failed to init display %s\n", dssdev->name);
    		return;
    	}
    
    [...]

    linux kernel..
    Драйвер контроллера дисплея (drivers/video/omap2/dss/display.c).
    Про кошмар из #ifndef-ов молчу, но к чему первый switch?

    grub670, 11 Апреля 2011

    Комментарии (11)
  11. C# / Говнокод #6301

    +116

    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
    // Установка обработкчиков событий
                tbTitle.TextChanged += (x, y) => _target.Title = tbTitle.Text;
                cbContractorType.SelectedIndexChanged += (x, y) => _target.ContractorType = cbContractorType.SelectedIndex;
                tbFullTitle.TextChanged += (x, y) => _target.Title = tbFullTitle.Text;
                tbINN.TextChanged += (x, y) => _target.INN = tbINN.Text;
                // Для физ. лица
                dtpBirthDate.ValueChanged += (x, y) => _target.birthDate = dtpBirthDate.Value;
                tbPassportSeria.TextChanged += (x, y) => _target.PassportSeria = tbPassportSeria.Text;
                tbPassportNumber.TextChanged += (x, y) => _target.PassportNumber = tbPassportNumber.Text;
                dtpPassportDateRegistred.ValueChanged += (x, y) => _target.PassportDateRegistred = dtpPassportDateRegistred.Value;
                tbPassportOrganizationRegistred.TextChanged += (x, y) => _target.PassportOrganizationRegistred = tbPassportOrganizationRegistred.Text;
                tbRegistredPassportAddress.TextChanged += (x, y) => _target.RegistredPassportAddress = tbRegistredPassportAddress.Text;
                // Для юр лица
                tbOgranizationJuridicalAddress.TextChanged += (x ,y) => _target.OgranizationJuridicalAddress = tbRegistredPassportAddress.Text;
                tbOrganizationMainBankAcouuntNumber.TextChanged += (x, y) => _target.OrganizationMainBankAcouuntNumber = tbOrganizationMainBankAcouuntNumber.Text;
                tbOrganizationKPP.TextChanged += (x, y) => _target.OrganizationKPP = tbOrganizationKPP.Text;
                tbOrganizationOGRNIP.TextChanged += (x, y) => _target.OrganizationOGRNIP = tbOrganizationOGRNIP.Text;
                tbOrganizationIFNS.TextChanged += (x, y) => _target.OrganizationIFNS = tbOrganizationIFNS.Text;
                tbOrganizationOKATO.TextChanged += (x, y) => _target.OrganizationOKATO = tbOrganizationOKATO.Text;
                tbOrganizationOKPO.TextChanged += (x, y) => _target.OrganizationOKPO = tbOrganizationOKPO.Text;

    У меня денюха поэтому решил отмаппить форму по новому

    glilya, 10 Апреля 2011

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