This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Upgrading | |
-- PL/pgSQL function to “upgrade” all serial columns to new identity column. | |
-- Source: https://www.enterprisedb.com/blog/postgresql-10-identity-columns-explained | |
-- Call it: SELECT upgrade_serial_to_identity('test_old', 'id'); | |
CREATE OR REPLACE FUNCTION upgrade_serial_to_identity(tbl regclass, col name) | |
RETURNS void | |
LANGUAGE plpgsql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Before running this script | |
# - export the attendance XLS from the NDS system. | |
# - convert it to CSV format using LibreOffice or a similar tool, UTF-8 encoded, comma-separated. | |
# | |
# DO NOT remove or change data and DO NOT change its name! | |
# | |
# Hosted on https://gist.github.com/star26bsd/b4b07339238e63b5deb033989d67bf84 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |