Skip to content

Instantly share code, notes, and snippets.

View CosmicToast's full-sized avatar

Chloé Vulquin CosmicToast

View GitHub Profile
@CosmicToast
CosmicToast / jamplate.janet
Created June 4, 2023 20:21
Proof of concept PHP-style templating mode for Janet
(def- opener "<?janet")
(def- closer "?>")
(def- file ~{:main (some (+ :code :text))
:text '(to (+ ,opener -1))
:code (/ :code* ,parse-all)
:code* (* ,opener '(to ,closer) ,closer)})
(defn template-string
[s]
(def out @"")
@CosmicToast
CosmicToast / set.go
Last active January 2, 2024 19:00
go-collect
package collect
// Set represents a generic set of comparable elements.
type Set[T comparable] map[T]struct{}
// Has checks whether the set holds a given value.
func (s Set[T]) Has(v T) bool {
_, ok := s[v]
return ok
}
@CosmicToast
CosmicToast / log.sh
Last active February 14, 2024 21:53
POSIX sh stack-based logging system.
#!/bin/sh
# this file is licensed under any of the following SPDX licenses
# to be chosen by the user:
# * 0BSD (https://spdx.org/licenses/0BSD.html)
# * BlueOak-1.0.0 (https://blueoakcouncil.org/license/1.0.0)
# * CC0-1.0 (https://creativecommons.org/publicdomain/zero/1.0/)
# * Unlicense (https://unlicense.org/)
## log.sh - Bunker Log
# This is the bunker logging system for POSIX sh.