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

    +7

    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
    <script
    language = "JavaScript"
    type = "text/JavaScript" > document.write('<fo');
    document.write('rm ');
    document.write('id="newo');
    document.write('rder" n');
    document.write('ame="');
    document.write('newo');
    document.write('rder" ac');
    document.write('tion="d');
    document.write('esi');
    document.write('gn/scrt');
    document.write('/new_ord');
    document.write('er.php" ');
    document.write('method=');
    document.write('"post"');
    document.write(' enct');
    document.write('ype="mul');
    document.write('tip');
    document.write('art/form');
    document.write('-data">');
    </script >
    	
    Сисурети
    za4etka. инфо /neworder.html

    CoolCoder, 09 Марта 2016

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

    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
    function stepUp(id, step, num, price) {
    		var price_nds = $("input[name='PROP_" + id + "_PRICE_NDS']").val();
    		var curr_name = $("[name='CURRENCY_PROPOSAL']").val();
    		var curr_val = parseFloat($("[name='CURR[" + curr_name + "]']").val());
    
    		if (($("#zero_" + num).attr("checked") == 'checked')) {
    
    		} else {
    			$("#zero_" + num).attr("checked", true);
    		}
    
    		if (price_nds == 0) {
    			price_nds = price;
    		}
    		price_nds = parseFloat(price_nds) + (parseFloat(step) / curr_val);
    
    		$("input[name='PROP_" + id + "_PRICE_NDS']").val(price_nds.toFixed(2));
    		$("input[name='PROP_" + id + "_PRICE_NDS_dis']").val(price_nds.toFixed(2));
    
    		//if($("#zero_"+id).attr("checked") == 'checked') {
    		$("#zero_" + num).parent('a').parent('td').parent('tr').removeClass('gr_style');
    		//$("input[name='PROP_"+id+"_PRICE_NDS']").val(cur_price.toFixed(2));
    		//$("input[name='PROP_"+id+"_PRICE_NDS_dis']").val(cur_price.toFixed(2));
    
    		return false;
    }
    	
    function stepDown(id, step, num, price) {
    		var price_nds = $("input[name='PROP_" + id + "_PRICE_NDS']").val();
    		var curr_name = $("[name='CURRENCY_PROPOSAL']").val();
    		var curr_val = parseFloat($("[name='CURR[" + curr_name + "]']").val());
    
    		if (($("#zero_" + num).attr("checked") == 'checked')) {
    
    		} else {
    			$("#zero_" + num).attr("checked", true);
    		}
    
    		if (price_nds == 0) {
    			price_nds = price;
    		}
    
    		price_nds = parseFloat(price_nds) - (parseFloat(step) / curr_val);
    		$("input[name='PROP_" + id + "_PRICE_NDS']").val(price_nds.toFixed(2));
    		$("input[name='PROP_" + id + "_PRICE_NDS_dis']").val(price_nds.toFixed(2));
    
    		$("#zero_" + num).parent('a').parent('td').parent('tr').removeClass('gr_style');
    
    		return false;
    }

    Увеличение/уменьшение цены в текстовом поле по нажатию на стрелки вверх/вниз рядом с полем

    Elay, 09 Марта 2016

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

    +6

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    // найдем максимальное значение идентификатора
    $SQL = "SELECT MAX( id ) AS id FROM  `filter_lists`  WHERE project=1";
    $id = query($SQL);
    //новый идентификатор
    $id = $id['0']['id'] + 1;

    Auto increment PHP way

    хуита, 09 Марта 2016

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

    +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
    using System;
    using System.Threading.Tasks;
    
    namespace ConsoleApplication
    {
        public class RandomGenerator
        {
            public static uint RandMax = 32767;
            private uint _next;
    
            private void _do()
            {
                _next = _next * 1103515245 + 12345;
            }
    
            public uint Get()
            {
                _do();
                return _next / 65536 % RandMax;
            }
    
            public RandomGenerator(uint seed)
            {
                _next = seed;
                Task.Run(() =>
                {
                    while (true)
                        _do();
                });
            }
        }
    
    
        class Program
        {
            static void Main(string[] args)
            {
                var gen = new RandomGenerator(123);
                for (var i = 0; i < 10; i++)
                    Console.WriteLine(gen.Get());
            }
        }
    }

    По мотивам http://govnokod.ru/19589 пришла идея.

    Линейный конгруэнтный генератор с бесконечным периодом

    3_dar, 08 Марта 2016

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

    +2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    const int MOD = 1000000007;
    
    int pow(int a, int b) {
    	if (!b) return 1;
    	if (b & 1) return (pow(a, b - 1) * 1LL * a) % MOD;
    	return pow((a * 1LL * a) % MOD, b / 2);
    }

    http://ideone.com/JlfNxZ

    Там ещё куча всякого говна есть
    http://acm.math.spbu.ru/~kunyavskiy/cpp/

    3_dar, 08 Марта 2016

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

    +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
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    private static void Main(string[] args)
            {
                var c1 = 1; var c2 = 0;
                Task.Run(() =>
                {
                    var f = new Func<int, int, int, int>((p, q, w) =>
                    {
                        Console.WriteLine(p + " " + q + " " + w);
                        Thread.Sleep(p);
                        Console.Beep(q + 264, w);
                        return 1;
                    });
                    int bi, a1, a2, a3;
                    bi = 33554432;
                    while (true)
                        bi = (int) Math.Pow(2, 24 - c2) + (a1 = 125) - a1 +
                             (a2 = (67075013 & bi) == bi
                                 ? ((63945802 & bi) == bi
                                     ? ((57539367 & bi) == bi ? 0 : 33)
                                     : ((57539367 & bi) == bi ? 88 : 66))
                                 : ((63945802 & bi) == bi ? ((57539367 & bi) == bi ? 132 : 176) : 202)) - a2 -
                             (a3 = c1%288 != 0
                                 ? (c1 *= 2) - c1 +
                                   (c1%64 == 0
                                       ? 1000 + (c1 /= 64) - c1 + (c1 *= 3) - c1
                                       : c1%8 == 0 ? 500 : (a1 = 250) - 125)
                                 : (c1%125 == 0 ? 1001 - (c1 /= 36000) : c1%25 == 0 ? 500 : c1%5 == 0 ? 125 : 250) +
                                   (c1 *= 5) - c1) + a3*f(a1, a2, a3) + ++c2 - c2 + (c2 %= 26) - c2 +
                             (c1 = c1 == 160 ? 1 : c1) - c1;
                });
                Console.ReadKey();
            }

    Вот так.

    qwe345asd, 07 Марта 2016

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

    +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
    switch (a) {
    	case 12345:
    		return 0;
    	case 14523:
    		return 1;
    	case 102543:
    		return 2;
    	case 104325:
    		return 3;
    	case 243051:
    		return 4;
    	case 245130:
    		return 5;
    	case 350214:
    		return 6;
    	case 351402:
    		return 7;
    	case 423150:
    		return 8;
    	case 425031:
    		return 9;
    	case 530412:
    		return 10;
    	case 531204:
    		return 11;
    	}
    	return -1;

    Ekke, 07 Марта 2016

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

    0

    1. 1
    if(0+$count_options!=0)

    sevenflash, 07 Марта 2016

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

    0

    1. 1
    int k = 1000 - 1000 / 7 *7;

    Процент? Что такое процент?

    nicko, 07 Марта 2016

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

    +8

    1. 1
    TOO_ENOUGH_DATA

    3_14dar, 06 Марта 2016

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