1. Kotlin / Говнокод #25394

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    private fun GetDeviceInfo(request: HttpServerRequest): HashMap<String, Info>
    	{
    		val deviceInfo = request.getParam(NAME_ID)?.let { id ->
    			(Ports.ById(id) ?: Ports.ByDeviceId(id))?.let(DeviceInfo.Companion::Create)
    			?: Files.FromPath(id)?.let { file ->
    				FileInfo.GetInfo(file)
    			} ?: (Core.GetTask(id) as? Scenario)?.SourceFile?.let(::FileInfo)
    		}
    
    		return deviceInfo?.let { hashMapOf(REQUEST_RESULT to it) } ?: hashMapOf()
    	}

    jadedolej, 21 Февраля 2019

    Комментарии (15)
  2. VisualBasic / Говнокод #25393

    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
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    sub addleft
    	for i = 1 to 4
    		for j = 1 to 3
    			if a(i,j)<>0 and a(i,j) = a(i,j+1) then
    				moved = true 
    				a(i,j) = a(i,j)+1
    				a(i,j+1) = 0
    				score = score + integer ( 2**a(i,j) )
    			end if
    		end for
    	end for
    end sub
    
    sub left
    	for i = 1 to 4
    		for k = 1 to 3
    			for j = 1 to 3
    				if a(i,j) = 0 and a(i,j+1) <> 0 then
    					moved = true
    					a(i,j) = a(i,j+1)
    					a(i,j+1) = 0
    				end if
    			end for
    		end for
    	end for
    end sub
    
    rem addright, addup, adddown, right, up, down в том же духе
    
    rem . . .
    
    rem главный суслик
    while true
    		xy = touchdown()
    		if xy <> -1 then
    			x = xy/65536&0x0000ffff
    			y = xy&0x0000ffff
    			repeat
    				sleep 10
    				xy = touchup()
    			until xy <> -1
    			x = x - (xy/65536&0x0000ffff)
    			y = y - (xy&0x0000ffff)
    			if (abs(x)>100) <> (abs(y)>100) then
    				moved = false
    				if abs(x) > 100 then
    					if x > 0 then
    						left
    						addleft
    						left
    					else
    						right
    						addright
    						right
    					end if
    				else
    					if y > 0 then
    						up
    						addup
    						up
    					else
    						down
    						adddown
    						down
    					end if
    				end if
    				if moved then
    					rand
    				end if
    			end if
    		else
    			sleep 10
    		end if
    		draw
    		sleep 50
    	end while

    Не визуальный, но всё-таки барсик (могильный).

    Hu3KoypoBHeBblunemyx, 21 Февраля 2019

    Комментарии (19)
  3. Java / Говнокод #25392

    +3

    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
    74. 74
    75. 75
    76. 76
    /*
     * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
     * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     *
     * This code is free software; you can redistribute it and/or modify it
     * under the terms of the GNU General Public License version 2 only, as
     * published by the Free Software Foundation.
     *
     * This code is distributed in the hope that it will be useful, but WITHOUT
     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     * version 2 for more details (a copy is included in the LICENSE file that
     * accompanied this code).
     *
     * You should have received a copy of the GNU General Public License version
     * 2 along with this work; if not, write to the Free Software Foundation,
     * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     *
     * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     * or visit www.oracle.com if you need additional information or have any
     * questions.
     */
    
    /* @test
       @bug 4890726
       @summary Check the correctness of KOI8_U by comparing to KOI8_R
     */
    
    import java.util.*;
    import static java.lang.Character.UnicodeBlock;
    
    public class UkrainianIsNotRussian {
        private static String decode(byte[] bytes, String encoding) throws Throwable {
            String s = new String(bytes, encoding);
            equal(s.length(), 1);
            check(Arrays.equals(s.getBytes(encoding), bytes));
            return s;
        }
    
        private static void realMain(String[] args) throws Throwable {
            final byte[] bytes = new byte[1];
            int differences = 0;
            for (int i = 0; i < 0xff; i++) {
                bytes[0] = (byte) i;
                final String r = decode(bytes, "KOI8_R");
                final String u = decode(bytes, "KOI8_U");
                if (! r.equals(u)) {
                    differences++;
                    final char rc = r.charAt(0);
                    final char uc = u.charAt(0);
                    final UnicodeBlock rcb = UnicodeBlock.of(rc);
                    final UnicodeBlock ucb = UnicodeBlock.of(uc);
                    System.out.printf("%02x => %04x %s, %04x %s%n",
                                      i, (int) rc, rcb, (int) uc, ucb);
                    check(rcb == UnicodeBlock.BOX_DRAWING &&
                          ucb == UnicodeBlock.CYRILLIC);
                }
            }
            equal(differences, 8);
        }
    
        //--------------------- Infrastructure ---------------------------
        static volatile int passed = 0, failed = 0;
        static void pass() {passed++;}
        static void fail() {failed++; Thread.dumpStack();}
        static void fail(String msg) {System.out.println(msg); fail();}
        static void unexpected(Throwable t) {failed++; t.printStackTrace();}
        static void check(boolean cond) {if (cond) pass(); else fail();}
        static void equal(Object x, Object y) {
            if (x == null ? y == null : x.equals(y)) pass();
            else fail(x + " not equal to " + y);}
        public static void main(String[] args) throws Throwable {
            try {realMain(args);} catch (Throwable t) {unexpected(t);}
            System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
            if (failed > 0) throw new AssertionError("Some tests failed");}
    }

    https://github.com/AdoptOpenJDK/openjdk-jdk11/blob/master/test/jdk/sun/nio/cs/UkrainianIsNotRussian.java

    j123123, 21 Февраля 2019

    Комментарии (159)
  4. JavaScript / Говнокод #25391

    0

    1. 1
    $(`.js-filter-panel__radio__pre-tuned-up-settings`).find(`.js-filter-reg-date-radio-item:not(#${$input.attr(this._preTunedSelectedPeriod)})`).prop('checked', false);

    webviewer, 20 Февраля 2019

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

    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
    protected function validateArguments(array $argv = null)
    {
            $argc = count($argv);
    
            if (1 == $argc && is_array($argv[0])) {
                return $argv[0];
            }
    
            if (2 == $argc) {
                if (is_array($argv[0]) && (is_numeric($argv[1]) || is_null($argv[1]) || is_string($argv[1]))) {
                    $argv[0][] = $argv[1];
    
                    return $argv[0];
                }
    
                if ((is_numeric($argv[0]) || is_string($argv[0])) && (is_numeric($argv[1]) || is_string($argv[1]))) {
                    return $argv;
                }
            }
    
            if (3 == $argc) {
                if ((is_numeric($argv[0]) || is_string($argv[0])) && (is_numeric($argv[1]) || is_string($argv[1])) && (is_numeric($argv[2]) || is_null($argv[2]) || is_string($argv[2]))) {
                    return $argv;
                }
            }
    
            array_walk($argv, function (&$value) {
                if (is_array($value)) {
                    $value = 'Array';
                } else {
                    $value = sprintf('"%s"', $value);
                }
            });
    
            throw new InvalidValueException(sprintf('Invalid parameters passed to %s::%s: %s', get_class($this), '__construct', implode(', ', $argv)));
    }

    pahhan, 20 Февраля 2019

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

    0

    1. 1
    this._hideDataLabels = this._filter._accordionSettings._children[0]._children[0]._value;

    webviewer, 20 Февраля 2019

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

    +2

    1. 1
    Мес = ?(Месяц(ДатаДок) > 9 ,Строка(Месяц(ДатаДок)) ,"0"+ Строка(Месяц(ДатаДок)));

    Формат(ДатаДок, "ДФ=MM") придуман для неудачников!

    Migelek, 19 Февраля 2019

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

    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
    <?php 
    require_once("JavaScriptPacker.php");
    function pack_js($input){
    	return (new \JavaScriptPacker($input, 62, TRUE, FALSE))->pack();
    }
    ?>
    
    <script>
    <?php ob_start("pack_js"); ?>
    //awal penulisan javascript
    alert('Hello world');
    //akhir penulisan javascript
    <?php ob_end_flush(); ?>
    </script>

    Нужно угадать для чего нужен JavaScriptPacker

    OCETuHCKuu_nemyx, 18 Февраля 2019

    Комментарии (20)
  9. C# / Говнокод #25385

    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
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.AI;
    public class SimpleEngine : MonoBehaviour
    {
    NavMeshAgent main;
    Vector3 Pos2;
    void Start()
    {
    main = GetComponent<NavMeshAgent>();
    Pos2 = new Vector3(-43, 5, 0);
    }
    void Update()
    {
    main.SetDestination(Pos2);
    if (GameObject.Find("Planedelete").GetComponent<TriggerDelete>().newDestroy == true)
    {
    Destroy(gameObject); // Само удаление!!!
    }
    
    if (GameObject.Find("PlaneLight").GetComponent<TriggerLight>().Activate == true)
    {
    
    if (GameObject.Find("TrafficLight").GetComponent<TrafficLightController>().Logistic == true)
    {
    main.speed = 80;
    
    }
    if (GameObject.Find("TrafficLight").GetComponent<TrafficLightController>().Logistic == false)
    {
    main.speed = 0;
    
    }
    }
    if (GameObject.Find("PlaneLight").GetComponent<TriggerLight>().Activate == false)
    {
    main.speed = 80;
    main.acceleration = 8;
    }
    }
    }

    ШЕДЕВР ДОЛБОГНОМА ВСЕЯ UNITY3D...

    jarico_master, 17 Февраля 2019

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

    0

    1. 1
    2. 2
    3. 3
    Заметили, что во всех рекламных роликах (всякие fonbet, delivery club, заказ пиццы, и прочие)
    используется именно "iPhone"?
    Теперь это особо заметно из-за характерной хероты на "iPhone X".

    3oJloTou_nemyx, 17 Февраля 2019

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