Skip to content

Instantly share code, notes, and snippets.

@leon-domingo
leon-domingo / validar-cups.js
Last active February 24, 2025 07:13
Función para validar el CUPS (Código Unificado de Punto de Suministro)
/**
* Valida un CUPS (Código Unificado de Punto de Suministro) dado
* @param {string} CUPS Código CUPS que se quiere verificar. Más información aquí: https://es.wikipedia.org/wiki/C%C3%B3digo_Unificado_de_Punto_de_Suministro
* @returns Resultado de la verificación. `true` si el CUPS dado es correcto, o `false` en caso contrario.
*/
function validarCUPS(CUPS) {
let ret = false;
const reCUPS = /^[A-Z]{2}(\d{4}\d{12})([A-Z]{2})(\d[FPCRXYZ])?$/i;
if (reCUPS.test(CUPS)) {
const mCUPS = CUPS.toUpperCase().match(reCUPS);
@sphingu
sphingu / Dynamic_Load_On_Scroll_Jquery.html
Created June 20, 2013 12:37
Loading content on scroll to bottom on page using Jquery
<html>
<head>
<title>Scroll to bottom Detection</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
var count=0;
$(document).ready(function(){
SetValues();
$(window).scroll(function(){
//Will check if the user has reached bottom of a PAGE
@gre
gre / easing.js
Last active September 5, 2025 07:01
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {