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

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

    0

    1. 1
    $ 67.18

    Ksyrx, 06 Января 2019

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

    −2

    1. 1
    Нам нужен бойцовый петух.

    Петухинхо

    bit0rez, 05 Января 2019

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

    −2

    1. 1
    2. 2
    Решил я зайти на сайт и увидел в адресе .php.
    Больше я не заходил на этот сайт.

    Ksyrx, 03 Января 2019

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

    +2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    luabind::object FlowerEventModel::RewardInfo(int index) const {
    		luabind::object result = luabind::newtable(Core::luaState);
    		if (index < 0 && index >= (int)_presents.size()) {
    			return result;
    		}
    		return result;
    	}

    updart, 24 Декабря 2018

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

    −1

    1. 1
    2. 2
    Кода не осталось, только скрин:
    https://i.imgur.com/cyehTUH.jpg

    bochkarev, 10 Декабря 2018

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

    +1

    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
    #include <stdio.h>
    #include <inttypes.h>
    #include <string.h>
    
    typedef struct
    {
      uint8_t arr[10];
      uint8_t pos;
      uint8_t is_swap;
    } arr10;
    
    arr10 bubble_sort_recursion(arr10 a);
    void bubble_sort (uint8_t arr[static 10]);
    
    
    void bubble_sort (uint8_t arr[static 10])
    {
      arr10 a;
      memcpy(a.arr, arr, sizeof(a.arr));
      a.pos = 0;
      a.is_swap = 0;
      a = bubble_sort_recursion(a);
      memcpy(arr, a.arr, sizeof(a.arr));
    }
    
    arr10 bubble_sort_recursion(arr10 a)
    {
      if (a.pos != 9)
      {
        if (a.arr[a.pos] > a.arr[a.pos + 1])
        {
          uint8_t tmp = a.arr[a.pos + 1];
          a.arr[a.pos + 1] = a.arr[a.pos];
          a.arr[a.pos] = tmp;
          a.is_swap = 1;
        }
        a.pos++;
        return bubble_sort_recursion(a);
      }
      else
      {
       if (a.is_swap == 0)
       {
         return a;
       }
       else
       {
         a.pos = 0;
         a.is_swap = 0;
         return bubble_sort_recursion(a);
       }
      }
    }
    
    int main(void)
    {
      uint8_t arr[10] = {244, 90, 254, 109, 33, 85, 69, 81, 126, 71};
      bubble_sort(arr);
      printf("%" PRIu8 ", %" PRIu8 ", %" PRIu8 ", %" PRIu8 ", %" PRIu8 ", %" PRIu8 ", %" PRIu8 ", %" PRIu8 ", %" PRIu8 ", %" PRIu8,
             arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], arr[6], arr[7], arr[8], arr[9]);
      return 0;
    }

    Рекурсивная сортировка пузырьком

    j123123, 29 Ноября 2018

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

    −1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    public static function findById($id)
        {
            $model = self::where('id', $id)->get();
    
            $count = $model->getIterator()->count();
            if($count > 0) {
                return $model->getIterator()->current();
            }
    
            return false;
        }

    Laravel Eloquent Model

    pb92, 11 Октября 2018

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

    −4

    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
    func (incident Incident) DeleteResponsibleMicroservices(microservices []string) {
    	var teamsDelete []string
    	responsibleMss := incident.GetResponsibleMicroservices()
    	for _, microservice := range microservices {
    	ResponsibleMssLoop:
    		for _, responsibleMs := range responsibleMss {
    			if microservice == responsibleMs.MicroserviceId {
    				service.GetInstanceDB().Delete(responsibleMs)
    				if team, ok := GetTeamByMs(microservice); ok != false {
    					for _, ms := range incident.GetResponsibleMicroservices() {
    						if teamFind, ok := GetTeamByMs(ms.MicroserviceId); ok != false && teamFind == team {
    							continue ResponsibleMssLoop
    						}
    					}
    					teamsDelete = append(teamsDelete, team)
    				}
    			}
    		}
    	}
    	if len(teamsDelete) > 0 {
    		incident.DeleteResponsibles(teamsDelete)
    	}
    }

    Отличное читается код на Golang

    prostohz, 09 Октября 2018

    Комментарии (7)
  10. Куча / Говнокод #24819

    0

    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
    : ?>
      BEGIN
        SOURCE >IN @ /STRING 2DUP
        S" <?" SEARCH NIP
        IF
          NIP OVER -
          DUP 2 + >IN +!
          STATE @ IF
            POSTPONE SLITERAL
            ['] TYPE COMPILE,
          ELSE
            TYPE
          THEN
          TRUE
        ELSE
          DROP 
          STATE @ IF
            POSTPONE SLITERAL
            ['] TYPE COMPILE,
            ['] CR COMPILE,
          ELSE
            TYPE CR
          THEN
          REFILL 0=
        THEN
      UNTIL
    ; IMMEDIATE
    
    : ROW
      5 0 ?DO
        ?> <TD> <? I . ?> </TD> <?
      LOOP
    ;
    
    : T-ROWS
      0 ?DO
        ?>
        <TR>
        <? DUP EXECUTE ?>
        </TR>
        <?
      LOOP
      DROP
    ;
    
    ?> <!DOCTYPE HTML>
    <HTML>
    <HEAD>
    <TITLE>OLOLO!</TITLE>
    </HEAD>
    <BODY>
    <H1>THIS IS FORTH BABY ;)</H1>
    <TABLE>
    <? ' ROW 5 T-ROWS ?>
    </TABLE>
    </BODY>
    </HTML>

    =)

    Morgoth, 26 Сентября 2018

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

    +1

    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
    /**
     * Cast an object into a different class.
     *
     * Currently this only supports casting DOWN the inheritance chain,
     * that is, an object may only be cast into a class if that class 
     * is a descendant of the object's current class.
     *
     * This is mostly to avoid potentially losing data by casting across
     * incompatable classes.
     *
     * @param object $object The object to cast.
     * @param string $class The class to cast the object into.
     * @return object
     */
    function cast($object, $class) {
    	if( !is_object($object) ) 
    		throw new InvalidArgumentException('$object must be an object.');
    	if( !is_string($class) )
    		throw new InvalidArgumentException('$class must be a string.');
    	if( !class_exists($class) )
    		throw new InvalidArgumentException(sprintf('Unknown class: %s.', $class));
    	if( !is_subclass_of($class, get_class($object)) ) 
    		throw new InvalidArgumentException(sprintf(
    			'%s is not a descendant of $object class: %s.',
    			$class, get_class($object)
    		));
    	/**
    	 * This is a beautifully ugly hack.
    	 *
    	 * First, we serialize our object, which turns it into a string, allowing
    	 * us to muck about with it using standard string manipulation methods.
    	 *
    	 * Then, we use preg_replace to change it's defined type to the class
    	 * we're casting it to, and then serialize the string back into an
    	 * object.
    	 */
    	return unserialize(
    		preg_replace(
    			'/^O:\d+:"[^"]++"/', 
    			'O:'.strlen($class).':"'.$class.'"',
    			serialize($object)
    		)
    	);
    }

    Это прекрасно.

    gost, 25 Сентября 2018

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