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

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    export type ReplaceNullToUndefined<T> = T extends (infer R)[]
    	? ReplaceNullToUndefined<R>[]
    	: T extends object
    		? {
    				[K in keyof T]: T[K] extends object
    					? ReplaceNullToUndefined<T[K]>
    					: null extends T[K]
    						? Exclude<T[K], null> | undefined
    						: T[K];
    			}
    		: T;

    Заменяет все `null` на `undefined`

    Maligosus, 04 Марта 2024

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

    +1

    1. 1
    React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED

    ISO, 18 Февраля 2024

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

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    $('.swiper-wrapper')
     	.addClass('owl-carousel')
    	.owlCarousel({
    		items: 4,
    		margin: 10,
    		dots: true,
                    dotSpeed: 1000,
    		nav: false,
    		lazyContent: true
    	});

    Epiicac, 19 Декабря 2023

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

    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
    const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
        const price = Number(event.target.value);
        setPrice(price);
    
        if (timer) {
          clearTimeout(timer);
          setTimer(null);
        }
    
        const validPrice = validatePrice(price);
        if (event.target.id.includes("cause")) {
          handleOnChange(validPrice);
        } else {
          const timerId: any = setTimeout(() => {
            setPrice(validPrice);
            handleOnChange(validPrice);
          }, 1000);
    
          setTimer(timerId);
        }
      };

    :hang:

    Shannarra_, 14 Декабря 2023

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

    0

    1. 1
    export type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;

    Адская супер-хуйня отсюда https://github.com/deneruaraujo/daily-diet-api
    Я не понял что она делает, даже небо, даже Аллах

    sex_mashina, 23 Ноября 2023

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

    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
    bot.onText(/\/now/, (message) => {
        const DayOfTheWeek = new Date().toLocaleString('en-GB', { weekday: 'long' });
        const currentTime = new Date();
        let timeLeft = null;
        let currentLesson = "";
    
        for (let LessonId of Object.keys(lessons.v1[DayOfTheWeek])) {
            const lesson = lessons.v1[DayOfTheWeek][LessonId];
            const date = `${currentTime.getFullYear()}-${(currentTime.getMonth()+1).toString().padStart(2, '0')}-${currentTime.getDate().toString().padStart(2, '0')}`;
            const startLessonTime = new Date(`${date}T${lesson.start}:00.001Z`);
            const endLessonTime = new Date(`${date}T${lesson.end}:00.001Z`);
    
            if (currentTime.toLocaleString('en-GB', {timeZone: 'Europe/Moscow'}) >= startLessonTime.toLocaleString('en-GB', {timeZone: 'Africa/Ouagadougou'}) && currentTime.toLocaleString('en-GB', {timeZone: 'Europe/Moscow'}) <= endLessonTime.toLocaleString('en-GB', {timeZone: 'Africa/Ouagadougou'})) {
                currentLesson = lesson.name;timeLeft = (endLessonTime-currentTime) / 1000;
                timeLeft=timeLeft-10800+2;
                break;
            };
        };
    
        if (currentLesson && timeLeft) {
            const minutes = Math.floor(timeLeft / 60);
            const seconds = Math.floor(timeLeft % 60);
            bot.sendMessage(message.chat.id, `щяс урок: ${currentLesson}\nдо конца осталось ${minutes} минут ${seconds} секунд`);
        } else {
            bot.sendMessage(message.chat.id, 'Сейчас нет уроков');
        };
    });

    это я ночью говнокодил, ВАХхфВАХХВхаххвАХАВхаВХАХАХахвх

    qwkz1, 12 Сентября 2023

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

    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
    77. 77
    78. 78
    // ******************************************************************************************************
    function ch_new_nav()
    {
    	
    if((document.getElementById('navig_dat').value.length==10)&&(document.getElementById('navig_smen').value>0)&&(document.getElementById('sel_res_div').value>0))
    	{
    		
    		 
    		current_resource_id = document.getElementById('val_res_new_nav').getAttribute('data-user-id');
    
    		document.getElementById('cur_res_pred_op').src='index.php?do=show&formid=159&p0='+document.getElementById('navig_dat').value.substr(0,4)+document.getElementById('navig_dat').value.substr(5,2)+document.getElementById('navig_dat').value.substr(8,2)+'&p1='+document.getElementById('navig_smen').value+'&p2='+document.getElementById('sel_res_div').value + '&current_resource_id='+current_resource_id;
    		document.getElementById('cur_res_pred_op').style.display='block';
    		
    	//	$("#vpdiv").animate({scrollTop:$('#cur_res_pred_op').offset().top+"px"});
    
    		document.getElementById('nav_tekysh_1').innerText = document.getElementById('navig_dat').value.substr(8,2)+'.'+document.getElementById('navig_dat').value.substr(5,2)+'.'+document.getElementById('navig_dat').value.substr(0,4);
    		document.getElementById('nav_tekysh_2').innerText = document.getElementById('navig_smen').value;
    		document.getElementById('nav_tekysh_3').innerText = document.getElementById('val_res_new_nav').value;
    		document.getElementById('nav_tekysh_4').innerText = document.getElementById('sel_res_div').value;
    		document.getElementById('nav_tekysh_1').name = document.getElementById('navig_dat').value.substr(0,4)+document.getElementById('navig_dat').value.substr(5,2)+document.getElementById('navig_dat').value.substr(8,2);
    		document.getElementById('nav_tekysh_2').name = document.getElementById('navig_smen').value;
    		document.getElementById('nav_tekysh_3').name = document.getElementById('sel_res_div').value;
    
    		var spl_op_res = arr_oprs_c_r_2[document.getElementById('sel_res_div').value].split('|');
    		var spl_op_res_arr = [];
    
    		for (var spl_f_ar=0; spl_f_ar<spl_op_res.length; spl_f_ar++)
    			spl_op_res_arr[spl_op_res[spl_f_ar]] = spl_op_res[spl_f_ar];
    
    		document.getElementById('park_sel_cur_res').innerHTML='<option value="0" selected>Получение списка</option>';
    		document.getElementById('park_sel_cur_res').setAttribute('onchange', 'check_sel_park_pr(this.value)');
    		vote3('full_plan_sz_ch_park.php?p1='+document.getElementById('sel_res_div').value);
    
    
    		for (var td_c_pr=0; td_c_pr<document.getElementsByName('pr_cur_r_op').length; td_c_pr++)
    		{
    			var split_rgb_obj = document.getElementsByName('pr_cur_r_park')[td_c_pr].parentNode.style.background;
    			var split_rgb_obj_repl = split_rgb_obj.replace('rgb(','');
    			split_rgb_obj_repl = split_rgb_obj_repl.replace(')','');
    			split_rgb_obj_repl = split_rgb_obj_repl.replace(' ','');
    			split_rgb_obj_repl = split_rgb_obj_repl.replace(' ','');
    			split_rgb_obj_repl = split_rgb_obj_repl.replace(' ','');
    			split_rgb_obj_repl = split_rgb_obj_repl.split(',');
    
    			if ((split_rgb_obj_repl[0]=='221')&&(split_rgb_obj_repl[1]=='255')&&(split_rgb_obj_repl[2]=='221'))
    				{
    					document.getElementsByName('pr_cur_r_op')[td_c_pr].style.background='#ddffdd';
    					document.getElementsByName('pr_cur_r_park')[td_c_pr].style.background='#ddffdd';
    				}
    					else
    						{
    							document.getElementsByName('pr_cur_r_op')[td_c_pr].style.background='#fff';
    							document.getElementsByName('pr_cur_r_park')[td_c_pr].style.background='#fff';
    						}
    
    			if (document.getElementsByName('pr_cur_r_op')[td_c_pr].parentNode.cells[8].innerHTML.indexOf('<img') !== -1)
    			{
    				var id_op_add_ind_0 = document.getElementsByName('pr_cur_r_op')[td_c_pr].parentNode.cells[8].getElementsByTagName('a')[0].getAttribute('onclick').indexOf('del_op_in_sz');
    				var id_op_add_ind = document.getElementsByName('pr_cur_r_op')[td_c_pr].parentNode.cells[8].getElementsByTagName('a')[0].getAttribute('onclick').indexOf('(',id_op_add_ind_0);
    				var id_op_add_ind_1 = document.getElementsByName('pr_cur_r_op')[td_c_pr].parentNode.cells[8].getElementsByTagName('a')[0].getAttribute('onclick').indexOf(',',id_op_add_ind);
    				var id_op_add_ind_2 = document.getElementsByName('pr_cur_r_op')[td_c_pr].parentNode.cells[8].getElementsByTagName('a')[0].getAttribute('onclick').substr((id_op_add_ind+1),(id_op_add_ind_1-id_op_add_ind-1));
    				document.getElementsByName('pr_cur_r_op')[td_c_pr].parentNode.cells[8].getElementsByTagName('a')[0].innerHTML='<b name="pr_cur_r_op_b">>>></b>';
    				document.getElementsByName('pr_cur_r_op')[td_c_pr].parentNode.cells[8].getElementsByTagName('a')[0].setAttribute('onclick','add_op_in_sz('+id_op_add_ind_2+',this)');
    			}
    
    			document.getElementsByName('pr_cur_r_op_b')[td_c_pr].setAttribute('style','font-size:100%; color:#23609E;');
    			
    			if (spl_op_res_arr[document.getElementsByName('pr_cur_r_op')[td_c_pr].id.substr(9)])
    			{
    				document.getElementsByName('pr_cur_r_op')[td_c_pr].style.background='#99ff99';
    				document.getElementsByName('pr_cur_r_op_b')[td_c_pr].setAttribute('style','font-size:150%; color:#13BD13;');
    			}
    		} // for (var td_c_pr=0; td_c_pr<document.getElementsByName('pr_cur_r_op').length; td_c_pr++)
    		
    	} // if((document.getElementById('navig_dat').value.length==10)&&(document.getElementById('navig_smen').value>0)&&(document.getElementById('sel_res_div').value>0))
    	else
    		alert('Выберите дату, смену, ресурс!');
    } // function ch_new_nav()

    kib0rg, 06 Сентября 2023

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

    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
    77. 77
    Events.on(EventType.ClientLoadEvent, () => {
        
        const oneDialog = new BaseDialog(" ");
        oneDialog.cont.add(" ").row();
        oneDialog.cont.button("OK", () => {
            oneDialog.hide();
          
            const twoDialog = new BaseDialog(" ");
            twoDialog.cont.add(" ").row();
            twoDialog.cont.button("OK", () => {
                twoDialog.hide();
              
                const threeDialog = new BaseDialog(" ");
                threeDialog.cont.add(" ").row();
                threeDialog.cont.button("OK", () => {
                    threeDialog.hide();
                  
                    const fourDialog = new BaseDialog(" ");
                    fourDialog.cont.add(" ").row();
                    fourDialog.cont.button("OK", () => {
                        fourDialog.hide();
                      
                        const fiveDialog = new BaseDialog(" ");
                        fiveDialog.cont.add(" ").row();
                        fiveDialog.cont.button("OK", () => {
                            fiveDialog.hide();
                          
                            const sixDialog = new BaseDialog(" ");
                            sixDialog.cont.add(" ").row();
                            sixDialog.cont.button("OK", () => {
                                sixDialog.hide();
                              
                                const sevenDialog = new BaseDialog(" ");
                                sevenDialog.cont.add(" ").row();
                                sevenDialog.cont.button("OK", () => {
                                    sevenDialog.hide();
                                  
                                    const eightDialog = new BaseDialog(" ");
                                    eightDialog.cont.add(" ").row();
                                    eightDialog.cont.button("OK", () => {
                                        eightDialog.hide();
                                      
                                        const nineDialog = new BaseDialog(" ");
                                        nineDialog.cont.add(" ").row();
                                        nineDialog.cont.button("OK", () => {
                                            nineDialog.hide();
                                          
                                            const tenDialog = new BaseDialog(" ");
                                            tenDialog.cont.add(" ").row();
                                            tenDialog.cont.button("OK", () => {
                                                tenDialog.hide();
                                              
                                                const elevenDialog = new BaseDialog(" ");
                                                elevenDialog.cont.add(" ").row();
                                                elevenDialog.cont.button("OK", () => {
                                                elevenDialog.hide();
                                              
                                                    const twelveDialog = new BaseDialog(" ");
                                                    twelveDialog.cont.add(" ").row();
                                                    twelveDialog.cont.button("OK", () => {
                                                    twelveDialog.hide();
                                                    
                                                        const thirteenDialog = new BaseDialog(" ");
                                                        thirteenDialog.cont.add(" ").row();
                                                        thirteenDialog.cont.button("OK", () => {
                                                        thirteenDialog.hide();
                                                        
                                                            const fourteenDialog = new BaseDialog(" ");
                                                            fourteenDialog.cont.add(" ").row();
                                                            fourteenDialog.cont.button("OK", () => {
                                                            fourteenDialog.hide();
                                                              
                                                                const fifteenDialog = new BaseDialog(" ");
                                                                fifteenDialog.cont.add(" ").row();
                                                                fifteenDialog.cont.button("OK", () => {fifteenDialog.hide();if(Core.settings.get("wentdowntherabbithole",false)){
                                                                 const again = new BaseDialog(" ");
    // ...

    https://github.com/camelStyleUser/popup-unforked/blob/main/scripts/main.js

    girixok149, 03 Августа 2023

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

    +2

    1. 1
    const disabledConditions = [!element.isDraft].some((v) => Boolean(v) === true);

    Из серии String(true).length === 4

    akosenko, 27 Июля 2023

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

    0

    1. 1
    https://github.com/HermanKirshin/MainBrainfuck/blob/main/_.cs

    "Если кому интересно - предлагаю угадать что делает этот код" (Ц)

    JloJle4Ka, 23 Июня 2023

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