Skip to content

Instantly share code, notes, and snippets.

View danielneal's full-sized avatar

Daniel Neal danielneal

View GitHub Profile

sqa-common utility library

The sqa-common JS library is a collection of utilities to support the clients of the SQA api. It is provided as a node module published on the public npm registry.

Usage

Add the following dependency to package.json:

@danielneal
danielneal / sqa-common.md
Created July 2, 2021 16:23
SQA common docs

sqa-common utility library

The sqa-common JS library is a collection of utilities to support the clients of the SQA api. It is provided as a node module published on the public npm registry.

Usage

Add the following dependency to package.json:

@danielneal
danielneal / speed-test.cljs
Created September 4, 2019 11:57
Speed test async storage
(ns speed-test.core)
(defn random-map
"Generates a random map with provided depth and length"
[opts]
(let [{:keys [depth length random-key random-val]
:or {depth 2
length 20
kfn #(rand-int 20)
vfn #(rand-int 20)}} opts]
@danielneal
danielneal / app.cljs
Last active January 22, 2020 06:51
Basic context / state for hx
...
(def app-db (atom {:num 1}))
(defnc SomeComponent []
(let [num (db/useSubscription [:db/get-in [:num]])
[rn/View [rn/Text (str num)]])
(defnc App []
[:provider {:context db/context
:value app-db}
@danielneal
danielneal / fire.sh
Last active July 1, 2019 11:11
Terminal Fire
#!/usr/bin/python
import curses, random, webbrowser
screen = curses.initscr()
width = screen.getmaxyx()[1]
height = screen.getmaxyx()[0]
size = width*height
char = [" ", ".", ":", "^", "*", "x", "s", "S", "#", "$"]
b = []
@danielneal
danielneal / cfire
Created June 28, 2019 14:42 — forked from msimpson/cfire
Curses based ASCII art fire animation.
#!/usr/bin/python
import curses, random
screen = curses.initscr()
width = screen.getmaxyx()[1]
height = screen.getmaxyx()[0]
size = width*height
char = [" ", ".", ":", "^", "*", "x", "s", "S", "#", "$"]
b = []
@danielneal
danielneal / compound2.clj
Last active June 30, 2019 18:48
compound2
(ns compound2.core3)
(defprotocol Index
:extend-via-metadata true
(before [this o])
(after [this o])
(kfn [this o x])
(vfn [this o x])
(lookup [this o k] [this o k not-found])
(index [this o k v])
@danielneal
danielneal / app.cljs
Created June 10, 2019 15:56
Shadow / hx / React Native / expo
(ns test.app
(:require
["expo" :as ex]
["react-native" :as rn]
["react" :as react]
[test.db :as db]
[hx.react :as hx :refer [defnc]]
[hx.hooks :as hooks]
[shadow.expo :as expo]))
@danielneal
danielneal / query.cljs
Last active June 9, 2019 18:02
Minimal query for maps
(ns query.core)
(defn paths
([q]
(paths [] {} q))
([current-path m q]
(letfn [(paths-map
[current-path m q]
(apply merge (for [[k v] q]
(paths (conj current-path k) {} v))))
{"paklausti"
{:word/type :verb,
:word/form-primary "paklausti",
:word/forms
(["paklausiu" "I ask"]
["paklausi" "you ask"]
["paklausia" "he/she asks"]
["paklausiame" "we ask"]
["paklausiate" "you all ask"]
["paklausia" "they ask"]