1. Pascal / Говнокод #6023

    +99

    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
    var
      i,c,b,f:integer;
      str:string;
    procedure TForm1.codir;
    begin
    b:=1;
    f:=1;
    c:=length(edit1.Text);
    str:=edit1.Text;
    repeat
    i:=ord(str[f]);
    case i of
    0:inc(i);
    1:inc(i);
    2:inc(i);
    3:inc(i);
    4:inc(i);
    5:inc(i);
    6:inc(i);
    7:inc(i);
    8:inc(i);
    9:i:=0;
    end;
    
    Delete(str, b, 1);
    Insert(inttostr(i),str,b);
    inc(b);
    inc(f);
    until b=c;
    edit2.Text:=str;
    end;

    bugmenot, 19 Марта 2011

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

    +168

    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
    #include <iostream>
    using namespace std;
    void main()
    {
        char U='#';
    int K;
        _asm
        {
            mov eax, 0
            mov al, U
            mov K,eax
        }
        cout<<K<<endl;
    }

    "Получение десятичного представления числа". C wasm.ru

    rat4, 18 Марта 2011

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

    +167

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    PopupWindow* GameLocations::getCurrentPopup()
    {
    	if(m_curPopup != nullptr && m_curPopup->needsClose())
    	{
    		m_curPopup->onClose();
    		m_curPopup = nullptr;
    		m_walker->BeginWalk(m_graph->getClosestNode(m_currentLocationId));
    	}
    	return m_curPopup;
    }

    Kirinyale, 18 Марта 2011

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

    +114

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    if (defaultOrderType == OrderType.NoCharge || defaultOrderType == OrderType.Claims)
    {
        noChargeItemEntry.Style.Add(HtmlTextWriterStyle.Display, "block");
        itemEntryPanel.Style.Add(HtmlTextWriterStyle.Display, "none");
        items.Style.Add(HtmlTextWriterStyle.Display, "none");
    }
    else
    {
        noChargeItemEntry.Style.Add(HtmlTextWriterStyle.Display, "none");
        itemEntryPanel.Style.Add(HtmlTextWriterStyle.Display, "block");
        items.Style.Add(HtmlTextWriterStyle.Display, "block");
    }

    abatishchev, 18 Марта 2011

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

    +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
    21. 21
    // Method that returns anonymous type as object
    object ReturnAnonymous() {
      return new { City="Prague", Name="Tomas" };
    }
    
    void Main() {
      // Get instance of anonymous type with 'City' and 'Name' properties
      object o = ReturnAnonymous();
    
      // This call to 'Cast' method converts first parameter (object) to the
      // same type as the type of second parameter - which is in this case 
      // anonymous type with 'City' and 'Name' properties
      var typed = Cast(o, new { City="", Name="" });
      Console.WriteLine("{0}, {1}", typed.City, typed.Name)
    }
    
    // Cast method - thanks to type inference when calling methods it 
    // is possible to cast object to type without knowing the type name
    T Cast<T>(object obj, T type) {
      return (T)obj;
    }

    via http://social.msdn.microsoft.com/forums/en-US/linqprojectgeneral/thread/c1c179bb-ea88-4633-970a-947f0dd1e71f/

    Jopa123, 18 Марта 2011

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

    +119

    1. 1
    http://rabota.1777.ru/one_rezume.php?job_rezume_id=33838&job_cat_id2=1&doljnost2=&pol2=&vozrast_ot2=21&vozrast_do2=21&obrazovanie2=&opit2=&plata2=&pajina=&new=&doljnost3=

    Супер человек, всего 21 год, умеет все и деньги ему не нужны.

    Vasiliy, 18 Марта 2011

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

    +165

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    /*
     * Корректировка даты.
     *	если дата в будущем - то показываем сегодня.
     */
    
    $row['created'] = ( strtotime( date("Y-m-d", strtotime($row['created'])) ) > strtotime( date("Y-m-d") ) )? 
    		date("r")
    		: date("r", strtotime($row['created']));

    4x4 off-road racing...

    istem, 17 Марта 2011

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

    +161

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    <?
    function save($author,$title,$pubyear,$price) {
            $sql = "INSERT INTO catalog(author,title,pubyear,price) 
                            VALUES('$author','$title',$pubyear,$price)";
            mysql_query($sql) or die (mysql_error());
    }
     function selectAll() {
                    $sql = "SELECT * FROM catalog";
                    $result = mysql_query($sql) or die(mysql_error());
                    return $result;
    }

    qbasic, 17 Марта 2011

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

    +82

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    int cont = 1;
    String d01 = turnsSubscribedByUsers.contains(cont++) ? "S" : "N";
    String d02 = turnsSubscribedByUsers.contains(cont++) ? "S" : "N";
    ....
    String d36 = turnsSubscribedByUsers.contains(cont++) ? "S" : "N";
    
    ...
    
    os.write(d01.getBytes("UTF-8"));
    os.write(d02.getBytes("UTF-8"));
    ...
    os.write(d36.getBytes("UTF-8"));

    Генерация какого-то файла :)

    voice, 17 Марта 2011

    Комментарии (22)
  10. JavaScript / Говнокод #6014

    +161

    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
    function explode( delimiter, string ) {	// Split a string by string
    	// 
    	// +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    	// +   improved by: kenneth
    	// +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    
    	var emptyArray = { 0: '' };
    
    	if ( arguments.length != 2
    		|| typeof arguments[0] == 'undefined'
    		|| typeof arguments[1] == 'undefined' )
    	{
    		return null;
    	}
    
    	if ( delimiter === ''
    		|| delimiter === false
    		|| delimiter === null )
    	{
    		return false;
    	}
    
    	if ( typeof delimiter == 'function'
    		|| typeof delimiter == 'object'
    		|| typeof string == 'function'
    		|| typeof string == 'object' )
    	{
    		return emptyArray;
    	}
    
    	if ( delimiter === true ) {
    		delimiter = '1';
    	}
    
    	return string.toString().split ( delimiter.toString() );
    }

    Из сборника JS-реализаций PHP функций : http://javascript.ru/php/explode
    Сюда можно половину этого сборника постить.

    scalar4eblo4no, 17 Марта 2011

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