Skip to content

Instantly share code, notes, and snippets.

@sogaiu
sogaiu / gist:f7e6d2bfbbc6ef3ae9bf790b6642fb11
Last active Jun 9, 2021
emacs lsp-mode and clojure-lsp notes
View gist:f7e6d2bfbbc6ef3ae9bf790b6642fb11
lsp-mode:
kept seeing the following sort of message in the minibuffer:
LSP :: <filename> not in project or it is blacklisted.
it may have been preceded with a message that ended with:
select action:
@sogaiu
sogaiu / tonsky-datascript-todo-video-notes.md
Last active Jun 13, 2021
tonsky's datascript-todo video notes
View tonsky-datascript-todo-video-notes.md

Notes on Tonsky's datascript-todo Code Walkthrough

The ClojureScript NYC DataScript Webinar (2014-12) video is long (nearly 2.5 hours) but quite an informative session of Tonsky assembling / going through his datascript-todo sample.

Regarding the Specific Code in the Video

In the video, he starts with a mostly "static" version of his sample code. Over the course of the session he gradually transforms the sample into a

@sogaiu
sogaiu / ajrc.el
Created Jun 6, 2021
ajrc - emacs janet netrepl code
View ajrc.el
;;; ajrc.el --- A Janet REPL Client -*- lexical-binding: t; -*-
;; Author: sogaiu
;; Version: 20200430
;; Package-Requires: ((smartparens "1.11.0") (emacs "26.2"))
;; Keywords: janet, spork, network socket repl
;; This file is not part of GNU Emacs.
;;; Commentary:
@sogaiu
sogaiu / struct.janet
Created Jun 6, 2021
janet peg peg/match struct example
View struct.janet
(first
(peg/match ~(cmt (sequence (capture "hello")
(some (set " ,"))
(capture "world"))
,(fn [cap1 cap2]
{:greeting cap1 :name cap2}))
"hello, world"))
# => {:greeting "hello" :name "world"}
@sogaiu
sogaiu / gist:a70046cfc85bbc62c5f9116deae1e228
Last active Jun 5, 2021
multiple captures for janet's peg/match
View gist:a70046cfc85bbc62c5f9116deae1e228
(peg/match ~{:main (sequence (capture (some :S))
(capture (some :s))
(capture (some :S)))}
"hello world")
# => @["hello" " " "world"]
(peg/match ~(sequence (capture (some :S))
(capture (some :s))
(capture (some :S)))
"hello world")
@sogaiu
sogaiu / gist:a56777a44dea12b618c8b69d73c28d11
Last active Jun 4, 2021
some thoughts about libraries, frameworks, and biff
View gist:a56777a44dea12b618c8b69d73c28d11
is it possible that a framework might tend to become more popular
than a library because it's more likely that a "successful initial
usage experience" with it would be completed vs a library? (or
completed sooner.)
let's assume this can happen for some meaningful combinations of
libraries and frameworks for the sake of discussion. to have some
concrete things in mind, consider re-frame the framework and rum
the library.
View gist:552a338d868ea77193cb208abc6990b3
repl> (def a {:a 1})
{:a 1}
repl> (disasm (compile '(a :a)))
{ :arity 0
:bytecode @[(ldc 0 0) (push 0) (ldc 1 1) (call 0 1) (ret 0)]
:constants @[:a {:a 1}]
:defs @[]
:environments @[]
:max-arity 2147483647
@sogaiu
sogaiu / gist:a5e4d95b90f4e4dce172ab1f948d45e2
Created May 25, 2021
notes on instructional material construction
View gist:a5e4d95b90f4e4dce172ab1f948d45e2
* familiar terms first, delay label introduction
* spelling out throughout material enough reasons for paying attention
to current material. e.g. we are trying to learn this bit because
it will be used specifically in these places later (with links to
those places so one can jump ahead to see)
View gist:f07c5e4aa59b86ab4a4c08607bb18f18
And you will hear this said: this is the way to do this. This fixes the problem.
What is great about it is: it forces you to check. And of course that is the
most important thing in programming: that somebody is watching you and making
sure you are checking for nils, no matter what the cost. And the problem is:
no one can articulate the costs. No one ever mentions costs. It is all benefit.
But it is not. So when do you see the cost of Maybe? You see them in program
maintenance.
So yesterday I had a function. It took an X, and returned a Y. People wrote
View gist:90ab1ae44397f39166b7800cfd11fca9
possibly nice things
--------------------
* elm packages seem to have a better-than-js story wrt js-type of breakage
* significant reduction of runtime errors
* significant amount of type inference -- contrary to claims, it doesn't
appear completely optional, but have only encoutered one type of
case so far