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

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

    +161

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    # coffee script
    d = 1 - Math.pow(d,n) * Math.pow((1/d -1),n)
    
    // java script
    d = 1 - Math.pow(d, n) * Math.pow(1 / d(-1), n);

    почему не любят кофескрипт, выпуск -дцатьпервый. потому что нельзя просто скопипастить формулу и не поймать Uncaught TypeError: number is not a function

    makc3d, 22 Ноября 2014

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

    +1002

    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
    string Daumants::getReverse()
    {
    	string message = this->data();
    	char *reverseMessage = new char[this->length()];
    	for (int i = this->length() - 1, j = 0; i >= 0; i--, j++)
    	{
    		reverseMessage[j] = message[i];
    	}
    
    	for (int i = 0; i < this->length(); i++)
    	{
    		message[i] = reverseMessage[i];
    	}
    
    	return message;
    }

    Даумант ХУЙ!

    toxicDuck, 14 Декабря 2011

    Комментарии (99)
  4. Си / Говнокод #6479

    +142

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    for(int i=0; i<16; i++) servoPos[i] = 64;
    	for(int i=0; i<16; i++) servoOnOff[i] = SV_OFF;
    	for(int i=0; i<16; i++) servoDirection[i] = SV_FOR;
    	for(int i=0; i<16; i++) servoRange[i] = 15;
    	for(int i=0; i<16; i++) servoCenter[i] = 3000;
    	for(int i=0; i<16; i++) servoSpeed[i] = 127;

    кусочек кетайского дзена.
    Программа управления серво-приводами (хоть бы не аэс, хоть бы не аэс)

    ursus, 26 Апреля 2011

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

    +172

    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
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    <?php 
    
    $strings = array(); 
    
    $strings[] = "10_strings_0"; 
    $strings[] = "10_strings_1x"; 
    $strings[] = "10_strings_2"; 
    $strings[] = "10_strings_3"; 
    $strings[] = "10_strings_4x"; 
    $strings[] = "10_strings_5x"; 
    $strings[] = "10_strings_6"; 
    $strings[] = "10_strings_7x"; 
    $strings[] = "10_strings_8"; 
    $strings[] = "10_strings_9"; 
    
    // СПИСОК СТРОК ИЗ 100 СТРОК В КОТОРЫХ БУДЕТ ОСУЩЕСТВЛЯТЬСЯ ПОИСК СТРОК ИЗ СПИСКА $strings 
    
        for ($counter=0; $counter<100; $counter++) 
        { 
            $check_strings[] = "10_strings_".$counter; 
        } 
    
    // Временная папка - папка со скриптом 
    
        // создание vbs файлов 
        for ($strings_c=0; $strings_c<sizeof($strings); $strings_c++) 
        { 
            $file = fopen($strings[$strings_c].'.vbs', 'w'); 
                fwrite($file, 'Set Program = Wscript.CreateObject("Wscript.Shell")'.PHP_EOL.'Program.Run("'.$strings[$strings_c].'.bat'.'")'.PHP_EOL.'Wscript.Quit'); 
                fclose($file); 
        } 
    
        // создание bat файлов 
    
    $interpreter_root = 'C:\xampp\php\php.exe'; // путь к PHP интерпретатору 
        for ($strings_c=0; $strings_c<sizeof($strings); $strings_c++) 
        { 
            $file = fopen($strings[$strings_c].'.bat', 'w'); 
            fwrite($file, $interpreter_root.' '.$strings[$strings_c].'.php'); 
            fclose($file); 
        } 
    
    // создание php файлов 
    for ($strings_c=0; $strings_c<sizeof($strings); $strings_c++)   { 
    $code = '<?php 
    $string = \''.$strings[$strings_c].'\'; // строка для проверки, в каждом экземпляре своя 
        for ($counter=0; $counter<100; $counter++) 
        { 
            $check_strings[] = "10_strings_".$counter; 
        } 
    
        shuffle($check_strings); 
    
        $ok = false; 
    
        for ($check_strings_c=0; $check_strings_c<sizeof($check_strings); $check_strings_c++) 
        { 
            if ($string == $check_strings[$check_strings_c]) 
            { 
                $ok = true; 
                break; 
            } 
        } 
    
        if ($ok == true) 
        { 
            $file = fopen("'.$strings[$strings_c].'_ok.txt", "w"); 
            fclose($file); 
        } 
    ?>'; 
    
    $file = fopen($strings[$strings_c].'.php', 'w'); 
    fwrite($file, $code);

    многопоточность на PHP

    exciter, 25 Августа 2010

    Комментарии (99)
  6. JavaScript / Говнокод #3503

    +170

    1. 1
    return (this.name == objToCompare.name) ? true : false;

    Из платного учебника по JS. 2350 рублей.

    Ceyce, 17 Июня 2010

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

    +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
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    #include <iostream>
    using namespace std;
    void Brezenhem(char **z, int x0, int y0, int x1, int y1)
    {
      int A, B, sign;
      A = y1 - y0;
      B = x0 - x1;
      if (abs(A) > abs(B)) sign = 1;
      else sign = -1;
      int signa, signb;
      if (A < 0) signa = -1;
      else signa = 1;
      if (B < 0) signb = -1;
      else signb = 1;
      int f = 0;
      z[y0][x0] = '*';
      int x = x0, y = y0;
      if (sign == -1) 
      {
        do {
          f += A*signa;
          if (f > 0)
          {
            f -= B*signb;
            y += signa;
          }
          x -= signb;
          z[y][x] = '*';
        } while (x != x1 || y != y1);
      }
      else
      {
        do {
          f += B*signb;
          if (f > 0) {
            f -= A*signa;
            x -= signb;
          }
          y += signa;
          z[y][x] = '*';
        } while (x != x1 || y != y1);
      }
    }
    int main()
    {
      const int SIZE = 25; // размер поля
      int x1, x2, y1, y2;
      char **z;
      z = new char*[SIZE];
      for (int i = 0; i < SIZE; i++) 
      {
        z[i] = new char[SIZE];
        for (int j = 0; j < SIZE; j++)
          z[i][j] = '-';
      }
      cout << "x1 = ";     cin >> x1;
      cout << "y1 = ";     cin >> y1;
      cout << "x2 = ";     cin >> x2;
      cout << "y2 = ";    cin >> y2;
      Brezenhem(z, x1, y1, x2, y2);
      for (int i = 0; i < SIZE; i++) 
      {
        for (int j = 0; j < SIZE; j++)
          cout << z[i][j];
        cout << endl;
      }
      cin.get(); cin.get();
      return 0;
    }

    https://prog-cpp.ru/brezenham/

    спойлер: автор тян

    digitalEugene, 04 Февраля 2022

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

    +2

    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
    type int = 1;
    
    function main() {
        let result: [value: int, done: boolean];
    
        let v: int | undefined;
        v = 1;
    
        result = [v, false];
    
        print(result[0], result[1]);
    
        assert(result[0] == 1);
        assert(result[1] == false);
    }

    опа. новый говнокодец подоспел. а кто знает какая проблема решалась в данном коде?

    ASD_77, 14 Августа 2021

    Комментарии (98)
  9. bash / Говнокод #27467

    +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
    @echo off
    wget https://dl.google.com/android/repository/build-tools_r25.0.3-windows.zip
    unzip -j build-tools_r25.0.3-windows.zip android*/lib/dx.jar 
    rem  --- Получаем уробороса ---
    dx --dex --output=dx-dexed.jar --min-sdk-version=24 dx.jar
    rem  +++  Уроборос получен  +++
    echo class nemyx                                                                                >nemyx.java
    echo {                                                                                         >>nemyx.java
    echo   public static void main(String[] args) throws java.lang.Exception                       >>nemyx.java
    echo   {                                                                                       >>nemyx.java
    echo     java.io.PrintStream nemyxStream = new java.io.PrintStream(System.out, true, "UTF-8"); >>nemyx.java
    echo     nemyxStream.printf("%%.2fдар идёт напитон.\n", Math.PI);                              >>nemyx.java
    echo   }                                                                                       >>nemyx.java
    echo }                                                                                         >>nemyx.java
    javac -encoding utf-8 -source 1.7 -target 1.7 nemyx.java 
    jar cf nemyx.jar nemyx.class
    adb push dx-dexed.jar /sdcard/Download/
    adb push nemyx.jar /sdcard/Download/
    adb shell "cd /sdcard/Download; dalvikvm -cp dx-dexed.jar com.android.dx.command.Main --dex --output nemyx-dexed.jar nemyx.jar"
    adb shell dalvikvm -cp /sdcard/Download/nemyx-dexed.jar nemyx

    Сон разума рождает чудовища.

    npopa6, 13 Июня 2021

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

    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
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    <vistefan> In recently installed Manjaro i have this (https://imgur.com/a/e0Prjez) instead of proper AwesomeWM menu called by Super button. Any Ideas? Tried to install additional fonts. Locales are correct.
    <HEX0> !give vistefan manjaro
    <phrik> vistefan: manjaro does things differently from arch, so we can't really support it. ask in #manjaro or ##linux
    <SGOrava> vistefan: you would be fine as long as you do not mention other distributions and pretend to be using Arch, is it that hard ? Even I do that :D
    <SGOrava> vistefan: My idea is that you are missing some fonts or locale...
    <vistefan> SGOrava, :D
    <Scimmia> !give SGOrava notarch
    <phrik> SGOrava: This channel is for Arch Linux support only. Also see https://wiki.archlinux.org/index.php/Code_of_conduct#Arch_Linux_distribution_support_.2Aonly.2A
    <thingfish> you're better off being up front, from the beginning about what you're running.
    <Scimmia> seriously, we don't want you here if you're going to act like a total piece of shit
    <SGOrava> Scimmia: I know sure, but as long as one knows what one can ask here than it is fine
    <Scimmia> no, it's not
    <Scimmia> at all
    <SGOrava> how is it not ?
    <Scimmia> If you're not on Arch, it's not OK, end of story
    <SGOrava> what is wrong with that when one wants to ask a question 
    <Namarrgon> lying about your distro? ban
    <Scimmia> and asking here implies it's Arch, so knowing the rules and asking anyway is lying
    <SGOrava> why be so pedantic ?
    <Namarrgon> we don't like liars
    <SGOrava> that is why I said one needs to know what belongs here and what does not
    <thingfish> people who help in here have a hard enough time supporting actual Arch users.  They don't need to be wasting their time chasing down some issue for other distros, which should have their own support channels.
    <Namarrgon> support for other distros does not belong here
    <SGOrava> Namarrgon: peopúle lie everyday just to survive
    <Namarrgon> that's a shitty excuse
    <cyveris> That's a shitty person.
    <SGOrava> why are you so hostile ?
    <Namarrgon> if you don't like our rules then you there are plenty of other channels that you can join
    <thingfish> because you don't seem to have a clue, dude.
    <Namarrgon> SGOrava: because you are telling other people to lie to the community just to get support
    <SGOrava> I am not, I am telling them to distinguish where the problem is and ask at the source
    <demonicmaniac3> 21:14 < SGOrava> vistefan: you would be fine as long as you do not mention other distributions and pretend to be using Arch, is it that hard ?
    <Scimmia> and if it's not Arch, the problem is not here
    <demonicmaniac3> you are telling them to pretend to use arch when they ask questions
    <Scimmia> SGOrava: sounds like you aren't running arch...
    <SGOrava> I am running Arch, half of the packages comes from Arch repos, so I run Arch
    <Scimmia> So that's a no
    <thingfish> aargh
    <HEX0> !roulette
    * phrik has kicked HEX0 from #archlinux (BANG!)
    <Scimmia> !give SGOrava notarch
    <cyveris> Bold move, cotton.
    * phrik reloads and spins the chambers.
    <phrik> SGOrava: This channel is for Arch Linux support only. Also see https://wiki.archlinux.org/index.php/Code_of_conduct#Arch_Linux_distribution_support_.2Aonly.2A
    <SGOrava> how is it a no ?
    <Scimmia> SGOrava: where do the other half come from?
    <SGOrava> Scimmia: you still would not care
    <Scimmia> yep, not Arch
    <SGOrava> I know what to ask where (mostly)
    <Scimmia> if you're asking here about anything at all, you obviously don't
    <SGOrava> ??
    <Namarrgon> SGOrava: https://wiki.archlinux.org/index.php/Code_of_conduct#Arch_Linux_distribution_support_*only*
    <phrik> Title: Code of conduct - ArchWiki (at wiki.archlinux.org)
    * HEX0 (~HEX0@unaffiliated/hex0) has joined
    <Namarrgon> you can use whatever distro you want but that doesn't mean that we have to put up with your nonsense
    <cyveris> SGOrava: You're not using Arch Linux. You're using some derivative. Hence, this is not the channel for you, and now that everyone here knows you advocate for lying about it to get help, no one will help you.
    <SGOrava> Namarrgon: sorry, it is too long
    <Namarrgon> alright
    <SGOrava> cyveris: nope, it is channel for me when I have problems which are sourced from Arch
    <Scimmia> SGOrava: and now that you know the rules, ask here and get banned
    <SGOrava> Scimmia: what should I ask ?
    <cyveris> And here we go.
    <SGOrava> cyveris: you said I should ask something, so think about it
    <HEX0> stop talking and install arch linux while you can

    vistefan, 29 Декабря 2019

    Комментарии (98)
  11. Си / Говнокод #24763

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    #include <stdio.h>
    
    int main() {
    	switch (3) {
    		for (int i = 3; i > 0; --i) {
    			case 3: printf("%d ololo?\n", i);
    		}
    	}
        return 0;
    }

    О сколько нам открытий чудных
    Готовит просвящения духх...


    Угодайте, что там: https://ideone.com/zbOzGZ

    MasterJoda, 14 Сентября 2018

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