Skip to content

Instantly share code, notes, and snippets.

@esserj
esserj / InternationalBankAccountNumber.php
Last active January 9, 2023 21:30
Validated formats and parses iban's as per the specifications prefered way, found here: https://www.swift.com/sites/default/files/resources/swift_standards_ibanregistry.pdf
<?php
/**
* @author Esser Jan
* @license MIT
* @example InternationalBankAccountNumber::createFromString($someString)
* @example InternationalBankAccountNumber::createFromString($someString)->toFormattedString() // space separated
* @example InternationalBankAccountNumber::createFromString($someString)->toFormattedString('-', 4, true) // IBAN prefixed - separated
*/
class InternationalBankAccountNumber
{
@esserj
esserj / gist:b99fb49480961026aec0
Last active August 29, 2015 14:08
Tickspot timer reminder bookmarklet
javascript:function _bm_clearTimer() { if (_bm_timerIntervalId !== undefined){ clearInterval(_bm_timerIntervalId); } }; _bm_clearTimer(); var _bm_timerIntervalId, _bm_notify = function (msg) { if (Notification.permission === 'granted') { var n = new Notification('Tickspot notification', {body: msg, icon:'favicon.png', lang: 'EN-US'});n.onclick = function () { window.focus(); this.cancel(); } } else if(Notification.permission !== 'denied') { Notification.requestPermission(function (permission) { Notification.permission = permission; _bm_notify(msg); }) } }, _bm_timerTest = function () { if ($('.entries.timer .entry').length <= 0) { _bm_notify('No running timer found!'); }}, _bm_prompt = prompt('Every how many minutes would you like to receive notifications? disable with -1.', '5'); if (_bm_prompt === '-1') {_bm_clearTimer(); _bm_notify('Timer reminder deactivated'); } else { _bm_timerIntervalId = setInterval(_bm_timerTest, _bm_prompt * 60*1000); _bm_notify('Timer reminder activated');}