I hereby claim:
- I am jkrasnay on github.
- I am jkrasnay (https://keybase.io/jkrasnay) on keybase.
- I have a public key whose fingerprint is 43FF 0EEB D26E D264 3C35 A992 01CB 791D F272 A4CE
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
{ | |
"features": [ | |
{ | |
"id": "schedule1", | |
"type": "feature-schedule", | |
"name": "Schedule 1", | |
"icon": "15", | |
"settings": { | |
"type": "schedule-settings", | |
"timeFormat": "12", |
# Convert to TSV | |
# Note -r flag | |
# to_entries creates an array of key,value maps, the trailing [] converts this array to stream items | |
cat api-docs.json | jq -r '.paths | to_entries[] | .key as $path | .value | to_entries[] | [.key,$path,.value.tags[0]] | @tsv' | |
# Transform into different JSON... | |
cat api-docs.json | jq '[ .paths | to_entries[] | .key as $path | .value | to_entries[] | { path:$path, method:.key, tag:.value.tags[0] } ]' |
(ns topo-sort.core) | |
;; Graph Topological Sort | |
;; | |
;; The topo-sort function here performs a toplogical sort of the graph. A | |
;; topological sort returns a list of nodes in dependency order. In our case, a | |
;; graph is represented as a collection of directed edges, each of which is a | |
;; two element vector with the "from node" and the "to node": | |
;; | |
;; (topo-sort #{[:a :b] [:b :c] [:a :c]}) |
set editing-mode vi | |
set keymap vi | |
$if mode=vi | |
set keymap vi-insert | |
"jj": vi-movement-mode | |
$endif |
var name = "Bar!"; | |
var dirs = { | |
n: [0,1], | |
s: [0,-1], | |
e: [1,0], | |
w: [-1,0]}; | |
function vadd(v1, v2) { | |
return v1.map((x,i) => x + v2[i]); |
There are a couple of common problems with Re-frame subscriptions that I’d like to solve:
Because subscriptions are registered via keywords, the ClojureScript compiler does nothing to help check that we haven’t made a typo when subscribing.
We often need to use the same logic to access a value in the app DB in both a subscription and in events.
I’ve come up with the following structure. First we create the accessor function, which can be used by both the subscription and any events. (This of course implies that the namespace where we implement our events must refer to the namespace where we define our subscriptions.)
(ns turing) | |
(def dirs | |
{:l dec | |
:r inc}) | |
(defn move | |
[machine dir] | |
(update machine :pos (dirs dir))) |
; This is my AutoHotKey script for window management | |
; Each keystroke involves a "mash": holding the Ctrl, Alt, and Windows keys together, | |
; then pressing on of the keys centered around the K key | |
; E.g. Ctrl-Alt-Windows-J moves the current window to the left half of the screen. | |
; | |
; GetCurrentMonitor is from https://www.autohotkey.com/board/topic/85457-detecting-the-screen-the-current-window-is-on/ | |
GetCurrentMonitor() | |
{ | |
SysGet, numberOfMonitors, MonitorCount |