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

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

    +35

    1. 1
    2. 2
    assert( -(PHP_INT_MAX + 1)  ===  -PHP_INT_MAX - 1 );
    assert( -(PHP_INT_MAX + 2)  ===  -PHP_INT_MAX - 2 );

    __proto__, 20 Сентября 2012

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

    +130

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    <div id="busyList" class="busyList">
        <div id="busyList" class="busyList">...</div>
        <div id="busyList" class="busyList">...</div>
        <div id="busyList" class="busyList">...</div>
        <div id="busyList" class="busyList">...</div>
        <div id="busyList" class="busyList">...</div>
        <div id="busyList" class="busyList">...</div>
    </div>

    Как-то даже грустно становится...

    somnambulism, 20 Сентября 2012

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

    +126

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    private Listener<BaseEvent> blurListener = new Listener<BaseEvent>() {
    	@Override
    	public void handleEvent(BaseEvent be) {
    		Component item = getComponent(be);
    		if(focusedItem == item) {
    			focusedItem = item;
    		}
    	}
    }

    Даже боюсь предположить, зачем это.

    someone, 19 Сентября 2012

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

    +127

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    <ul>
     <li><label><input class="smert_zaemchika" type="checkbox" /> Смерть заемщика</label></li>
     <li><label><input class="poterya_raboty" type="checkbox" /> Потеря работы</label></li>
     <li><label><input class="ne_nado" type="checkbox" /> Нет</label></li>
     </ul>

    не могу больше молчать......

    Mihard, 12 Сентября 2012

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

    +57

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    $aMethods[] = array(
    			'call' => 'getNewCount',
    			'requires' => array(
    				'user_id' => 'user_id'
    			),
    			'detail' => Phpfox::getPhrase('notification.get_the_total_number_of_unseen_notifications_if_you_do_not_pass_the_user_id_we_will_return_information_about_the_user_that_is_currently_logged_in'),
    			'type' => 'GET',			
    			'response' => '{"api":{"total":5,"pages":0,"current_page":0},"output":5}'			 
    		);

    Движок Phpfox 3.3. Самая длинная фраза сообщения :))

    xakip, 11 Сентября 2012

    Комментарии (2)
  7. Ruby / Говнокод #11684

    −157

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    class SomeModel < ActiveRecord::Base
      after_save :some_method
    
      def some_method
        self.save
      end
    
    end

    Рекурсивная рекурсия рекурсивна.

    mr.The, 31 Августа 2012

    Комментарии (2)
  8. JavaScript / Говнокод #11654

    +156

    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
    var Utils = {
      // https://gist.github.com/1308368
      uuid: function(a,b){for(b=a='';a++<36;b+=a*51&52?(a^15?8^Math.random()*(a^20?16:4):4).toString(16):'-');return b},
      pluralize: function( count, word ) {
       return count === 1 ? word : word + 's';
      },
      store: function( namespace, data ) {
       if ( arguments.length > 1 ) {
        return localStorage.setItem( namespace, JSON.stringify( data ) );
       } else {
        var store = localStorage.getItem( namespace );
        return ( store && JSON.parse( store ) ) || [];
       }
      }
     };

    kyzi007, 27 Августа 2012

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

    +69

    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
    public static void main(String[] args) throws Exception {
    	// ProblemFactory in action...
    	DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
    	docBuilderFactory.setValidating(false);
    	docBuilderFactory.setNamespaceAware(false);
    	DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
    
    	// I really don't want to download that stupid DTD from w3c.org
    	docBuilder.setEntityResolver(new EntityResolver() {
    		public InputSource resolveEntity(String publicId, String systemId)
    				throws SAXException, IOException {
    			return new InputSource(new StringReader(""));
    		}
    	});
    
    	// Just fine
    	Document doc = docBuilder.parse("http://govnokod.ru/comments");
    
    	// ProblemFactory again
    	XPathFactory xpathFactory = XPathFactory.newInstance();
    	XPath xpath = xpathFactory.newXPath();
    
    	// Just fine
    	NodeList nodes = (NodeList)xpath.evaluate("//li[@class='hentry']", doc, XPathConstants.NODESET);
    	Pattern topicUriRegex = Pattern.compile("^.*/(\\d+)$");
    
    	// This is Java, not C. Why I need to write that shitty loop?!
    	for (int i=0, n=nodes.getLength(); i<n; i++) {
    		Node node = nodes.item(i);
    		String author = xpath.evaluate(".//strong[@class='entry-author']/a/text()", node);
    		String language = xpath.evaluate(".//a[@rel='chapter']/text()", node);
    		String topicUri = xpath.evaluate(".//a[@rel='bookmark'][@class='entry-title']/@href", node);
    		Matcher m = topicUriRegex.matcher(topicUri);
    		String topicId = m.matches() ? m.group(1) : "неизвестный говнокод";
    		String text = xpath.evaluate(".//div[@class='entry-comment']", node);
    		
    		System.out.println("==== " + author + " наложил в " + topicId + " (" + language + ") ====");
    		System.out.println(text);
    		System.out.println("");
    	}
    }

    Треш угар и содомия.Java, DOM и парсер уютненького.

    bormand, 24 Августа 2012

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

    +58

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    // Дополняем недостающие данные товаров
    foreach($product_data as $p_key => $p_dat) {
      		if(!isset($p_dat['product_id'])) {
      			unset($product_data[$p_key]);
      			$this->remove($p_dat['def_key']);
      			continue;
      		}
    }

    Фееричный комментарий!

    zima, 23 Августа 2012

    Комментарии (2)
  11. Pascal / Говнокод #11628

    +106

    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
    function ReplaceUrl(txt: WideString): WideString;
    var
      i, j: integer;
      tmp, Url: WideString;
    begin
      Result := '';
      I := 1;
      while I <= Length(txt) do
      begin
        tmp := '';
        if WideSameText(tmp + txt[i]+txt[i+1]+txt[i+2]+txt[i+3]+txt[i+4]+txt[i+5]+txt[i+6], 'http://') or
           WideSameText(tmp + txt[i]+txt[i+1]+txt[i+2]+txt[i+3]+txt[i+4]+txt[i+5]+txt[i+6], 'ed2k://') or
           WideSameText(tmp + txt[i]+txt[i+1]+txt[i+2]+txt[i+3]+txt[i+4]+txt[i+5],          'ftp://') or
           WideSameText(tmp + txt[i]+txt[i+1]+txt[i+2]+txt[i+3],                            'www.') or
           WideSameText(tmp + txt[i]+txt[i+1]+txt[i+2]+txt[i+3]+txt[i+4]+txt[i+5]+txt[i+6]+txt[i+7], 'https://') then
        begin
          Url := '';
          for j := I to Length(txt) do
          begin
            if (txt[j] <> ' ') and (ord(txt[j]) < 255) then
              Url := Url + txt[J]
            else
              Break;
          end;
     
          Result := Result + Format(C_HTML_URL, [Url, Url]);
     
          I := J;
        end else
        begin
          Result := Result + txt[I];
     
          Inc(I);
        end;
      end;
     
    end;

    http://www.bvbcode.com/code/vhk2e8rb-1638045

    63F45EF45RB65R6VR, 21 Августа 2012

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