Snippets Collections
ol.custom-ordered-list{
       counter-reset: list-counter; /* Initialize the counter */
        list-style: none; /* Remove default list styling */
        padding-left: 0; /* Remove default padding */       
    li{
            counter-increment: list-counter; /* Increment the counter */
            position: relative; /* Positioning for the pseudo-element */
            padding-left: 60px; /* Space for the counter */
            padding-bottom: 12px;
            line-height: 30px;
            left: 0;
        
        &:before{
            content: counter(list-counter, decimal-leading-zero) ""; /* Display the counter with leading zeros */
            position: absolute; /* Position it absolutely within the list item */
            left: 0; /* Align it to the left */
            width: 2em; /* Width for the counter */
            text-align: right; /* Align text to the right */
            font-size: 24px;
            font-weight: bold;
            color: #2E844B;
        }
    }
}
var secondsRemaining = 60    
Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { (Timer) in
        if secondsRemaining > 0 {
            print ("\(self.secondsRemaining) seconds")
            secondsRemaining -= 1
        } else {
            Timer.invalidate()
        }
    }
import React, { useState } from "react";
import "./App.css";

const App = () => {
  const [counterA, setCounterA] = useState(0);
  const [counterB, setCounterB] = useState(0);

  return (
    <div>
      <button
        onClick={() => {
          setCounterA(counterA + 1);
        }}
      >
        Increment A
      </button>
      <button
        onClick={() => {
          setCounterB(counterB + 1);
        }}
      >
        Increment B
      </button>
      <div>counterA: {counterA}</div>
      <div>counterB: {counterB}</div>
    </div>
  );
};

export default App;
from collections import defaultdict, namedtuple, Counter, deque

Counter(words).most_common(6)
function animationInterval(ms, signal, callback) {
  // Prefer currentTime, as it'll better sync animtions queued in the
  // same frame, but if it isn't supported, performance.now() is fine.
  const start = document.timeline
  ? document.timeline.currentTime
  : performance.now();

  function frame(time) {
    if (signal.aborted) return;
    callback(time);
    scheduleFrame(time);
  }

  function scheduleFrame(time) {
    const elapsed = time - start;
    const roundedElapsed = Math.round(elapsed / ms) * ms;
    const targetNext = start + roundedElapsed + ms;
    const delay = targetNext - performance.now();
    setTimeout(() => requestAnimationFrame(frame), delay);
  }

  scheduleFrame(start);
}
star

Tue May 28 2024 23:21:01 GMT+0000 (Coordinated Universal Time)

#counter #css
star

Wed Apr 05 2023 15:59:39 GMT+0000 (Coordinated Universal Time) https://codetogo.io/

#javascript #counter #count
star

Tue Feb 01 2022 07:12:29 GMT+0000 (Coordinated Universal Time)

#ios #swift #timer #counter #count #countdown
star

Wed Jun 30 2021 08:17:32 GMT+0000 (Coordinated Universal Time)

#react.js #usestate #setstate #counter
star

Wed May 26 2021 18:02:58 GMT+0000 (Coordinated Universal Time)

#python #counter
star

Sat Mar 27 2021 13:23:33 GMT+0000 (Coordinated Universal Time)

#javascript #counter #timer

Save snippets that work with our extensions

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