Skip to content

Instantly share code, notes, and snippets.

View joel-costigliola's full-sized avatar

Joel Costigliola joel-costigliola

  • Gentrack
  • Auckland
View GitHub Profile
Verifying that +joelcostigliola is my blockchain ID. https://onename.com/joelcostigliola
---Very simple evaluation for arithmetic expressions with only constants
---(and only "plus"...obviously extendable to other operations)
data Expr = C Float |
Expr :+ Expr
deriving Show
eval :: Expr -> Float
eval (C x) = x
eval (e1 :+ e2) = let v1 = eval e1
@joel-costigliola
joel-costigliola / gist:2393444
Last active October 3, 2015 04:48
Regexp to migrate Fest 1.4 onProperty usage to Fest 2.0 extractProperty + from with
Search with regexp: assertThat\((.*?)\).onProperty\((.*?)\)
Replace by : assertThat(extractProperty(\2).from(\1))
For example, it will change:
assertThat(fellowshipOfTheRing).onProperty("name").contains("Boromir", "Gandalf", "Frodo", "Legolas"); // Fest 1.4
To :
assertThat(extractProperty("name").from(fellowshipOfTheRing)).contains("Boromir", "Gandalf", "Frodo", "Legolas"); // Fest 2.0