Nice input box with a lot of styling based on sibling selectors and psuedo classes.
CSS only, and WCAG 2.0 AA compliant!
A Pen by Andrew Tunnecliffe on CodePen.
/** | |
* Return the list if it is not empty, otherwise null | |
*/ | |
private fun <T>List<T>.notEmptyOrNull(): List<T>? = if (this.isEmpty()) null else this |
/** | |
* Split text into substrings of [size] characters. | |
* | |
* @param size the split size. | |
* @return an array of the split text. | |
*/ | |
private fun String.splitToNChar(size: Int): List<String> { | |
val parts = ArrayList<String>() | |
val length = this.length |
/* | |
Yoshua Bengio: | |
My preferred style of moving average is the following. Let's say you | |
have a series x_t and you want to estimate the mean m of previous | |
(recent) x's: | |
m <-- m + (2/t) (x_t - m) | |
Note that with (1/t) learning rate instead of (2/t) you get the exact |
/** | |
* Transform an Integer to a Byte Array. | |
* | |
* @param value the Integer | |
* | |
* @return the Byte Array | |
*/ | |
internal fun getByteArrayFromInt(value: Int): ByteArray { | |
val mask = 0xFF // binary 1111 1111 |
fun incrementalAverage(previousAverage: Double, value: Double, iterationIndex: Int): Double { | |
return (value - previousAverage) / (iterationIndex + 1) + previousAverage | |
} |
/* | |
* This program is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation, version 3. | |
* | |
* This program is distributed in the hope that it will be useful, but | |
* WITHOUT ANY WARRANTY; without even the implied warranty of | |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
* General Public License for more details. | |
* |
Nice input box with a lot of styling based on sibling selectors and psuedo classes.
CSS only, and WCAG 2.0 AA compliant!
A Pen by Andrew Tunnecliffe on CodePen.