Skip to content

Instantly share code, notes, and snippets.

@star26bsd
star26bsd / ahv_validate.js
Last active January 6, 2024 09:19
JavaScript function to validate the Swiss AHV number
// Documentation: https://www.sozialversicherungsnummer.ch/aufbau-neu.htm
function isValidAHVNumber(ahvNumber) {
// Remove dots from the AHV number
let cleanedAhvNumber = ahvNumber.replace(/\./g, '');
if (!/^\d{13}$/.test(cleanedAhvNumber)) {
return false; // Checks if the AHV number is exactly 13 digits after removing dots
}
@star26bsd
star26bsd / fluent form age calculate
Last active November 6, 2022 09:16 — forked from alex-authlab/fluent form age calculate
Birthday Calculation in Fluent Form
// Age calculator
// 1. First take a Date picker & a text input field
// 2. In the text input element, add the element class 'age'
// 3. Add a custom element class 'date' in the date picker, then add the following js in your fluent form custom js
jQuery( ".date" ).change(function() {
var age = getAge(jQuery(this).val())
@star26bsd
star26bsd / mync.sh
Last active December 29, 2018 11:10
Convenience script for rsync - to check for availability of a locally mounted network share and mirror files one way using rsync.
#!/bin/bash
#
# Copyright (c) 2018 Stephan Rickauer <stephan@rickauer.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF