This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.Normalizer | |
/** | |
* Extension function | |
*/ | |
fun String.slugify(): String = | |
Normalizer | |
.normalize(this, Normalizer.Form.NFD) | |
.replace("[^\\w\\s-]".toRegex(), "") // Remove all non-word, non-space or non-dash characters | |
.replace('-', ' ') // Replace dashes with spaces |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"strconv" | |
"strings" | |
) | |
func dec2hex(dec int) string { | |
color := dec * 255 / 100 |