1. JavaScript / Говнокод #24630

    −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
    const orbs = Object.keys(defaultOrbs).reduce((acc, el) => {
            const newAcc = {}
            Object.keys(defaultOrbs[el]).forEach((elk) => {
                if (newAcc[elk] == null) newAcc[elk] = { ...(acc[elk] || {})}
                newAcc[elk][el] = defaultOrbs[el][elk]
            })
            return newAcc
        }, {})
    
    invoke(orbs, mult) {
            if(this.props.onChange) {
                this.props.onChange(Object.keys(orbs).reduce((acc, el) => ({
                        ...acc,
                        [el]: Object.keys(orbs[el]).reduce((ack, elk) => ({
                            ...ack,
                            [elk]: orbs[el][elk] * mult 
                        }), {})
                    }), {}))
            }
        }

    Когда сишник лезет в джаваскрипт
    А кому-то в этом говне копаться и по пакетикам раскладывать

    wylde, 16 Августа 2018

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

    −1

    1. 1
    https://pikabu.ru/story/bez_lokha_i_zhizn_plokha_6096016

    minusinho, 16 Августа 2018

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

    0

    1. 1
    http://codeforces.com/blog/entry/61248

    guestinxo, 16 Августа 2018

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

    −1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    #include <stdio.h>
    #include <inttypes.h> 
    
    int main(void) {
    	float a = 0;
    	float b = -9.8 * 0;
    	uint32_t* pa = (void*)&a;
    	uint32_t* pb = (void*)&b;
    	printf("%li %li %i %f %f\n",pa[0] , pb[0], pb[0]>>31, b+0, b);
    	return 0;
    }

    Нолик со взведенным знаковым битом. Вот зачем он нужен?

    Psionic, 16 Августа 2018

    Комментарии (3)
  5. Python / Говнокод #24626

    +4

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    def lookup(self, code):
            """
            Looks up code in Redis
            Returns None on failure
            """
            url = self.redis.get(code)
            try:
                pass
            except:
                url = None
            return url

    Вот такое на полном серьезе получили как кусочек домашнего задания для соискателя на Senior Python Engineer

    Flid, 16 Августа 2018

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

    +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
    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
    /****************************************************************************
    **
    ** Copyright (C) 2015 The Qt Company Ltd.
    ** Contact: http://www.qt.io/licensing/
    **
    ** This file is part of the ActiveQt framework of the Qt Toolkit.
    **
    ** $QT_BEGIN_LICENSE:BSD$
    ** Commercial License Usage
    ** Licensees holding valid commercial Qt licenses may use this file in
    ** accordance with the commercial license agreement provided with the
    ** Software or, alternatively, in accordance with the terms contained in
    ** a written agreement between you and The Qt Company. For licensing terms
    ** and conditions see https://www.qt.io/terms-conditions. For further
    ** information use the contact form at https://www.qt.io/contact-us.
    **
    ** BSD License Usage
    ** Alternatively, you may use this file under the terms of the BSD license
    ** as follows:
    **
    ** "Redistribution and use in source and binary forms, with or without
    ** modification, are permitted provided that the following conditions are
    ** met:
    **   * Redistributions of source code must retain the above copyright
    **     notice, this list of conditions and the following disclaimer.
    **   * Redistributions in binary form must reproduce the above copyright
    **     notice, this list of conditions and the following disclaimer in
    **     the documentation and/or other materials provided with the
    **     distribution.
    **   * Neither the name of The Qt Company Ltd nor the names of its
    **     contributors may be used to endorse or promote products derived
    **     from this software without specific prior written permission.
    **
    **
    ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
    **
    ** $QT_END_LICENSE$
    **
    ****************************************************************************/

    Вот блин, почти в любом проекте в начале каждого файла такая вот куча . Я блядь открываю файл, чтобы посмотреть, что это, хотя бы одну строчку написали: этот класс занимается тем-то и тем-то, так нет, а вот всю эту бурду "ASS PISS" LSD LICENCE - пожалуйста.

    Steve_Brown, 15 Августа 2018

    Комментарии (44)
  7. Objective C / Говнокод #24624

    0

    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
    // AFJSONRPCClient.m
    //
    // Created by [email protected]
    // Copyright (c) 2013 JustCommunication
    //
    // Permission is hereby granted, free of charge, to any person obtaining a copy
    // of this software and associated documentation files (the "Software"), to deal
    // in the Software without restriction, including without limitation the rights
    // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    // copies of the Software, and to permit persons to whom the Software is
    // furnished to do so, subject to the following conditions:
    //
    // The above copyright notice and this permission notice shall be included in
    // all copies or substantial portions of the Software.
    //
    // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    // THE SOFTWARE.
    
    #import "AFHTTPRequestOperationManager.h"
    
    /**
     AFJSONRPCClient objects communicate with web services using the JSON-RPC 2.0 protocol.
     
     @see http://www.jsonrpc.org/specification
     */
    @interface AFJSONRPCClient : AFHTTPRequestOperationManager
    
    /**
     The endpoint URL for the webservice.
     */
    @property (readonly, nonatomic, strong) NSURL *endpointURL;
    
    /**
     Creates and initializes a JSON-RPC client with the specified endpoint.
     
     @param URL The endpoint URL.
     
     @return An initialized JSON-RPC client.
     */
    + (instancetype)clientWithEndpointURL:(NSURL *)URL;
    
    /**
     Initializes a JSON-RPC client with the specified endpoint.
     
     @param URL The endpoint URL.
     
     @return An initialized JSON-RPC client.
     */
    - (id)initWithEndpointURL:(NSURL *)URL;
    
    /**
     Creates a request with the specified HTTP method, parameters, and request ID.
     
     @param method The HTTP method. Must not be `nil`.
     @param parameters The parameters to encode into the request. Must be either an `NSDictionary` or `NSArray`.
     @param requestId The ID of the request.
     
     @return A JSON-RPC-encoded request.
     */
    - (NSMutableURLRequest *)requestWithMethod:(NSString *)method
                                    parameters:(id)parameters
                                     requestId:(id)requestId;
    
    /**
     Creates a request with the specified method, and enqueues a request operation for it.
     
     @param method The HTTP method. Must not be `nil`.
     @param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the request operation, and the response object created by the client response serializer.
     @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the request operation and the error describing the network or parsing error that occurred.
     */
    - (void)invokeMethod:(NSString *)method
                 success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
                 failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
    
    /**
     Creates a request with the specified method and parameters, and enqueues a request operation for it.
     @param method The HTTP method. Must not be `nil`.
     @param parameters The parameters to encode into the request. Must be either an `NSDictionary` or `NSArray`.
     @param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the request operation, and the response object created by the client response serializer.
     @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the request operation and the error describing the network or parsing error that occurred.
     */
    - (void)invokeMethod:(NSString *)method
          withParameters:(id)parameters
                 success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
                 failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
    
    /**
     Creates a request with the specified method and parameters, and enqueues a request operation for it.
     @param method The HTTP method. Must not be `nil`.
     @param parameters The parameters to encode into the request. Must be either an `NSDictionary` or `NSArray`.
     @param requestId The ID of the request.
     @param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the request operation, and the response object created by the client response serializer.
     @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the request operation and the error describing the network or parsing error that occurred.
     */
    - (void)invokeMethod:(NSString *)method

    LinuxGovno, 14 Августа 2018

    Комментарии (27)
  8. Куча / Говнокод #24623

    0

    1. 1
    Ну как вы тут, потомки? Борманд еще живой?

    nihau, 14 Августа 2018

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

    −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
    Red [ needs: 'view ]
    
    empty: 4x4
    
    grid: random do [
        res: copy[]
        repeat i 15 [append res to string! i]
        res
    ]
    
    loop 15 [grid: next insert grid 't]
    
    grid: head grid
    
    loop 3 [grid: insert skip grid 8 'return]
    
    grid: head insert [empty-cell: base 50x50 silver ] head grid
    
    view head insert grid [
        title "15 game"
        backdrop silver
        style t: button 50x50 [
            tmp: face/offset
            i: tmp/y / face/size/y + 1
            j: tmp/x / face/size/x + 1
            if  (absolute empty/1 - i) + (absolute empty/2 - j) = 1 [
                face/offset: empty-cell/offset
                empty-cell/offset: tmp
                empty: as-pair i j
            ]
        ]
        across
    ]

    Пятнашки на RED.

    666_N33D135, 13 Августа 2018

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

    0

    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
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    
    namespace SoloLearn
    {
        class Program
        {
            /**
             * Extension to simplify code writing
             */
            static string Read()
            {
                return Console.ReadLine();
            }
            static void Print(string val, bool newline)
            {
                if(newline)
                {
                    Console.WriteLine(val);
                }
                else
                {
                    Console.Write(val);
                }
            }
            static void Print(double val, bool newline)
            {
                if(newline)
                {
                    Console.WriteLine(val.ToString());
                }
                else
                {
                    Console.Write(val.ToString());
                }
            }
            static void Print(bool val, bool newline)
            {
                if(newline)
                {
                    Console.WriteLine(val.ToString());
                }
                else
                {
                    Console.Write(val.ToString());
                }
            }
            static void Print(int val, bool newline)
            {
                if(newline)
                {
                    Console.WriteLine(val.ToString());
                }
                else
                {
                    Console.Write(val.ToString());
                }
            }
            /**
             * End of extension
             */
            
            static int ToBase(int number, int nbase = 2)
            {
                int converted = 0;
                if(number == 0)
                {
                    return 0;
                }
                else
                {
                    while(number > 0)
                    {
                        converted = converted * 10 + (number % nbase);
                        number /= nbase;
                    }
                }
                return converted.ToString().Reverse().Aggregate(0, (b, x) => 10 * b + x - '0');
            }
            /** Use:
             * The first number is the convertable
             * The second is the base
             */
            static void Main(string[] args)
            {
                int num = int.Parse(Read());
                int nnbase = int.Parse(Read());
                Print("The number is: ", false);
                Print(num, true);
                Print("The base is: ", false);
                Print(nnbase, true);
                Print("The conv. number is: ", false);
                Print(ToBase(num, nnbase), true);
            }
        }
    }

    Говно ли это? Конвертит числа

    shite, 13 Августа 2018

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