Skip to content

Instantly share code, notes, and snippets.

View currentoor's full-sized avatar

Karan Toor currentoor

  • Temecula, California
View GitHub Profile
@currentoor
currentoor / mutesync_serial.js
Last active December 13, 2022 22:07
How to talk to the mutesync button.
// The API is really simple, to control the lights you send the button a byte array of 13 bytes.
// The first byte needs to be 65 and the rest of the twelve bytes are 3-tuples (RGB values 0-255 for the individual LEDs).
// So alternating red and green lights would look like
[65,
255, 0, 0, // red
0, 255, 0, // green
255, 0, 0, // red
0, 255, 0] // green
(defn elide-params [params elision-predicate]
(walk/postwalk (fn [x]
(if (and (vector? x) (= 2 (count x)) (elision-predicate (first x)))
nil
x))
params))
(def blacklist #{:ui.fulcro.client.data-fetch.load-markers/by-id
:com.fulcrologic.rad.picker-options/options-cache
::uism/asm-id
(defmutation fill-schedule-cells
"Mutation: For every employee in the global list of all employees: create a row on the work schedule whose cells
reflect the currently-scheduled shifts, or placeholder nodes if nothing is scheduled in that cell.
params can include:
`:gc` - A list of old schedule IDs to GC before filling out the current schedule."
[params]
(action [{:keys [state]}]
(let [query [{:ucv.models.employee/all-employees
(ns ucv.lib.use-case
#?(:cljs (:require-macros [ucv.lib.use-case]))
(:require
[clojure.spec.alpha :as s]
[com.fulcrologic.fulcro.algorithms.do-not-use :as futil]
[taoensso.timbre :as log]
[com.wsscode.pathom.connect :as pc]
[ucv.util]))
(defonce pathom-registry (atom {}))
(ns ucv.models.vehicle-capture
(:require
[cljs.core.async :as async]
[cljs-http.client :as http]
[clojure.string :as str]
[com.wsscode.pathom.connect :as pc]
[com.wsscode.common.async-cljs :refer [go-catch]]
[com.fulcrologic.fulcro.ui-state-machines :as uism :refer [defstatemachine]]
[ucv.rest-networking :refer [defresolver]]
[ucv.util :as util]
(ns ucv.mobile-apps.base
(:refer-clojure :exclude [list])
(:require
[clojure.spec.alpha :as s]
["native-base" :as nb :refer [Container Header Footer FooterTab Item Input Icon Button Content
List ListItem CheckBox Left Body Right Label Card CardItem Segment
H1 H2 H3 Form Spinner Separator Picker Text Title Subtitle TextArea]]
["react-native-modal-datetime-picker" :default DateTimePicker]
["react-native" :as rn]
[clojure.string :as str]
(ns ucv.controller.parser
(:require
[cljs.core.async :as async]
[com.wsscode.common.async-cljs :refer [go-catch]]
[com.wsscode.pathom.connect :as pc]
[com.wsscode.pathom.core :as p]
[edn-query-language.core :as eql]
[mount.core :refer [defstate]]
[ucv.lib.parser :as parser-lib]
[taoensso.timbre :as log]
{:clojure.main/message
"Execution error at shadow.build/eval16057$loading (build.clj:1).\nUnable to resolve spec: :clojure.core.specs.alpha/args+body\n",
:clojure.main/triage
{:clojure.error/class java.lang.Exception,
:clojure.error/line 1,
:clojure.error/cause
"Unable to resolve spec: :clojure.core.specs.alpha/args+body",
:clojure.error/symbol shadow.build/eval16057$loading,
:clojure.error/source "build.clj",
:clojure.error/phase :execution},
(defn ref->ident
"Sometimes references on the client are actual idents and sometimes they are
nested maps, this function attempts to return an ident regardless."
[x]
(cond
(eql/ident? x) x
(map? x) (some #(and (= "id" (name (first %))) (into [] %)) x)
:else nil))
(defn delta->datomic-txn
;; Setup
(defmulti resolver-fn pc/resolver-dispatch)
(defmulti mutation-fn pc/mutation-dispatch)
(defonce indexes (atom {}))
(defonce defresolver (pc/resolver-factory resolver-fn indexes))
(defonce defmutation (pc/mutation-factory mutation-fn indexes))
(defn rest-parser
"Create a REST parser. Make sure you've required all nses that define rest resolvers. The given app-atom will be available