Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Clojure!

Robert Stuttaford robert-stuttaford

💭
Clojure!
View GitHub Profile
@robert-stuttaford
robert-stuttaford / throughput-accounting.md
Last active Feb 2, 2020
Throughput accounting for hybrid SaaS + consultancy
View throughput-accounting.md

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 Apr 30, 2020
Datomic 0.9.5927 observations and questions
View notes.md

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

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
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 '[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"
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
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_ACCESS_KEY_ID: ABCDEFGHIJKLMNOPQRSTUVWXYZ
AWS_SECRET_ACCESS_KEY: supercalifragilisticexpialidocious
# more: values
# go: here
@robert-stuttaford
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
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
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?]))
You can’t perform that action at this time.