Skip to content

Instantly share code, notes, and snippets.


Robert Stuttaford robert-stuttaford

View GitHub Profile
robert-stuttaford /
Last active Jan 4, 2022
Throughput accounting for hybrid SaaS + consultancy

Throughput Accounting


  • Throughput: TE is the rate of cash generated through delivery of working code into production. It is computed as sales price minus direct costs, such as packaging, delivery, installation, training, support, and networking.
  • Investment: I is all money invested in software production systems plus money spent to obtain ideas for client-valued functionality. This does not apply to time spent by staff (that's Operating Expense). It does apply to the money spent on by-the-hour contractors.
  • Operating Expense: OE is all money spent to produce working code from ideas. It is primarily direct labor of software engineers, but it also includes selling, general, and administrative costs. So, our fixed overheads.
robert-stuttaford /
Last active Jun 5, 2021
Datomic 0.9.5927 observations and questions

Query basics

{:db/ident       :meta/tag
 :db/valueType   :db.type/tuple
 :db/tupleAttrs  [:meta/tag-namespace :meta/tag-key :meta/tag-value] ;; all unique strings
 :db/cardinality :db.cardinality/one
 :db/unique      :db.unique/identity}


View deck-of-cards.clj
(ns scratch
(:require [clojure.spec.alpha :as s]))
(def cards
[{:suite :diamonds
:value :king}
{:suite :clubs
:value 4}])
(def cards-sorted
robert-stuttaford / build.clj
Last active Aug 1, 2018
Basic nREPL / cljs compile / cljs repl / figwheel script for use with clj cli command: `clj build.clj TASK`
View build.clj
(require '[ :as api]
'[clojure.string :as string]
'[figwheel-sidecar.repl-api :as figwheel]
'[figwheel-sidecar.components.nrepl-server :as figwheel.nrepl])
(def source-dir "src")
(def compiler-config
{:main 'app.main
:output-to "target/app.js"
View gist:1d266cb99524bc9d8ed07e339f7d5571
# Terraform + Ansible
## My assumptions about you:
- You've used neither of these tools.
- You may have used AWS before.
- You get the whole infrastructure in the cloud thing.
It's already available for you to play with right now — please grab it and ask questions!
robert-stuttaford / circle.env.yml
Last active Sep 21, 2016
Set a bunch of env vars on many CircleCI projects via API
View circle.env.yml
AWS_SECRET_ACCESS_KEY: supercalifragilisticexpialidocious
# more: values
# go: here
robert-stuttaford / translate.clj
Last active Mar 24, 2019
Language translations for Datomic entities with fallback to base entity
View translate.clj
(ns cognician.db.translate
(:require [datomic.api :as d])
(:import [clojure.lang MapEntry]
[datomic.query EntityMap]))
;;; Language
(def default-language :en-GB)
View fira-code.el
(when (window-system)
(set-default-font "Fira Code"))
(let ((alist '((33 . ".\\(?:\\(?:==\\|!!\\)\\|[!=]\\)")
(35 . ".\\(?:###\\|##\\|_(\\|[#(?[_{]\\)")
(36 . ".\\(?:>\\)")
(37 . ".\\(?:\\(?:%%\\)\\|%\\)")
(38 . ".\\(?:\\(?:&&\\)\\|&\\)")
(42 . ".\\(?:\\(?:\\*\\*/\\)\\|\\(?:\\*[*/]\\)\\|[*/>]\\)")
(43 . ".\\(?:\\(?:\\+\\+\\)\\|[+>]\\)")
(45 . ".\\(?:\\(?:-[>-]\\|<<\\|>>\\)\\|[<>}~-]\\)")
robert-stuttaford / magic-the-gathering-card-spec.clj
Created Jun 17, 2016
Noodling around with core.spec, modelling M:tG card data
View magic-the-gathering-card-spec.clj
(ns magic-the-gathering-card-spec
(:require [clojure.spec :as s]
[clojure.spec.gen :as gen]))
(s/def ::pos-int (s/and int? (complement neg?)))
(s/def ::set string?)
(s/def ::set-number ::pos-int)
(s/def ::artist string?)
robert-stuttaford / keys_with_and_question.clj
Last active Jun 16, 2016
Clojure core.spec question: composing s/keys with s/and
View keys_with_and_question.clj
;; using Clojure 1.9-alpha7
(ns keys-with-and-question
(:require [clojure.spec :as s]
[clojure.spec.gen :as gen]))
(s/def ::id string?)
(s/def ::active? boolean?)
(s/def ::extra int?)
(s/def ::base (s/keys :req-un [::id] :opt-un [::active?]))