1. Java / Говнокод #12027

    +70

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    protected SocketChannel getSockById(int id)
    {
              Iterator<SocketChannel> i = clientSock.iterator();
              while(i.hasNext())
              {
              	SocketChannel s = i.next();
              	if(s.hashCode() == id)
               		return s;
         
              }
              return null;
    }

    Инетесно, о чём думал автор в момент создания этого шедевра

    roman-kashitsyn, 30 Октября 2012

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

    +72

    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
    if("all".equalsIgnoreCase(lvl)) {
                setLevel(SimpleLog.LOG_LEVEL_ALL);
            } else if("trace".equalsIgnoreCase(lvl)) {
                setLevel(SimpleLog.LOG_LEVEL_TRACE);
            } else if("debug".equalsIgnoreCase(lvl)) {
                setLevel(SimpleLog.LOG_LEVEL_DEBUG);
            } else if("info".equalsIgnoreCase(lvl)) {
                setLevel(SimpleLog.LOG_LEVEL_INFO);
            } else if("warn".equalsIgnoreCase(lvl)) {
                setLevel(SimpleLog.LOG_LEVEL_WARN);
            } else if("error".equalsIgnoreCase(lvl)) {
                setLevel(SimpleLog.LOG_LEVEL_ERROR);
            } else if("fatal".equalsIgnoreCase(lvl)) {
                setLevel(SimpleLog.LOG_LEVEL_FATAL);
            } else if("off".equalsIgnoreCase(lvl)) {
                setLevel(SimpleLog.LOG_LEVEL_OFF);
            }

    Внутренности конструктора org.apache.commons.logging.impl.SimpleLo g

    POPSuL, 30 Октября 2012

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

    −99

    1. 1
    2. 2
    3. 3
    4. 4
    private function onClick(e:MouseEvent):void 
    {
            dispatchEvent(new MouseEvent(MouseEvent.CLICK, true, false))
    }

    Еще один кусочек очень полезного кода. (this для этого обработчика - MovieClip).

    wvxvw, 30 Октября 2012

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

    +20

    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
    void __fastcall TfРѕrm1::SpeedButton1Click(TobjРµct *Sender)
    {
    SpeedButton1->Enabled=false;
     SpeedButton1->Caption=Edit1->Text;
     if(Edit1->Text=="X")
     Edit1->Text="0";
     else
     Edit1->Text="X";
     if(SpeedButton1->Caption=="X" && SpeedButton2->Caption=="X" && SpeedButton3->Caption=="X" ||
     SpeedButton4->Caption=="X" && SpeedButton5->Caption=="X" && SpeedButton6->Caption=="X" ||
     SpeedButton7->Caption=="X" && SpeedButton8->Caption=="X" && SpeedButton9->Caption=="X" ||
     SpeedButton1->Caption=="X" && SpeedButton4->Caption=="X" && SpeedButton7->Caption=="X" ||
      SpeedButton2->Caption=="X" && SpeedButton5->Caption=="X" && SpeedButton8->Caption=="X" ||
       SpeedButton3->Caption=="X" && SpeedButton6->Caption=="X" && SpeedButton9->Caption=="X" ||
        SpeedButton1->Caption=="X" && SpeedButton5->Caption=="X" && SpeedButton9->Caption=="X" ||
         SpeedButton3->Caption=="X" && SpeedButton5->Caption=="X" && SpeedButton7->Caption=="X")
    
      ShowMessage("Ea?a caeii?aia, e?anoeee auea?aee");
    
      else
       if(SpeedButton1->Caption=="0" && SpeedButton2->Caption=="0" && SpeedButton3->Caption=="0" ||
     SpeedButton4->Caption=="0" && SpeedButton5->Caption=="0" && SpeedButton6->Caption=="0" ||
     SpeedButton7->Caption=="0" && SpeedButton8->Caption=="0" && SpeedButton9->Caption=="0" ||
     SpeedButton1->Caption=="0" && SpeedButton4->Caption=="0" && SpeedButton7->Caption=="0" ||
      SpeedButton2->Caption=="0" && SpeedButton5->Caption=="0" && SpeedButton8->Caption=="0" ||
       SpeedButton3->Caption=="0" && SpeedButton6->Caption=="0" && SpeedButton9->Caption=="0" ||
        SpeedButton1->Caption=="0" && SpeedButton5->Caption=="0" && SpeedButton9->Caption=="0" ||
         SpeedButton3->Caption=="0" && SpeedButton5->Caption=="0" && SpeedButton7->Caption=="0")
      ShowMessage("Ea?a caeii?aia, iieeee auea?aee");
    
    }

    jQuery, 29 Октября 2012

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

    +133

    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
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript">
    $(document).ready(function() {		
    	// ...skipped...
    });  
    </script>
    <!-- end script vert menu -->
    
    <!-- spoiler -->
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"> </script>
    <script type="text/javascript"> 
    $(document).ready(function(){ 
    // ...skipped...
    });
    </script>
    <!-- spoiler -->
    
    <!-- up-->
    <script language="JavaScript" type="text/javascript"
    src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
    </script><!--up-->
    <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js' type='text/javascript'></script>
    <script type="text/javascript" src="ajax.js"></script>
    <!-- gallery -->  
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script>

    jQuery в организме не хватает?..

    telnet, 29 Октября 2012

    Комментарии (6)
  6. ActionScript / Говнокод #12020

    −122

    1. 1
    2. 2
    if (activeObject && (((activeObject is LevelObjectBirdBlack) || (activeObject is LevelObjectBirdOrange)) || (activeObject is LevelObjectBirdOrange)) && (!(activeObject as LevelObjectBird).specialPowerUsed || activeObject.getSpecialAnimationProgress() >= 0 ) )
    {...}

    primerno tak vyglyadit angry birds from inside

    iliakot, 29 Октября 2012

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

    +18

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    template <class TBitMap, int MMCROffset>
    class TControllerMemoryMappedRegister: public TBaseControllerMemoryMappedRegister<MMCROffset>
    {
    public:
    	static void set(TBitMap::E Bit) { setBit(Bit); }
    	static void reset(TBitMap::E Bit) { resetBit(Bit); }
    };

    Говногость, 29 Октября 2012

    Комментарии (32)
  8. C# / Говнокод #12018

    +136

    1. 1
    2. 2
    3. 3
    4. 4
    revision = String.Format("{0}{1:d2}{2:d2}",
    				DateTime.Now.Year.ToString().Substring(2),
    				DateTime.Today.Month,
    				DateTime.Today.Day);

    видно автор хотел сделать
    revision = DateTime.Today.ToString("yyMMdd");

    http://www.codeproject.com/Articles/272551/Custom-Assembly-Versioning-with-VS-2010-and-MSBUIL

    graph_di5, 28 Октября 2012

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

    +15

    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
    #include <iostream>
    #include <cxxabi.h>
    #include <typeinfo>
    
    int main(void)
    {
       uint8_t i = 63;
       int  status;
    
       std::cout << i << std::endl;
    
       char *realname = abi::__cxa_demangle(typeid(i).name(), 0, 0, &status);
       std::cout << "Real type of uint8_t is: " << realname << std::endl;
       delete (realname);
    
       std::cout << (unsigned int)i << std::endl;
    
    return 0;
    }

    ...нативный 8bit-ый беззнаковый int.

    sayidandrtfm, 28 Октября 2012

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

    +140

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    int next_id() {
        static int id = 0;
        __sync_add_and_fetch(&id, 1);
        return id;
    }

    "Атомарная" раздача айдишек.

    bormand, 28 Октября 2012

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