Skip to content

Instantly share code, notes, and snippets.

View jonaszuberbuehler's full-sized avatar

Jonas Zuberbuehler jonaszuberbuehler

View GitHub Profile
@jonaszuberbuehler
jonaszuberbuehler / busy.interceptor.js
Last active February 19, 2016 16:21
http interceptor using angular-busy to show loading indicator
(function () {
'use strict';
angular
.module('app')
.config(['$httpProvider', function ($httpProvider) {
$httpProvider.interceptors.push('busyInterceptor');
}])
.factory('busyInterceptor', busyInterceptor);
@jonaszuberbuehler
jonaszuberbuehler / notification.service.js
Created April 20, 2016 14:27
angular material service to stack multiple toasts (demo at https://codepen.io/z00bs/pen/vGrjvX)
(function () {
'use strict';
angular
.module('app')
.service('Notification', Notification);
Notification.$inject = ['$mdToast', '$timeout'];
function Notification($mdToast, $timeout) {
var stack = [];
function isValidateSVNumber(toValidate) {
const number = toValidate.replaceAll('.', '');
if (number.length < 13) {
return false;
}
const parts = number.split('');
const checksum = parseInt(parts[parts.length - 1]);
const sum = parts.reverse().slice(1).reduce((sum, number, index) => {
if (index % 2 === 0) {
return sum + parseInt(number) * 3;