Skip to content

Instantly share code, notes, and snippets.

View robert-stuttaford's full-sized avatar
💭
Clojure!

Robert Stuttaford robert-stuttaford

💭
Clojure!
View GitHub Profile
@robert-stuttaford
robert-stuttaford / throughput-accounting.md
Last active January 4, 2022 22:38
Throughput accounting for hybrid SaaS + consultancy

Throughput Accounting

https://chronologist.com/blog/2012-07-27/theory-of-constraints-and-software-engineering/

Measures

  • 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
robert-stuttaford / notes.md
Last active March 18, 2024 13:52
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}

Then

(ns scratch
(:require [clojure.spec.alpha :as s]))
(def cards
[{:suite :diamonds
:value :king}
{:suite :clubs
:value 4}])
(def cards-sorted
@robert-stuttaford
robert-stuttaford / build.clj
Last active August 1, 2018 14:18
Basic nREPL / cljs compile / cljs repl / figwheel script for use with clj cli command: `clj build.clj TASK`
(require '[cljs.build.api :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"
# 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
robert-stuttaford / circle.env.yml
Last active September 21, 2016 03:22
Set a bunch of env vars on many CircleCI projects via API
AWS_ACCESS_KEY_ID: ABCDEFGHIJKLMNOPQRSTUVWXYZ
AWS_SECRET_ACCESS_KEY: supercalifragilisticexpialidocious
# more: values
# go: here
@robert-stuttaford
robert-stuttaford / translate.clj
Last active March 24, 2019 20:44
Language translations for Datomic entities with fallback to base entity
(ns cognician.db.translate
(:require [datomic.api :as d])
(:import [clojure.lang MapEntry]
[datomic.query EntityMap]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Language
(def default-language :en-GB)
@robert-stuttaford
robert-stuttaford / fira-code.el
Created August 25, 2016 15:06
FiraCode + Emacs
(when (window-system)
(set-default-font "Fira Code"))
(let ((alist '((33 . ".\\(?:\\(?:==\\|!!\\)\\|[!=]\\)")
(35 . ".\\(?:###\\|##\\|_(\\|[#(?[_{]\\)")
(36 . ".\\(?:>\\)")
(37 . ".\\(?:\\(?:%%\\)\\|%\\)")
(38 . ".\\(?:\\(?:&&\\)\\|&\\)")
(42 . ".\\(?:\\(?:\\*\\*/\\)\\|\\(?:\\*[*/]\\)\\|[*/>]\\)")
(43 . ".\\(?:\\(?:\\+\\+\\)\\|[+>]\\)")
(45 . ".\\(?:\\(?:-[>-]\\|<<\\|>>\\)\\|[<>}~-]\\)")
@robert-stuttaford
robert-stuttaford / magic-the-gathering-card-spec.clj
Created June 17, 2016 06:49
Noodling around with core.spec, modelling M:tG card data
(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
robert-stuttaford / keys_with_and_question.clj
Last active June 16, 2016 14:03
Clojure core.spec question: composing s/keys with s/and
;; 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?]))