Skip to content

Commit

Permalink
improve collection sorter
Browse files Browse the repository at this point in the history
  • Loading branch information
oskar2517 committed Dec 18, 2024
1 parent 4eeeb88 commit d5266fc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
3 changes: 1 addition & 2 deletions sorter.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ FILE = "static/collection.txt"
lines = File.read_lines(FILE)

sorted = lines.slice_when(&.empty?)
.map { |g| [g.first, *g[1..].reject(&.empty?).sort_by { |i| i.split[2] }, " "] }
.flatten
.flat_map { |g| [g.first, *g[1..].reject(&.empty?).sort_by { |i| i.split[2..] }, ""] }
.join("\n")

File.write(FILE, sorted)
15 changes: 7 additions & 8 deletions static/collection.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ Nixies:
- 2x ZM1120
- 4x ZM1242
- 4x ZM1336K

Dekatrons:
- 6x ZM1070

Nomotrons:
- 1x 11TU7
- 2x G10/241E

Numitrons:
- 10x DR2010 (2x convex top, 8x flat top)
- 1x DTF104B

VFDs:
- 2x DT-1704B (Digivac)
- 6x IV-12
Expand All @@ -45,7 +45,7 @@ VFDs:
- ~60x IV-6
- 1x IVL1-8/12
- 1x IVL2-7/5

Magic Eyes:
- 1x 6E1P
- 2x 6E5
Expand All @@ -63,7 +63,7 @@ Magic Eyes:
- 2x UM11
- 4x UM80
- 1x UM85

Other:
- 2x E1T
- ~100x IV-3
Expand All @@ -74,7 +74,6 @@ Other:
- 1x XC18
- 2x Z550M/ZM1050
- 1x Z700U

Devices:
- 1x Sharp Compet 23

0 comments on commit d5266fc

Please sign in to comment.