Snippets Collections
https://codepen.io/maikeldaloo/pen/MamXRm
//////////////////////---------JS
  var getChart = document.getElementById('myChart');

  if(getChart){
    function map1(){

      Chart.defaults.global.maintainAspectRatio = true;
      Chart.defaults.global.responsive = true;
      Chart.defaults.global.scaleFontSize = 17;
      Chart.defaults.global.tooltipFontFamily = '"proxima-nova","Helvetica Neue",Helvetica,Arial,sans-serif';
      Chart.defaults.global.scaleFontFamily = '"proxima-nova","Helvetica Neue",Helvetica,Arial,sans-serif';
      Chart.defaults.global.tooltipFontFamily = '"proxima-nova","Helvetica Neue",Helvetica,Arial,sans-serif';
      var data = {
        labels: ["1","5","10","15","20","25","30","35","40","45"],
        datasets: [
          {
            fillColor: "rgba(220,220,220,0)",
            strokeColor: "rgba(240,82,59,1)",
            pointColor: "rgba(240,82,59,1)",
            pointStrokeColor: "#fff",
            pointHighlightFill: "#fff",
            pointHighlightStroke: "rgba(240,82,59,1)",
            backgroundColor: 'rgba(240,82,59,1)',
            borderColor: 'rgba(240,82,59,1)',
            data: [10000.0, 648138.0, 1445810.0, 2243482.0, 3041154.0, 3838826.0, 4636498.0, 5434170.0, 6231842.0, 7189048.0],
            filp: true
          }
        ]
      };
      var ctx = document.getElementById("myChart").getContext("2d");
      var myLineChart = new Chart(ctx).Line(data);

    }

    map1();

  }
var getLi = document.querySelectorAll('.custom-menu-primary .hs-menu-wrapper > ul > li a');
  for (var i = 0; i < getLi.length; i++) {
    var className = getLi[i].innerText;
    var addClassName = className.replace(/\s+/g, "_");
    if (addClassName.length != 0) {
      getLi[i].parentNode.classList.add(addClassName.toLowerCase());
    }
  }
(function($) {
  $.fn.megamenu = function(options) {
    this.css({
      position: "relative",
      display: "block"
    });
    var settings = $.extend({
      triggerval: "+",
      label: "Back",
      title: !0,
      updataHeight: !0,
      animationSpeed: 300
    }, options);
    this.each((function() {
      $(".dl-back").each((function() {
        var labelval = $(this).parent().parent().children("a").text();
        $(this).children("a").text(labelval)
      }
                         ));
      var el = $(this);
      $(this).parent().css({
        overflow: "hidden"
      }),
        $(this).find("ul").prepend('<li class="dl-back"><a href="javascript:;">' + settings.label + "</a></li>"),
        $(this).find("ul").parent("li").children("a").after('<div class="child-trigger">' + settings.triggerval + "</div>"),
        jQuery(this).find("ul").attr("data-level", (function() {
        return "level-" + (jQuery(this).parents("ul").length + 1)
      }
                                                   ));
      var allmenu = $(this).find("ul");
      allmenu.width($(this).width()),
        allmenu.css("cssText", "position: absolute !important; top :0px; left:100%; display:none; width:100%"),
        $(".child-trigger").click((function() {
        if (el.animate({
          left: "-=100%"
        }, settings.animationSpeed),
            $(this).next("ul").css({
          display: "block"
        }),
            !0 === settings.updataHeight) {
          var updateHeight = $(this).next("ul").height();
          el.parent().css({
            height: updateHeight + "px"
          })
        }
      }
                                  )),
        $(".dl-back").click((function() {
        if ($(el).animate({
          left: "+=100%"
        }, settings.animationSpeed),
            $(this).parent("ul").css({
          display: "none"
        }),
            !0 === settings.updataHeight) {
          var reverseHeight = $(this).parent().parent().parent().height();
          el.parent().css({
            height: reverseHeight + "px"
          })
        }
      }
                            )),
        !0 === settings.title && $(".dl-back").each((function() {
        var labelval = $(this).parent().parent().children("a").text();
        $(this).children("a").text(labelval)
      }
                                                    ))
    }
              ))
  }
})(jQuery),
  $(".n-mobilenav .inner .hs-menu-wrapper>ul").megamenu({
  triggerval: "+",
  label: "Menu",
  title: !0,
  updataHeight: !0,
  animationSpeed: 400
});
jQuery(function ($) {
  $(".hs_banner .column .item a")
    .click(function (e) {
      var link = $(this);
      var item = link.parent(".item");
      if (item.hasClass("active")) {
        item.removeClass("active").children("a").removeClass("active");
      } else {
        item.addClass("active").children("a").addClass("active");
      }

      if (item.children(".tab-wrap").length > 0) {
        var href = link.attr("href");
        link.attr("href", "#");
        setTimeout(function () {
          link.attr("href", href);
        }, 300);
        e.preventDefault();
      }
    })
    .each(function () {
      var link = $(this);
      if (link.get(0).href === location.href) {
        link.addClass("active").parents(".item").addClass("active");
        return false;
      }
    });
});
$('header.header .cst-humburger-icon').click(function(){
  $('header.header ul.header__menu-wrapper > li ul.header__menu-submenu').slideUp(300);
  if($('.mobile-open').length){
      setTimeout(function(){
        $(".header__menu").addClass("hidden");           
      }, 300);
  }else{
      $(".header__menu").removeClass("hidden");
  }
})

$('.body-container-wrapper,.logo-section').click(function(){
  $('.container-wrapper').removeClass('mobile-open');
})


$('.timeline_wrp').parents('.dnd-section').addClass('timeline_wrp_dnd_wrap');

$(window).on('resize', function(){
  if($(".header__menu").filter(".hidden").length){
    $(".header__menu").removeClass("hidden");
  }
});

{% require_js %}
<script>
  var isIntersected = false;

  function runCounter(){
    const counters = document.querySelectorAll(".counter-gp .countern");
    counters.forEach((counter) => {
      counter.innerText = "0";



      const updateCounter = () => {
        const target = +counter.getAttribute("data-count");
        const c = +counter.innerText;
        var counterSpeed = +counter.getAttribute("data-speed");
        const increment = target / counterSpeed;
        if (c < target) {
          counter.innerText = `${Math.ceil(c + increment)}`;
          setTimeout(updateCounter, 1);
        } else {
          counter.innerText = target;
        }
      };
      updateCounter();
    });
  }

  var counterWrap = document.querySelector(".counter-gp");
  if(counterWrap){
    function checkOnScroll(cb){
      var counterWrap = document.querySelector(".counter-gp");
      if(counterWrap){
        runCounter();
        cb();
      }
    }
    var checkCounterSection = document.querySelector('.counter-gp');
    window.addEventListener("scroll",function() {
      var checkCounterSectionOffset = checkCounterSection.getBoundingClientRect().top;
      var clientHeight = document.documentElement.clientHeight;
      if ((checkCounterSectionOffset - clientHeight) <= 160) {
        if (!isIntersected) {
          checkCounterSection.classList.add('visible');
          if(checkCounterSection.classList.contains('visible')){
            checkOnScroll(function(){
              isIntersected = true;  
              console.log(isIntersected);
            });
          }
          else{
            isIntersected = false;
            console.log(isIntersected);
          }
        }
      }
    }, {
      passive: true,
    });
  }


</script>
{% end_require_js %}
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type (or see below for non wait option)
jQuery.noConflict();
$('.blog-post__body img').removeAttr('class')
$('.blog-post__body img').removeAttr('srcset')
$('.blog-post__body img').removeAttr('sizes')
$('.blog-post__body img').removeAttr('data-srcset')
$('.blog-post__body img').removeAttr('data-src')
$('.blog-post__body img').removeAttr('data-sizes')
$('.blog-post__body noscript').remove()
$('.post-body img').removeAttr('class')
$('.post-body img').removeAttr('srcset')
$('.post-body img').removeAttr('sizes')
$('.post-body img').removeAttr('data-srcset')
$('.post-body img').removeAttr('data-src')
$('.post-body img').removeAttr('data-sizes')
$('.post-body noscript').remove()
$(' h2.elementor-heading-title.elementor-size-default').removeAttr('class')
$(' h3.elementor-heading-title.elementor-size-default').removeAttr('class')
$(' h4.elementor-heading-title.elementor-size-default').removeAttr('class')
$('blockquote , blockquote *').removeAttr('class')
$('ul.elementor-icon-list-items , ul.elementor-icon-list-items  *').removeAttr('class')





6:12
$('.elementor-widget-container  span').removeAttr('data-ccp-props')
$('.elementor-widget-container  span').removeAttr('data-contrast')
$('.ne-title').click(function() {
                        $(this).parent().parent().parent().find('.ne-active').removeClass('ne-active');
                        $(this).parent().addClass('ne-active');
                        var index = $(this).data('features-item');
                        $(this).parent().parent().parent().parent().parent().find('.slick-slider').slick('slickGoTo', index);
                    });


$('#slick-slider').slick('refresh');
  $(window).scroll(function() {
    var winTop = $(this).scrollTop();
    $('.insight_post_wrap .row').each(function() {
      var eleID = $(this).attr('[data-attr="scroll"]');
      var eleTop = $(this).offset().top - 56;
      var eleHeight = $(this).height();
      var eleTopOffset = eleTop + eleHeight;
      $('.insight_post_wrap .post-side-menu ul>li>a').each(function() {
        var linkID = $(this).attr('href').indexOf('#') && $(this).attr('href').split('#')[1];
        if (linkID != undefined) {
          if (eleID === linkID) {
            if (winTop >= eleTop && winTop <= eleTopOffset) {
              $(this).parent().addClass('bookmark-active');
            } else {
              $(this).parent().removeClass('bookmark-active');
            }
          }
        }
      });
    });
  });
    $(document).scroll(function(){

      if (window.matchMedia("(max-width: 767px)").matches){
        $(".glossary-posting-right-wrapper").css({"margin-left": "","position":"","width":""});

      }
      else{
        if($(window).scrollTop()<=553){
          $(".glossary-posting-right-wrapper").css({"margin-top":$(window).scrollTop()});
        } 
      }
    });
$('.custom-menu-primary  ul li.has-submenu').each(function(){
    var alink = $(this).children('a').attr('href');
    var atext = $(this).children('a').text();
       $(this).children('ul').prepend('<li class="dl-back"><a href="javascript:void(0)">' + atext + '</a>');  
  });
var btnAnchor2 =  document.querySelectorAll('main .btn_item a[href*="#"]');
Array.prototype.slice.call(btnAnchor2).forEach(function(ele, index) {
  ele.addEventListener('click', function(e) {
    var headerWrap = document.querySelector('header .primary-section');
    var href = this.getAttribute("href");
    var getHash = href.split('#')[1];
    var elem = document.querySelector("#"+getHash);
    var headerHeight = headerWrap.offsetHeight;
    var newOff =  elem.offsetTop - headerHeight;
    console.log(headerHeight + 'header-height ');
    console.log( newOff +' off');

    smoothScrollBackToTop(e, newOff);
    e.stopPropagation();
    e.preventDefault();
  });
});

function smoothScrollBackToTop(e, targetPos=0) {
  e.preventDefault();
  var targetPosition = targetPos;
  var startPosition = window.pageYOffset;
  var distance = targetPosition - startPosition;
  var duration = 750;
  var start = null;
  window.requestAnimationFrame(step);
  function step(timestamp) {
    if (!start) start = timestamp;
    var progress = timestamp - start;
    window.scrollTo(0, easeInOutCubic(progress, startPosition, distance, duration));
    if (progress < duration) window.requestAnimationFrame(step);
  }
}
function easeInOutCubic(t, b, c, d) {
  t /= d/2;
  if (t < 1) return c/2*t*t*t + b;
  t -= 2;
  return c/2*(t*t*t + 2) + b;
};
      const units = ["bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];

      function niceBytes(x) {
        let l = 0,
          n = parseInt(x, 10) || 0;
        while (n >= 1000 && ++l) {
          n = n / 1000;
        }
        return n.toFixed(n < 10 && l > 0 ? 1 : 0) + " " + units[l];
      }
const formatter = new Intl.NumberFormat("en-IN", {
  style: "currency",
  currency: "INR",
  minimumFractionDigits: 0,
  maximumFractionDigits: 0,
  notation: "compact",
  compactDisplay: "short",
});

const rtf = new Intl.RelativeTimeFormat("en", {numeric: "auto"})
$(window).load(function() {
  setTimeout(function()  {
    var submitBtn = $('.wrapper .hs-form .actions > input[type="submit"]');
    submitBtn.parent().html(submitBtn.parent().html().replace(/input/g,"button"));
    $('.wrapper .hs-form .actions > button[type="submit"]').text(submitBtn.attr('value'));
  }, 100);
});
{{ require_js(get_asset_url('../js/stacktable.js')) }} 
// https://s3-us-west-2.amazonaws.com/s.cdpn.io/7635/stacktable.js

{% require_js %}
<script>
  $('table[data-stack]').stacktable({myClass:'stacked stacked--vertical'});
</script>
{% end_require_js %}


@media(min-width: 768px) {
    .stacked--vertical {
        display:none !important
    }
}
@media(max-width: 767px) {
    table[data-stack] {
        display:none !important
    }
}
var dynamicText = function() {
  var windowWidth = window.innerWidth;
  var dynamicTextContainers = document.querySelectorAll('.sqs-dynamic-text');

  for (var el of dynamicTextContainers) {
    var elementWidth = el.offsetWidth;
    var widthRatio = elementWidth / windowWidth * 100; 
    var existingRatio = el.getAttribute('data-width-percentage'); 


    if (elementWidth == windowWidth || existingRatio == widthRatio) {

      continue;
    } 

    el.setAttribute('data-width-percentage', widthRatio);
    el.style.fontSize = widthRatio + '%';

    var dynamicTextEls = document.querySelectorAll('.sqs-dynamic-text');
    for (var el of dynamicTextEls) {

//       el.style.fontSize = widthRatio + '%';

      for ( var p of el.children ){
        if ( parseInt(getComputedStyle(p).fontSize.replace("px", "")) <= 13 ) {
          p.style.fontSize = '13px';
        }
      }
    }



  }
};

dynamicText();
javascript: (function() {
var itemsLength = $('.hs_cos_wrapper_type_rich_text [class]:not(.hs-responsive-embed):not(.hs-responsive-embed-inner-wrapper):not(.hs-responsive-embed-iframe)').length;
itemsLength > 0 ? alert(`Classes in richtext content: ${itemsLength}`) : alert('No classes found in richtext content')
})();
<h3>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</h3>
<p>Donec commodo ante mauris, vel pretium ex semper at. Morbi dolor enim, faucibus sit amet blandit id, hendrerit et sem. Vivamus elit erat, finibus eleifend eleifend et, bibendum at velit. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque quis rutrum tortor, in malesuada tortor. Sed magna massa, faucibus non massa et, fringilla viverra sem. Integer suscipit, tellus non ultrices aliquam, nunc diam mattis ex, in <a href=“/#” rel=“noopener”>laoreet </a>lectus est in velit. Ut mattis posuere arcu in fringilla. Integer molestie sed purus id varius.</p>
<h2>Nunc ullamcorper in dolor sed pellentesque.</h2>
<p>Aliquam rutrum, sem eget congue congue, augue lectus lacinia massa, vitae <a href=“/#” rel=“noopener”>accumsan </a>augue nulla dapibus est. Etiam porta maximus lectus. Duis in mattis neque. Curabitur at mauris dictum, accumsan sem in, feugiat lacus. Etiam congue nisi leo, nec tincidunt nisi sodales at. Integer ipsum mi, gravida quis enim ac, porta suscipit <span style=“font-weight: bold;“>nunc</span>. Phasellus rutrum tellus eu risus condimentum, at sagittis tortor pharetra.</p>
<h4>Donec eget mauris feugiat, molestie velit non, vulputate nisi.</h4>
<p>Pellentesque quis condimentum nisl, sed placerat ligula. Duis metus sem, euismod nec quam ac, rhoncus facilisis mauris. Phasellus vitae mauris viverra, euismod lorem in, facilisis elit. Mauris consectetur, lectus eu pulvinar aliquet, augue erat maximus ex, et <span style=“font-weight: bold;“>commodo</span> lorem risus id elit. Nullam <span style=“font-weight: bold;“>ullamcorper</span> ut mi lacinia <a href=“/#” rel=“noopener”>malesuada</a>. Aenean rutrum libero sed dictum luctus. In dictum leo vitae rutrum interdum.</p>
<p>Curabitur sagittis, eros eget rhoncus tincidunt, nunc nisi molestie diam, vel venenatis nunc nulla a sapien. Sed lobortis arcu et purus dignissim, ut luctus est ultrices. In sed molestie sem, sed rutrum dolor. Ut posuere aliquam lobortis. Etiam mollis elit tellus, sit amet fermentum eros vehicula <span style=“font-weight: bold;“>eget</span>. Duis et finibus erat. Phasellus convallis rutrum dolor ut varius.</p>
<ul>
<li>Lorem ipsum dolor sit amet, <strong>consectetur</strong> adipiscing elit.</li>
<li>Donec quis augue id ipsum luctus placerat.</li>
<li>Nullam finibus diam nec nulla tincidunt, sed lobortis metus <a href=“/#” rel=“noopener”>bibendum</a>.</li>
<li>Ut a diam nec est bibendum <strong>ultrices</strong> quis venenatis leo.</li>
<li>Curabitur nec augue sit amet dui condimentum pretium a a leo.</li>
</ul>
<p>Suspendisse sollicitudin, lectus non lacinia porttitor, magna tellus vulputate ipsum, sed scelerisque magna nisi a magna. Sed accumsan, libero ut varius blandit, libero diam blandit justo, et dapibus neque est ac elit. Duis fringilla diam vel ligula fermentum tempor. Quisque urna magna, bibendum eu enim nec, fermentum consequat ex. Nam sed orci lobortis, volutpat risus mattis, eleifend purus. Morbi non tempor felis, quis ornare erat. Curabitur aliquet ut tellus vel laoreet. Nam condimentum dictum eros, quis lobortis diam viverra non. Vestibulum eleifend pretium porttitor.</p>
================================
Sample Blog by Hubspot Migrations Team
Sample HubSpot User
SampleHubSpotUser@hubspot.com
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using ‘Content here, content here’, making it look like readable English.
https://facebook.com
https://twitter.com
https://linkedin.com
$(function() {
        $('a[href*="#"]:not([href="#"])').click(function() {
            if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
    
                var target = $(this.hash);
                target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
                if (target.length) {
                    $('html,body').animate({
                        scrollTop: target.offset().top
                    }, 1000);
                    return false;
                }
            }
        });
    });
javascript: (function() {  var cookiesHTML = `<div id="hs-eu-cookie-confirmation" class="" data-nosnippet="">            <div id="hs-eu-cookie-confirmation-inner">              <div id="hs-eu-policy-wording">This website stores cookies on your computer. These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media. To find out more about the cookies we use, see our Privacy Policy.</div>              <p id="hs-eu-cookie-disclaimer">We won't track your information when you visit our site. But in order to comply with your preferences, we'll have to use just one tiny cookie so that you're not asked to make this choice again.</p>              <div id="hs-en-cookie-confirmation-buttons-area">                                <a href="javascript:void(0);" id="hs-eu-confirmation-button">    Accept  </a>                <a href="javascript:void(0);" id="hs-eu-decline-button">Decline</a>              </div>            </div>          </div>`;          document.body.insertAdjacentHTML('afterbegin', cookiesHTML)          })();
// for IE browser - object fit property
if ('objectFit' in document.documentElement.style === false) {
  $('.rec-post-wrap img.hs-featured-image').each(function(){
    var w = $(this).width();
    var h = $(this).height();
    var s = $(this).attr('src');
    var final = 'data:image/svg+xml,%3Csvg xmlns=\'http://www.w3.org/2000/svg\' width=\'' + w + '\' height=\'' + h + '\'%3E%3C/svg%3E';
    $(this).css('background','url('+s+') no-repeat 50% center \/cover');
    $(this).attr('src',final);
  });
}
window.addEventListener('load', function () {
  $(".hs-form .hs-form-field .hs-input").focus(function () {
    $(this).parent().parent().removeClass("blured");
    $(this).parent().parent().addClass("focused");
  }).blur(function () {
    $(this).parent().parent().removeClass("focused");
    $(this).parent().parent().addClass("blured");
  });

  $('.hs-form .hs-form-field .hs-input').on('keyup keydown', function () {
    if ($(this).val() !== "") {
      $(this).parent().parent().removeClass("blank");
      $(this).parent().parent().addClass("filled");
    }
    else {
      $(this).parent().parent().removeClass("focused");
      $(this).parent().parent().addClass("blank");
    }
  });
  $('.hs-form .hs-form-field .hs-input').blur(function () {
    if ($(this).val() == "") {
      $(this).parent().parent().removeClass("filled");
      $(this).parent().parent().addClass("blank");
    }
  });
});
var childMenu = document.querySelectorAll('.custom-menu-primary.visible-phone .hs-menu-wrapper > ul .hs-menu-item.hs-menu-depth-1.hs-item-has-children > a');
  Array.prototype.slice.call(childMenu).forEach(function (ele) {
    ele.insertAdjacentHTML('afterend', '<div class="child-trigger"></div>');
  });
function loadData() {
  var winURL = window.location.href.split('?')[0];
  var queryParams = $("#filterForm").serialize();
  var queryURL = winURL + '?' + queryParams;
  $('#yachts_items').load(queryURL + ' #yachts_items > *', function() {
    $('#yachts_items').attr('query', queryParams);
  });
}
function handle(e) {
  e.preventDefault();
  loadData();
}
$('#filterForm').submit(handle);
$('#filterForm select').change(handle);
var debounce;
$('#filterForm input').on('input', function(e) {
  clearTimeout(debounce);
  debounce = setTimeout(function() { 
    handle(e);
  }, 1000);
});
function goToNav(){
  $('.gallery-nav .sub-nav').click(function(e) {
    e.preventDefault();
    var slideno = $(this).attr('data-id');   
    var getIndex = $(".owl-item .gallery_item[data-group='"+slideno+"']").attr('data-slick-index');
    console.log('slideno',slideno,'getIndex',getIndex);
    setTimeout(function(){
      $('.owl-item').slick('slickGoTo', getIndex);
      console.log('check')
    },300)
  });
}


$(document).ready(function(){
  goToNav()
})

$(document).load(function(){
  goToNav()
})
$('.custom-menu-primary ul li > a > .menu-item-text').each(function () {
  if ($(this).html().indexOf('<br>') != -1) {
    var title = $(this).html().split('<br>')[0];
    var desc = $(this).html().split('<br>')[1];
    if (title == undefined) {
      var titleText = '';
    } else {
      var titleText = '<span class="menu-text">' + title + '</span>';
    }
    if (desc == undefined) {
      var descText = '';
    } else {
      var descText = '<span class="menu-desc">' + desc + '</span>';
    }
    var finalText = titleText + descText;
    $(this).html(finalText);
  }
});
Celo Composer CLI
? Choose front-end framework: React
? Choose web3 library for react app: rainbowkit-celo
? Choose smart-contract framework: Hardhat
? Create a subgraph: No
? Project name:  crowdfunding_celo_dapp
Celo Composer CLI
? Choose front-end framework: React
? Choose web3 library for react app: rainbowkit-celo
? Choose smart-contract framework: Hardhat
? Create a subgraph: (Use arrow keys)
  Yes 
❯ No 
Celo Composer CLI
? Choose front-end framework: React
? Choose web3 library for react app: rainbowkit-celo
? Choose smart-contract framework: (Use arrow keys)
❯ Hardhat 
  Truffle 
  None 


Celo Composer CLI
? Choose front-end framework: React
? Choose web3 library for react app: (Use arrow keys)
  react-celo 
❯ rainbowkit-celo 

Celo Composer CLI
? Choose front-end framework: (Use arrow keys)
❯ React 
  React Native (With Expo) 
  React Native (without Expo) 
  Flutter 
  Angular 

npx @celo/celo-composer create
public static float DamageCalculation(PlayerStats attackerStats, PlayerStats receiverStats)
    {
        // Damage calculation
        float physicalDamage = attackerStats.physicalDamage;
        float magicDamage = attackerStats.magicDamage;
        
        // Resistance Calculation
        float enemyArmor = (receiverStats.armor - attackerStats.armorPenetrationFlat) * (1 - attackerStats.armorPenetrationPercentage);
        enemyArmor = (enemyArmor > 0) ? enemyArmor : 0;
        float physicalDamageReduction = Mathf.Exp(-(enemyArmor / 50));
        
        float enemyMagicResistance = (receiverStats.magicResistance - attackerStats.magicPenetrationFlat) * (1 - attackerStats.magicPenetrationPercentage);
        enemyMagicResistance = (enemyMagicResistance > 0) ? enemyMagicResistance : 0;
        float magicDamageReduction = Mathf.Exp(-(enemyMagicResistance / 50));

        return physicalDamage * physicalDamageReduction + magicDamage * magicDamageReduction;
    }
>>> import shutil, os

>>> os.chdir('C:\\')
>>> shutil.copy('C:\\spam.txt', 'C:\\delicious')
# C:\\delicious\\spam.txt'

>>> shutil.copy('eggs.txt', 'C:\\delicious\\eggs2.txt')
# 'C:\\delicious\\eggs2.txt'
>>> import os
>>> os.makedirs('C:\\delicious\\walnut\\waffles')
>>> import os

>>> os.getcwd()
# 'C:\\Python34'
>>> os.chdir('C:\\Windows\\System32')

>>> os.getcwd()
# 'C:\\Windows\\System32'
>>> my_files = ['accounts.txt', 'details.csv', 'invite.docx']

>>> for filename in my_files:
...     print(os.path.join('C:\\Users\\asweigart', filename))
...
# C:\Users\asweigart\accounts.txt
# C:\Users\asweigart\details.csv
# C:\Users\asweigart\invite.docx
import csv

import json



# Open the JSON file

with open('data.json') as json_file:

    data = json.load(json_file)



# Create a new CSV file and write the data

with open('data.csv', 'w', newline='') as csv_file:

    writer = csv.DictWriter(csv_file, fieldnames=data[0].keys())

    writer.writeheader()

    for row in data:

        writer.writerow(row)
sudo apt-get install wget g++ make expat libexpat1-dev zlib1g-dev
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
set<string> sem;

void solve(string s, int i) {
    if (i == s.size()) {
        sem.insert(s);
        return;
    }
    for (int k = i; k < s.size(); k++) {
        swap(s[i], s[k]);
        solve(s, i + 1);
        swap(s[i], s[k]);
    }
}

int main() {
    string s = "hello";
    solve(s, 0);
    cout << sem.size() << endl;
    for (auto it = sem.begin(); it != sem.end(); it++) {
        cout << *it << endl;
    }
    return 0;
}
function alphabetPosition(text) {
 return /[a-z]/ig.test(text) ? text.toLowerCase().match(/[a-z]/g).map((letter) => letter.charCodeAt(letter) - 96).join(' ') : ""
}
function pigIt(str){
  return str.replace(/(\w)(\w*)(\s|$)/g, "\$2\$1ay\$3")
}
star

Sun Sep 24 2023 17:55:24 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 17:41:29 GMT+0000 (Coordinated Universal Time) https://github.com/santoshs-twp/Migration-Boilerplate-Module-Library/tree/main/src/modules

@sagarmaurya19

star

Sun Sep 24 2023 17:36:57 GMT+0000 (Coordinated Universal Time) https://files.slack.com/files-pri/T012UT9EH8D-F03Q0MCUM40/infinitescroll-masonry-new.js

@sagarmaurya19

star

Sun Sep 24 2023 17:16:14 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 16:18:27 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 16:17:42 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 16:09:04 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 16:07:08 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 16:04:18 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 16:02:11 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 15:56:00 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 15:54:39 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 15:13:01 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 15:01:30 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 14:34:29 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/15900485/correct-way-to-convert-size-in-bytes-to-kb-mb-gb-in-javascript

@StephenThevar #javascript

star

Sun Sep 24 2023 14:07:18 GMT+0000 (Coordinated Universal Time) stack overflow

@StephenThevar #javascript

star

Sun Sep 24 2023 14:02:20 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 14:00:30 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 13:32:05 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 13:11:22 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 13:08:30 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 13:03:53 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 13:02:47 GMT+0000 (Coordinated Universal Time) https://www.programiz.com/c-programming/online-compiler/

@musmanhamed #c

star

Sun Sep 24 2023 13:01:44 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 12:59:33 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 12:34:11 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 12:28:53 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 12:28:04 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 12:19:17 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 12:08:26 GMT+0000 (Coordinated Universal Time)

@sagarmaurya19

star

Sun Sep 24 2023 09:38:44 GMT+0000 (Coordinated Universal Time) https://www.programiz.com/c-programming/online-compiler/

@musmanhamed #c

star

Sun Sep 24 2023 08:42:25 GMT+0000 (Coordinated Universal Time)

@azeezabidoye

star

Sun Sep 24 2023 08:00:20 GMT+0000 (Coordinated Universal Time)

@azeezabidoye

star

Sun Sep 24 2023 07:56:58 GMT+0000 (Coordinated Universal Time)

@azeezabidoye

star

Sun Sep 24 2023 07:52:04 GMT+0000 (Coordinated Universal Time)

@azeezabidoye

star

Sun Sep 24 2023 07:49:42 GMT+0000 (Coordinated Universal Time)

@azeezabidoye

star

Sun Sep 24 2023 07:47:28 GMT+0000 (Coordinated Universal Time)

@azeezabidoye

star

Sun Sep 24 2023 07:45:03 GMT+0000 (Coordinated Universal Time)

@azeezabidoye

star

Sun Sep 24 2023 07:43:45 GMT+0000 (Coordinated Universal Time)

@azeezabidoye

star

Sun Sep 24 2023 07:34:45 GMT+0000 (Coordinated Universal Time)

@azeezabidoye

star

Sun Sep 24 2023 03:38:00 GMT+0000 (Coordinated Universal Time)

@BenjiSt #c#

star

Sun Sep 24 2023 02:10:51 GMT+0000 (Coordinated Universal Time) https://www.pythoncheatsheet.org/cheatsheet/file-directory-path

@OperationsBGSC #python

star

Sun Sep 24 2023 02:10:04 GMT+0000 (Coordinated Universal Time) https://www.pythoncheatsheet.org/cheatsheet/file-directory-path

@OperationsBGSC #python

star

Sun Sep 24 2023 02:09:50 GMT+0000 (Coordinated Universal Time) https://www.pythoncheatsheet.org/cheatsheet/file-directory-path

@OperationsBGSC #python

star

Sun Sep 24 2023 02:09:34 GMT+0000 (Coordinated Universal Time) https://www.pythoncheatsheet.org/cheatsheet/file-directory-path

@OperationsBGSC #python

star

Sun Sep 24 2023 01:29:37 GMT+0000 (Coordinated Universal Time) https://codebeautify.org/blog/convert-json-to-csv-using-python/

@OperationsBGSC #python

star

Sun Sep 24 2023 01:26:56 GMT+0000 (Coordinated Universal Time) http://overpass-api.de/no_frills.html

@brooke.delwolf

star

Sat Sep 23 2023 18:17:04 GMT+0000 (Coordinated Universal Time)

@hs1710

star

Sat Sep 23 2023 15:04:40 GMT+0000 (Coordinated Universal Time) https://www.codewars.com/kata/546f922b54af40e1e90001da/solutions/javascript

@Paloma

star

Sat Sep 23 2023 15:01:45 GMT+0000 (Coordinated Universal Time) https://www.codewars.com/kata/520b9d2ad5c005041100000f/solutions/javascript

@Paloma

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension