1. PHP / Говнокод #15841

    +154

    1. 1
    2. 2
    3. 3
    foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
    do_action("ws_plugin__s2member_before_paypal_api_response", get_defined_vars());
    unset /* Unset defined __refs, __v. */($__refs, $__v);

    И опять s2member для wordpress

    antongorodezkiy, 24 Апреля 2014

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

    +143

    1. 1
    CFGDBFACADOEBFAAAACOABAOBBGAAODBFADCCCFDOGDACCOGAAAAAACOBDBGAAOCBGDEBDFDADGCBEDAABCOBEECBDAOECFCCFCCEOBDOAABDFOAOBDBOBGOBDBBEECBBAOOBADBADAEGAOCBEFAABCFDBGOAFGBGEBBDBBGBBGBEACOOACAAABCBDADGACAAABDOOAAFCBBDBODCBDFDCBEDAAACEAGACFDCADDFOBCCBOBDGEDEFBAAAABDAACDBDGODGBCBBDCOAEGAOBAEFBOEDGCCGEDBOCFDBEBBEFAOCACGBFEAAEBGFDOBCAADACAAECGEAABDBFACGBGECEGCDADBFACGABOCGGDFEABOCOGCFGCOAAAAAOEAAABGECCODAD

    "Змейка" в машинных кодах на системе счисления wct. WctEditor - http://yadi.sk/d/i9Me1IQ7MbHCD.

    Mobac, 24 Апреля 2014

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

    +138

    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
    private static Dictionary<RoleEnum, string> Roles = new Dictionary<RoleEnum, string>
            {
                {RoleEnum.TeamMember, "Team Member"},
                {RoleEnum.ProjectManager, "Project Manager"},
                {RoleEnum.ProgramManager, "Program Manager"},
                {RoleEnum.PortfolioManager, "Portfolio Manager"},
                {RoleEnum.Executive, "Executive"},
                {RoleEnum.Undefined, "Undefined"}
            };
    
            public static RoleEnum ParseRole(string role)
            {
                RoleEnum result = RoleEnum.Undefined;
                Roles
                    .Where(_ => _.Value == role)
                    .ToList()
                    .ForEach(_ => result = _.Key);
    
                return result;
            }

    Странное использование дикшинари, очень странное, в обратную сторону можна сказать

    boades, 24 Апреля 2014

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

    +126

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    program FeyverkFirework;
    
    {$R+}
    
    uses
      Crt, Graph;
    
    var
      GraphDriver, GraphMode, ErrorCode : Integer;
      Ch : Char;
      I, J, K, XStart, YStart : Integer;
      XX,YY,CC : Array[1..1000] of Integer;
      FX,FY,DX,DY : Array[1..70] of Real;
      R, T, X, Y : Real;
    
    procedure Explode (C : Integer);
    
    begin
      T := -Pi;
      I := 0;
      Repeat
        I := I + 1;
        DX[I] := Sin(T)*5;
        DY[I] := Cos(T)*5;
        FX[I] := X;
        FY[I] := Y;
        T := T + 0.15;
      Until T > Pi;
    
      K := 0;
      Repeat
        For J := 1 to I do
          begin
            If C = 0 then
              PutPixel (Round(FX[J]),Round(FY[J]),0)
            else
              PutPixel (Round(FX[J]),Round(FY[J]),Random(GetMaxColor+1));
            FX[J] := FX[J] + DX[J];
            FY[J] := FY[J] - DY[J];
            DY[J] := DY[J] - 0.2;
          end;
        K := K + 1;
        Delay(10); { This was not in the original. }
      Until Keypressed or (K > 50);
    end;
    
    procedure ShootFireWork;
    
    begin
      { Delay (1000); }
      Randomize;
      T := Random / 2 - 0.25 + Pi/2;
      X := XStart;
      Y := YStart;
      R := 20;
      I := 0;
      Repeat
        Inc (I);
        XX[I] := Round(X);
        YY[I] := Round(Y);
        CC[I] := GetPixel (XX[I],YY[I]);
        If I > 1 then
          If (XX[I] = XX[I-1]) and (YY[I] = YY[I-1]) then CC[I] := CC[I-1];
        PutPixel (XX[I],YY[I],Random(GetMaxColor+1));
        If I > 5 then
          PutPixel (XX[I-5],YY[I-5],CC[I-5]);
        X := X + Cos(T)*R;
        Y := Y - Sin(T)*R;
        If T > Pi/2 then
          T := T + 0.02
        else
          T := T - 0.02;
        R := R * 0.93;
        Delay (20);
      Until KeyPressed or (T < 0) or (T > Pi);
    
      For J := I-5 to I do
    
         PutPixel (XX[J],YY[J],CC[J]);
    {    ch := readkey; }
      Explode (1);
      Explode (0);
    end;
    
    begin
      GraphDriver := Detect;
      InitGraph (GraphDriver, GraphMode, '..');
      ErrorCode := GraphResult;
      If ErrorCode <> grOk then
        begin
          Writeln ('Graphics Error: ',GraphErrorMsg(ErrorCode));
          Halt;
        end;
      SetColor (GetMaxColor);
      XStart := GetMaxX div 2;
      YStart := GetMaxY - 20;
    
      Repeat
        ShootFireWork;
      Until Keypressed;

    Ch := ReadKey;
    ClearDevice;
    CloseGraph;
    end.

    Работает же! Красиво получается :)
    Выполнить код можно здесь: http://pma.clan.su/index.html.
    Алгоритм выполнения кода. Жмём E. Вводим код. Нажимаем в левом нижнем углу CoPas editor. Нажимаем R. Радуемся! :)

    Mobac, 24 Апреля 2014

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

    +83

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    program FeyverkFirework;
    
    {$R+}
    
    uses
      Crt, Graph;
    
    var
      GraphDriver, GraphMode, ErrorCode : Integer;
      Ch : Char;
      I, J, K, XStart, YStart : Integer;
      XX,YY,CC : Array[1..1000] of Integer;
      FX,FY,DX,DY : Array[1..70] of Real;
      R, T, X, Y : Real;
    
    procedure Explode (C : Integer);
    
    begin
      T := -Pi;
      I := 0;
      Repeat
        I := I + 1;
        DX[I] := Sin(T)*5;
        DY[I] := Cos(T)*5;
        FX[I] := X;
        FY[I] := Y;
        T := T + 0.15;
      Until T > Pi;
    
      K := 0;
      Repeat
        For J := 1 to I do
          begin
            If C = 0 then
              PutPixel (Round(FX[J]),Round(FY[J]),0)
            else
              PutPixel (Round(FX[J]),Round(FY[J]),Random(GetMaxColor+1));
            FX[J] := FX[J] + DX[J];
            FY[J] := FY[J] - DY[J];
            DY[J] := DY[J] - 0.2;
          end;
        K := K + 1;
        Delay(10); { This was not in the original. }
      Until Keypressed or (K > 50);
    end;
    
    procedure ShootFireWork;
    
    begin
      { Delay (1000); }
      Randomize;
      T := Random / 2 - 0.25 + Pi/2;
      X := XStart;
      Y := YStart;
      R := 20;
      I := 0;
      Repeat
        Inc (I);
        XX[I] := Round(X);
        YY[I] := Round(Y);
        CC[I] := GetPixel (XX[I],YY[I]);
        If I > 1 then
          If (XX[I] = XX[I-1]) and (YY[I] = YY[I-1]) then CC[I] := CC[I-1];
        PutPixel (XX[I],YY[I],Random(GetMaxColor+1));
        If I > 5 then
          PutPixel (XX[I-5],YY[I-5],CC[I-5]);
        X := X + Cos(T)*R;
        Y := Y - Sin(T)*R;
        If T > Pi/2 then
          T := T + 0.02
        else
          T := T - 0.02;
        R := R * 0.93;
        Delay (20);
      Until KeyPressed or (T < 0) or (T > Pi);
    
      For J := I-5 to I do
    
         PutPixel (XX[J],YY[J],CC[J]);
    {    ch := readkey; }
      Explode (1);
      Explode (0);
    end;
    
    begin
      GraphDriver := Detect;
      InitGraph (GraphDriver, GraphMode, '..');
      ErrorCode := GraphResult;
      If ErrorCode <> grOk then
        begin
          Writeln ('Graphics Error: ',GraphErrorMsg(ErrorCode));
          Halt;
        end;
      SetColor (GetMaxColor);
      XStart := GetMaxX div 2;
      YStart := GetMaxY - 20;
    
      Repeat
        ShootFireWork;
      Until Keypressed;

    Работает же! Красиво получается :)
    Выполнить код можно здесь: http://pma.clan.su/index.html.
    Алгоритм выполнения кода. Жмём E. Вводим код. Нажимаем в левом нижнем углу CoPas editor. Нажимаем R. Радуемся! :)

    Mobac, 24 Апреля 2014

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

    +137

    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
    Index and length must refer to a location within the string.
    Parameter name: length
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    
    Exception Details: System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
    Parameter name: length
    
    Source Error:
    
    
    Line 1239:    // СЕГОДНЯ И ВЧЕРА
    Line 1240:    string agent = Request.UserAgent;
    Line 1241:    string sid = DateTime.Now.ToShortDateString().Substring(0, 10).Replace(".", "").Replace("/", "").Replace("-", "");
    Line 1242:    string sid2 = DateTime.Now.AddDays(-1).ToShortDateString().Substring(0, 10).Replace(".", "").Replace("/", "").Replace("-", "");
    Line 1243:    //

    http://tltgorod.ru/news/theme-5/news-21502

    Хуяк-хуяк и в продакшн.

    bakagaijin, 24 Апреля 2014

    Комментарии (336)
  7. JavaScript / Говнокод #15835

    +153

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    function getCallback( variable ){
        return function () {
            if (!private["loginManager"].isLogin() )
                return ( private["loginManager"].callbackReauth() && false) || null ;
            return private[variable];
        }
    };

    когда лень ставить лишние фигурные скобки ( все внимание на средний return )

    Dart_Sergius, 24 Апреля 2014

    Комментарии (5)
  8. Java / Говнокод #15834

    +71

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    final String[] arg1 = {"name-ru", "phone", "address-ru"};
    final Analyzer arg2 = getAnalyzer();
    final QueryParser parser = ReflectionUtils.getTheOnlyMatchingConstructor(
        MultiFieldQueryParser.class,
        new Class<?>[]{arg1.getClass(), arg2.getClass()}
    ).newInstance(arg1, arg2);

    Одним изящным движением превращаем миграцию на свежую версию lucene в попоболь.

    roman-kashitsyn, 24 Апреля 2014

    Комментарии (0)
  9. Python / Говнокод #15833

    −96

    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
    srp_base64_table = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz./"
    
    def srpb64decode(s):
        ints = [srp_base64_table.index(c) for c in s]
        pad = len(ints) % 4
        if pad != 0:
            pad = 4 - pad
        ints = [0 for i in range(0, pad)] + ints
        notleading = False
        buf = []
    
        pos = 0
        while pos < len(ints):
            b = (ints[pos] << 2) | ((ints[pos+1] & 0x30) >> 4)
            if notleading or b != 0:
                buf.append(b)
                notleading = True
            b = ((ints[pos+1] & 0x0f) << 4) | ((ints[pos+2] & 0x3c) >> 2)
            if notleading or b != 0:
                buf.append(b)
                notleading = True
            b = ((ints[pos+2] & 0x03) << 6) | ints[pos+3]
            if notleading or b != 0:
                buf.append(b)
                notleading = True
            pos += 4
    
        return bytes(buf)
    
    def srpb64encode(b):
        pos = len(b) % 3
        b0 = 0
        b1 = 0
        b2 = 0
        notleading = False
        buf = ""
    
        if pos == 1:
            b2 = b[0]
        elif pos == 2:
            b1 = b[0]
            b2 = b[1]
    
        while True:
            c = (b0 & 0xfc) >> 2
            if notleading or c != 0:
                buf += srp_base64_table[c]
                notleading = True
            c = ((b0 & 3) << 4) | ((b1 & 0xf0) >> 4)
            if notleading or c != 0:
                buf += srp_base64_table[c]
                notleading = True
            c = ((b1 & 0xf) << 2) | ((b2 & 0xc0) >> 6)
            if notleading or c != 0:
                buf += srp_base64_table[c]
                notleading = True
            c = b2 & 0x3f
            if notleading or c != 0:
                buf += srp_base64_table[c]
                notleading = True
            if pos >= len(b):
                break
            b0 = b[pos]
            b1 = b[pos + 1]
            b2 = b[pos + 2]
            pos += 3
    
        return buf

    Кодирование и декодирование блобов для openssl SRP.

    А я построю свой диснейленд с блекджеком и шлюхами! (c) тот, кто пилил SRP в openssl

    bormand, 23 Апреля 2014

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

    +90

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    const struct TExceptionSafety {
                TQueue& _queue;
                ::std::condition_variable& _pushToQueue;
                ~TExceptionSafety(){
                    if(!this->_queue.empty())
                        this->_pushToQueue.notify_one();
                }
            } exceptionSafety = {_queue, _pushToQueue};//Use BOOST_SCOPE_EXIT, Luke!

    laMer007, 23 Апреля 2014

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