Skip to content

Instantly share code, notes, and snippets.

@kiuKisas
kiuKisas / FpsDebounceEventListener.ts
Last active September 13, 2024 15:34
An identity function that debounce an event listener based on FPS
// identity function that debounce an event listener based on FPS
function fpsDebounceEventListener(listener: EventListener): EventListener {
let rafId: number;
// raf wrapper
const rafListener = (e: Event) => {
if (rafId) cancelAnimationFrame(rafId);
rafId = requestAnimationFrame(() => listener(e));
};
@kiuKisas
kiuKisas / svelteComponentRecaptcha.svelte
Created February 12, 2021 16:21
Svelte Recaptcha
// Due to the nature of svelte, implementing recaptcha inside a svelte component by following the official documentation
// can lead to DOM issue.
// The best way I find is to render the recaptcha inside onMount
<script>
import { onMount } from 'svelte';
onMount(async () => {
window.grecaptcha.ready(() => {
grecaptcha.render('recaptcha-id', { sitekey: YOUR_SITE_KEY })
@kiuKisas
kiuKisas / bonjourepi.user.js
Last active February 4, 2017 13:29
GreaseMonkey script that can allow you to access to secret bonjourMadame wrapper from Epitech Intranet !!
// ==UserScript==
// @name BonjourEpi
// @namespace BonjourEpi
// @description BonjourMadame sur l'intra d'Epitech ?
// @match https://intra.epitech.eu/*
// @version 1
// @grant none
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @run-at document-start
// ==/UserScript==