Skip to content

Instantly share code, notes, and snippets.

@philomates
philomates / example_test.clj
Last active February 7, 2023 12:09
clojure.test re-interpretation of nubank/state-flow
(ns example-test
(:require [clojure.test :refer [is deftest testing]]
[flow :as f]
[matcher-combinators.test :refer [match?]]))
(f/tests-as-flows!)
(defn request! [verb url body]
(let [servlet (get-state #(get-in % [:system :http/server :io.pedestal.http/service-fn]))]
(-> (io.pedestal.test/response-for servlet verb url :body body)
@philomates
philomates / a_strange_translation_saga_test.clj
Created September 13, 2019 09:48
match-with: a strange translation saga
(ns match-with.a-strange-translation-saga-test
(:require [clojure.test :refer :all]
[matcher-combinators.core :as core]
[matcher-combinators.matchers :refer [in-any-order]]
[matcher-combinators.test :refer [match? match-with?]]))
;; ----------------------------------------------------------------------
;; Lightning talk presented at the Clojure Berlin meetup on Sept 12 2019
;; as a means to demo `match-with?` a new feature to matcher-combinators
;; ----------------------------------------------------------------------
@philomates
philomates / midje-learnings.md
Last active August 21, 2019 22:43
Experiences using Midje & what we can learn from it

I'd like to briefly present some ideas on:

  • What Midje has to offer, both the good and the bad
  • How to take all the Midje goodness over to clojure.test and clojurescript

What is Midje and why am I talking about it?

Midje started back in 2010, and was the vision of someone with decades worth of experience when it comes to software testing.

Up through 2013 it accumulated a bunch of useful features:

@philomates
philomates / submit_case_update.py
Created July 27, 2016 14:45
Script to update case properties on CommCareHQ
#!/bin/python3
"""
Script for posting a form to CommCareHQ that updates a case.
example usage:
python3 submit_case_update.py your-commcare-domain mobile-user1 passwd 123-this-is-a-case-id-456 prop1=new-value prop2="value with spaces"
"""
import datetime
@philomates
philomates / time_series_exploration.py
Created January 14, 2015 20:52
Exploring some simple time-series questions
#!/bin/ipython3
"""
Exploring some simple time-series questions
Phillip Mates
Jan 14th, 2015
"""
import math