Instantly share code, notes, and snippets.

View index.html
<template id="oi-template">
<table class="oi-card0">
<tr>
<th colspan="2">Month</th>
</tr>
<tr>
<td>Deckungsumme</td>
<td type="{{deckungsumme.type}}">{{deckungsumme.value}}</td>
</tr>
<tr>
View OneTimeDirective.ts
// https://github.com/angular/angular/issues/14033
@Directive({
selector: '[oneTime]',
})
export class OneTimeDirective {
constructor(template: TemplateRef<any>, container: ViewContainerRef, zone: NgZone) {
zone.runOutsideAngular(() => {
const view = container.createEmbeddedView(template);
setTimeout(() => view.detach());
View svgfixer-clip-paths.js
// Original: https://gist.github.com/leonderijke/c5cf7c5b2e424c0061d2
(function(document, window) {
"use strict";
document.addEventListener("DOMContentLoaded", function() {
var baseUrl = window.location.href
.replace(window.location.hash, "");
[].slice.call(document.querySelectorAll("use[*|href]"))
View svgfixer.js
/**
* SVG Fixer
*
* Fixes references to inline SVG elements when the <base> tag is in use.
* Firefox won't display SVG icons referenced with
* `<svg><use xlink:href="#id-of-icon-def"></use></svg>` when the <base> tag is on the page.
*
* More info:
* - http://stackoverflow.com/a/18265336/796152
* - http://www.w3.org/TR/SVG/linking.html
View $di.ts
/**
* $di.ts
* http://www.xperiments.io/posts/typescript-angularjs-best-practices/
* xperiments on 15/07/14.
*/
module $di
{
/* service */
export class $ng
{
View TypescriptSerializer
module io.xperiments.utils.serialize
{
/**
* The mini
*/
export interface ISerializableObject
{
"@serializable":string;
}
export interface ISerializable extends ISerializableObject
View interlval.js
// http://www.thecodeship.com/web-development/alternative-to-javascript-evil-setinterval/
function interval(func, wait, times){
var interv = function(w, t){
return function(){
if(typeof t === "undefined" || t-- > 0){
setTimeout(interv, w);
try{
func.call(null);
}
catch(e){
View dload.js
// Code snippets for dynamically loading JavaScript and CSS
// Copyright : This script has been placed in the public domain.
// Gist : https://gist.github.com/livibetter/5211293
// Blog post : http://blog.yjl.im/2013/03/dynamically-loading-javascript-and-css.html
// Last update : 2013-03-21T07:35:25Z
// Author : Yu-Jie Lin
// Website : http://yjl.im
function load_CSS(src, cb) {
var link = document.createElement('link');
View xhr2base64.js
function getBinary(file){
var xhr = new XMLHttpRequest();
xhr.open("GET", file, false);
xhr.overrideMimeType("text/plain; charset=x-user-defined");
xhr.send(null);
return xhr.responseText;
}
function base64Encode(str) {
var CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";