Skip to content

Instantly share code, notes, and snippets.

@duboisf
Created September 19, 2022 12:45
Show Gist options
  • Save duboisf/c57960d414f1ab1a9e95c4853c9c1468 to your computer and use it in GitHub Desktop.
Save duboisf/c57960d414f1ab1a9e95c4853c9c1468 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"os"
)
func forEachInRange(start, end int, title string, callback func(int)) {
if start > end {
fmt.Fprintf(os.Stderr, "start %q must be smaller than end %q", start, end)
return
}
if start < end {
fmt.Printf("%s (%x - %x):\n", title, start, end)
} else {
fmt.Printf("%s (%x):\n", title, start)
}
for hexCode := start; hexCode <= end; hexCode++ {
callback(hexCode)
}
fmt.Println()
}
func main() {
for _, line := range []struct{start, end int; title string}{
{0x23fb, 0x23fe, "IEC Power Symbols"},
{0x2665, 0x2665, "Octicons"},
{0x26a1, 0x26a1, "Octicons"},
{0x2b58, 0x2b58, "IEC Power Symbols"},
{0xe000, 0xe00a, "Pomicons"},
{0xe0a0, 0xe0a2, "Powerline"},
{0xe0a3, 0xe0a3, "Powerline Extra"},
{0xe0b0, 0xe0b3, "Powerline"},
{0xe0b4, 0xe0c8, "Powerline Extra"},
{0xe0ca, 0xe0ca, "Powerline Extra"},
{0xe0cc, 0xe0d4, "Powerline Extra"},
{0xe200, 0xe2a9, "Font Awesome Extension"},
{0xe300, 0xe3eb, "Weather Icons"},
{0xe5fa, 0xe631, "Seti-UI + Custom"},
{0xe700, 0xe7c5, "Devicons"},
{0xea60, 0xebeb, "Codicons"},
{0xf000, 0xf2e0, "Font Awesome"},
{0xf300, 0xf32f, "Font Logos (Formerly Font Linux)"},
{0xf400, 0xf4a8, "Octicons"},
{0xf4a9, 0xf4a9, "Octicons"},
{0xf500, 0xfd46, "Material Design"},
} {
forEachInRange(line.start, line.end, line.title, func(hexCode int) { fmt.Printf("%c", hexCode) })
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment