Skip to content

Instantly share code, notes, and snippets.

@sogaiu
sogaiu / transact.janet
Created Mar 1, 2021
shawn transact test sample
View transact.janet
(import ../shawn/init :as shawn)
(import ../shawn/act)
(comment
(act/defact TestUpdateAct
{:update (fn [_ envelope]
(put envelope :test "Test"))})
(act/defact TesttUpdateAct
@sogaiu
sogaiu / acts.janet
Created Mar 1, 2021
shawn acts test sample
View acts.janet
(import ../shawn/act)
(comment
(let [a (act/make {:update (fn [_ envelope]
envelope)})]
(and (a :update)
(a :watch)
(a :effect)
(a :name)))
@sogaiu
sogaiu / shawn.janet
Created Mar 1, 2021
shawn test sample
View shawn.janet
(import ../shawn/init :as shawn)
(comment
(truthy? (shawn/initialize))
# => true
(get-in (shawn/initialize @{:counter 1})
[:envelope :counter])
# => 1
@sogaiu
sogaiu / a-janet-fix-one.el
Last active Mar 1, 2021
Fix one delimiter with some help from janet
View a-janet-fix-one.el
;;; a-janet-fix-one.el --- Fixing One Delimiter -*- lexical-binding: t; -*-
;; Author: sogaiu
;; Version: 0.1.0
;; Package-Requires: ((emacs "25.2"))
;; 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, either version 3 of the License, or
;; (at your option) any later version.
@sogaiu
sogaiu / default.scm
Last active Feb 27, 2021
a-janet-mode default.scm example
View default.scm
;; XXX: do not pay too much attention to the names of the @-constructs
;; these were chosen so that they could appropriately contrast
;; trying to select @-constructs to match the supposed meaning in
;; emacs-tree-sitter wasn't yielding appropriate distinctions
;; XXX: want to distinguish between macros (+ special forms) and functions
;; @type.parameter <- @function.macro
;; @ <- @constant.builtin
;; @function <- @function.builtin
@sogaiu
sogaiu / TrueColour.md
Created Feb 27, 2021 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals
View TrueColour.md

Terminal Colors

There exists common confusion about terminal colors. This is what we have right now:

  • Plain ASCII
  • ANSI escape codes: 16 color codes with bold/italic and background
  • 256 color palette: 216 colors + 16 ANSI + 24 gray (colors are 24-bit)
  • 24-bit true color: "888" colors (aka 16 milion)
@sogaiu
sogaiu / gist:4f3b87c4ee56cfa128438646430cfbd4
Created Feb 27, 2021
using janet to detect delimiter issues
View gist:4f3b87c4ee56cfa128438646430cfbd4
With content (in example0.janet):
(defn b
[]
(def a
1))
[:a {:b 1}
1
@sogaiu
sogaiu / response.janet
Last active Feb 23, 2021
some sample comment block tests for chidi
View response.janet
(import json)
(import spork/temple)
(import spork/path)
(def status-messages
```
Struct with numeric keys of status codes
with values of string messages
```
{100 "Continue" 101 "Switching Protocols"
@sogaiu
sogaiu / tags.janet
Created Feb 22, 2021
scratch work for building tags files using janet
View tags.janet
(each sym (keys (curenv))
(when-let [smap ((dyn sym) :source-map)]
(printf "%s:%p" (string sym) smap)))
path/parts:("/home/user/bin/janet/lib/janet/path.janet" 137 1)
path/delim:("/home/user/bin/janet/lib/janet/path.janet" 133 1)
path/win32/parts:("/home/user/bin/janet/lib/janet/path.janet" 159 1)
path/win32/delim:("/home/user/bin/janet/lib/janet/path.janet" 155 1)
path/normalize:("/home/user/bin/janet/lib/janet/path.janet" 138 1)
path/posix/ext:("/home/user/bin/janet/lib/janet/path.janet" 15 1)