1. C# / Говнокод #8652

    +1003

    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
    namespace ExtensionMethods
    {
        public static class MyExtensions
        {
            public static int WordCount(this String str)
            {
                return str.Split(new char[] { ' ', '.', '?' }, 
                                 StringSplitOptions.RemoveEmptyEntries).Length;
            }
        }   
    }
    ....
    string s = "Hello Extension Methods";
    int i = s.WordCount();

    http://msdn.microsoft.com/en-us/library/bb383977.aspx

    In your code you invoke the extension method with instance method syntax. However, the intermediate language (IL) generated by the compiler translates your code into a call on the static method. Therefore, the principle of encapsulation is not really being violated. In fact, extension methods cannot access private variables in the type they are extending.

    Синтаксический сахар. Бессмысленный и беспощадный.
    Ждк, когда шарпоблядки уже начнут дохнуть от диабета.

    3.14159265, 26 Ноября 2011

    Комментарии (140)
  2. Lua / Говнокод #8651

    −340

    1. 1
    2. 2
    -- All scripts should begin at line
    null, Null, NULL = nil

    Lua

    istem, 26 Ноября 2011

    Комментарии (181)
  3. Си / Говнокод #8650

    +102

    1. 1
    #define HESHELME_BESHELME(x, y) (((x)>0)<<2 | ((y)>0)<<1 | ((x) > ((x)*(y) > 0 ? (y) : -(y))))

    двумерное "квантование" точки

    orion, 26 Ноября 2011

    Комментарии (35)
  4. JavaScript / Говнокод #8649

    +145

    1. 1
    http://light-radio.com/dev/

    Изучал Канвас. Открывайте исходный код и удивляйтесь =)
    Столько говна я наверно еще никогда не писал.

    KirAmp, 25 Ноября 2011

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

    +174

    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
    <?php
    $k=0;
        $TheFile1="tema.txt";
        $Open12=fopen($TheFile1,"r");
        $Tema=file($TheFile1);
        fclose($Open12);
    	
    for ($i=0;$i<count($Tema);$i++){  // внимание
        $k=$i;
    	$tema=$Tema[$k];	
    		 
    	$TheFile="name.txt";
    	$Open = fopen($TheFile,"r");
    	$File1=file($TheFile);
    	$name=$File1[$k];
    	fclose($Open);
    	
    	$TheFile="surname.txt";
    	$Open = fopen($TheFile,"r");
    	$File2=file($TheFile);
    	$surname=$File2[$k];
    	fclose($Open);
    	
    	// еще два файла.
    	
    echo('<tr>
    <td width="5%">'.$k1.'</td>
    <td width="25%">'.$name.' '.$surname.'</td>
    <td width="30%">'.$tema.'</td>
    <td width="15%">'.$town.'</td>
    <td width="15%">'.$univ.'</td>
    </tr>');
    	
    	}
    echo('</table>	');
    ?>

    Вот что можно найти, взяв на редактирование сайт конференции программистов.
    Если самого рнр мало - сорц: http://programmer-conference.org.ua/spis.phpx

    Actine, 25 Ноября 2011

    Комментарии (31)
  6. Куча / Говнокод #8647

    +121

    1. 1
    DELPHP

                                                           PHI

    TarasGovno, 25 Ноября 2011

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

    +106

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    if ( 0 == strcmp( executable, "" ) ||
         0 == strcmp( executable, "NONE" ) ||
         0 == strcmp( executable, "none" ) ||
         0 == strcmp( executable, "None" )  )
    {
    /* ... */

    ... ровно так документация и описывает данный параметр: либо пустая строка, либо case-insensitive строка NONE.

    Dummy00001, 25 Ноября 2011

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

    +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
    <ui:param name="success_style" value="color:green;"/>
    <ui:param name="error_style" value="color:red;"/>
    
    <!-- some code -->
    
    <h:outputText rendered="#{model.successSubmitted}"
        value="#{membershipReportsLabels.serviceSucceed}"
        style="#{success_style}"/>
    
    <h:outputText rendered="#{model.unSuccessSubmitted}"
        value="#{membershipReportsLabels.serviceUnSucceed}"
        style="#{error_style}"/>

    Вроде jsf тут ещё не было. Яркое подтверждение того, что CSS придумали трусы.

    roman-kashitsyn, 25 Ноября 2011

    Комментарии (2)
  9. Java / Говнокод #8643

    +90

    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
    static String Colorize(String str) {
    		str = str.replace("{BLACK}", "&0");
    		str = str.replace("{DARKBLUE}", "&1");
    		str = str.replace("{DARKGREEN}", "&2");
    		str = str.replace("{DARKTEAL}", "&3");
    		str = str.replace("{DARKRED}", "&4");
    		str = str.replace("{PURPLE}", "&5");
    		str = str.replace("{GOLD}", "&6");
    		str = str.replace("{GRAY}", "&7");
    		str = str.replace("{DARKGRAY}", "&8");
    		str = str.replace("{BLUE}", "&9");
    		str = str.replace("{BRIGHTGREEN}", "&a");
    		str = str.replace("{TEAL}", "&b");
    		str = str.replace("{RED}", "&c");
    		str = str.replace("{PINK}", "&d");
    		str = str.replace("{YELLOW}", "&e");
    		str = str.replace("{WHITE}", "&f");
    
    		str = str.replace("{0}", "&0");
    		str = str.replace("{1}", "&1");
    		str = str.replace("{2}", "&2");
    		str = str.replace("{3}", "&3");
    		str = str.replace("{4}", "&4");
    		str = str.replace("{5}", "&5");
    		str = str.replace("{6}", "&6");
    		str = str.replace("{7}", "&7");
    		str = str.replace("{8}", "&8");
    		str = str.replace("{9}", "&9");
    		str = str.replace("{A}", "&a");
    		str = str.replace("{B}", "&b");
    		str = str.replace("{C}", "&c");
    		str = str.replace("{D}", "&d");
    		str = str.replace("{E}", "&e");
    		str = str.replace("{F}", "&f");
    
    		str = str.replace("&", "\u00a7");
    		return str;
    	}

    Crazy_penguin, 25 Ноября 2011

    Комментарии (29)
  10. Java / Говнокод #8642

    +146

    1. 1
    2. 2
    3. 3
    public void info(String msg) {
    		info(true, msg);
    	}

    Crazy_penguin, 25 Ноября 2011

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