Skip to content

Instantly share code, notes, and snippets.

@hwayne
hwayne / requirements.md
Last active July 21, 2021 17:09
PBT / Example Testing comparison problem

You are writing simple budgeting softare. A Budget consists of a total limit, represented as a positive integer, and a dictionary of category limits, represented as a map from strings to integers. For example:

{
  "total_limit": 50,
  "category_limits": {
    "food": 10,
    "rent": 11,
    "candles": 49
 }
@mfikes
mfikes / keys-vals.md
Last active November 23, 2020 13:27

The following works in Clojure:

(keys (filter (comp odd? val) {:a 1 :b 2 :c 3}))

The docstrings for keys and vals don't indicate that you can do this. Is this accidential or intentional?

I vaguely recall Alex Miller indicating at some point that this capability was deemed useful and is intentionally allowed. Yes, this is an appeal to authority, but nevertheless, it makes a fairly convincing argument.

Command Query Responsibility Segregation (CQRS)

Data Driven Design

Event Driven

Event Sourcing

Data Centric

Domain Centric


@alexandreaquiles
alexandreaquiles / README.md
Last active July 9, 2018 10:50
Field selectors em uma API REST

Imagine que queremos obter nome e email de uma pessoa na API do Linkedin. Chamamos:

GET http://api.linkedin.com/v2/people/123

Teríamos como resposta:

<person uri=“urn:linkedin:v2:people/123” key=“123”>
  <id>123</id>
 Reid Hoffman
True = lambda { |a,b| a }
False = lambda { |a,b| b }
display = lambda { |boolean| boolean['true','false']}
display[True] # => "true"
display[False] # => "false"
And = lambda{ |b1,b2| b1[b2,b1] }
Or = lambda{ |b1,b2| b1[b1,b2] }