Skip to content

Instantly share code, notes, and snippets.

View wottpal's full-sized avatar

Dennis Zoma wottpal

View GitHub Profile
@wottpal
wottpal / date-formats.ts
Created April 18, 2019 15:10
Custom DateFormats & DateAdapter for Angular Material MatDatepicker using Day.js
import { Platform } from '@angular/cdk/platform';
import { NativeDateAdapter } from '@angular/material';
import * as dayjs from 'dayjs';
import 'dayjs/locale/de';
import * as customParseFormat from 'dayjs/plugin/customParseFormat';
import * as localizedFormat from 'dayjs/plugin/localizedFormat';
/**
* Custom Date-Formats and Adapter (using https://github.com/iamkun/dayjs)
@wottpal
wottpal / counter.component.ts
Last active March 25, 2020 17:36
Simple Angular Counter/Countdown Component with dayjs & rxjs
/**
*
* Example Usage:
*
* # Counter
* const now = dayjs()
* <app-counter [autostart]="true" [mode]="forwards" [startTime]="now"></app-counter>
*
* # Countdown
* const later = dayjs().add(1, 'minute')
@wottpal
wottpal / form.service.ts
Last active April 21, 2021 14:55
Angular Service to synchronize FormGroup(s) with LocalStorage (get & set)
import { Injectable } from '@angular/core';
import { FormGroup, FormControl } from '@angular/forms';
import * as dayjs from 'dayjs'
@Injectable({
providedIn: 'root'
})
export class FormService {
#! -*- coding: utf-8 -*-
import sys
import time
import numpy as np
import gensim
import matplotlib.pyplot as plt
from matplotlib import font_manager, rc
from sklearn.manifold import TSNE
from sklearn.cluster import MiniBatchKMeans
def VGG_16_BN(input_shape):
model = models.Sequential()
model.add(Convolution2D(64, (3,3), input_shape=input_shape, activation='relu', padding='same', use_bias=False))
model.add(BatchNormalization())
model.add(Convolution2D(64, (3,3), activation='relu', padding='same', use_bias=False))
model.add(BatchNormalization())
model.add(MaxPooling2D((2,2), strides=(2,2)))
model.add(Convolution2D(128, (3,3), activation='relu', padding='same', use_bias=False))
model.add(BatchNormalization())

Simple Contact-Form in Kirby 3

As a starting point I've used the latest Starterkit (Beta 4) combined with the core from the latest Nightly Build (18-08-06).

First, set email-properties in your config. I would recommend using a mail-service like Mailgun (via SMTP) because setting everything up on your own server is cumbersome, error-prone, and unsecure. But of course, it's up to you.

site/config/config.php:

<?php
@wottpal
wottpal / kirby-nginx
Last active November 15, 2018 19:20
#######################
#######################
# KIRBY-CONFIGURATION #
# block content
location ~ ^/content/(.*).(txt|md|mdown)$
{
rewrite ^/content/(.*).(txt|md|mdown)$ /error redirect;
}
@wottpal
wottpal / debug.js
Last active April 19, 2018 10:22
A convenience wrapper around the Console API which adds several functionalities.
/**
* A convenience wrapper around the Console API which adds:
* - Logging has to be globally enabled first (in a dev-environment)
* - Even when disabled logged messages are cached and can be displayed later
* - Prefix messages with a custom〈 Label 〉
*
* TODO Maybe add verbose-flag to really be able to log everything if needed
**/
@wottpal
wottpal / exp-027.js
Last active February 10, 2018 09:30
* numberOfPoints defines amount of points * respects frameWidth * returns array of triangles in the format [ [[x1, y1],[x2, y2],[x3, y3]], ... ]
function triangulateCanvas() {
let points = [], triangles = []
for (let i = 0; i < numberOfPoints; i++) {
const randomX = random(frameWidth, WIDTH-frameWidth)
const randomY = random(frameWidth, HEIGHT-frameWidth)
points.push([
constrain(randomX, frameWidth, WIDTH-frameWidth),
constrain(randomY, frameWidth, HEIGHT-frameWidth)
@wottpal
wottpal / relative-time.php
Last active October 21, 2017 16:38 — forked from mtttmpl/relative-time.php
Get Relative Time in PHP (e.g. '1 hour ago', 'yesterday', 'tomorrow', 'in 2 weeks'). With the argument $max_diff you can specify the number of days from when the actual date should be returned.
<?php
/**
* Get Relative Time in PHP (e.g. '1 hour ago', 'yesterday', 'tomorrow', 'in 2 weeks').
* With the argument `$max_diff` you can specify the number of days from when the
* actual date should be returned witht the format of `$date_format`.
*
* Gist: https://gist.github.com/wottpal/61bc13425a8cedcd88666040d1449bfd
* Fork of: https://gist.github.com/mattytemple/3804571
*/