Snippets Collections
/**
 if rerendering occurs or to stop duplicate events

if (button.dataset.recShareTracked) return;
button.dataset.recShareTracked = "true";

*/



// example

 function recShareTracking() {
        const recUserActions = document.querySelector(".rec-user-actions");

        if (!recUserActions) return;

        const shareButtons = recUserActions.querySelectorAll(
            ".rec-user-actions__cta-button",
        );

        if (!shareButtons.length) return;

        console.log({shareButtons})

        shareButtons.forEach((button) => {
            // Prevent duplicate listeners
            if (button.dataset.recShareTracked) return;
            button.dataset.recShareTracked = "true";

            button.addEventListener("click", (e) => {
                const clickedElement = e.target;
                const isButtonClick =
                    clickedElement === button ||
                    clickedElement.closest(".rec-user-actions__cta-button") ===
                        button;

                if (!isButtonClick) return;

                const buttonTextRaw = button.textContent?.trim() || "";
                const buttonText = buttonTextRaw.replace(/\s+/g, " ").trim() || "";

                if (buttonText) {
                    gtmPush({
                        event: "interaction_click",
                        component_name: "button",
                        click_text: buttonText,
                        click_url: null,
                    });
                }
            });
        });
    }
#include <iostream>
using namespace std;

void rotate(int arr[], int n, int k) {
    // Create a new array to store rotated elements
    int rotatedArr[n];

    // Copy the elements from the original array to the rotated array
    for (int i = 0; i < n; i++) {
        rotatedArr[i] = arr[(i + k) % n];
    }

    // Print the rotated array
    for (int i = 0; i < n; i++) {
        cout << rotatedArr[i] << " ";
    }
}

int main() {
    int n, k;
    cin >> n;//

    int* arr = new int[n];
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }

    cin >> k;

    rotate(arr, n, k);

    delete[] arr;
    return 0;
}
#include <iostream>
using namespace std;

int main() {
    //Write your code here
    int n;
    cin>>n;

    int* arr = new int [n];

    for(int i = 0; i < n; i++){
        cin>>arr[i];
    }
    for(int i = n-1 ; i >= 0; i--){
        cout<<arr[i]<<" ";
    }

    return 0;
}
const numbers = [1, 2, 3, 4, 5, 7, 3, 2, 2, 5];
const updated = [...new Set(numbers)]; // result [1, 2, 3, 4, 5, 7]
export const scrollTo = (distance) => {
    window.scrollTo({
        top: distance,
        behavior: 'smooth'
    })
}

export const scrollToTop = () => scrollTo(0)
select "field1", "field2", count(*)
from "tableName"
group by "field1", "field2"
HAVING count(*) > 1

/*
Client callable script include used for filtering sys_user lists
to identify duplication email users
name: duplicateEmail
active: true
client callabe: true
*/
function duplicateEmail() {
    var xx = new GlideAggregate('sys_user');
    xx.addAggregate('COUNT', 'email');
    xx.addHaving('COUNT', 'email', '>', '1');
    xx.query();
    var answer = new Array();
    while (xx.next()) {
        answer.push(xx.getValue('email'));
    }
    return answer;
}
star

Wed Jan 21 2026 03:22:42 GMT+0000 (Coordinated Universal Time)

#dataset #prevent #duplicate #event #listener
star

Tue Aug 08 2023 20:46:13 GMT+0000 (Coordinated Universal Time)

#arr #duplicate #search #rotate
star

Tue Aug 08 2023 19:44:50 GMT+0000 (Coordinated Universal Time)

#arr #duplicate #search
star

Thu Oct 06 2022 05:53:45 GMT+0000 (Coordinated Universal Time)

#javascript #array #duplicate
star

Wed Jan 19 2022 14:10:03 GMT+0000 (Coordinated Universal Time)

#javascript #remove #duplicate
star

Mon Jan 03 2022 02:32:45 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/

#sql #postgres #duplicate
star

Tue Jan 26 2021 15:41:52 GMT+0000 (Coordinated Universal Time) https://community.servicenow.com/community?id

#servicenow #javascript #duplicate

Save snippets that work with our extensions

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