This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:malli/required "%s is required" | |
:malli/extra-key "System doesn't recognize property %s" | |
:malli/null "%s must be empty" | |
:malli/some "%s must not be null" | |
:malli/invalid-type "%s has invalid type" | |
:malli/invalid "%s value is invalid" | |
:malli/not "%s value is invalid" | |
:malli/boolean "%s must be a boolean" | |
:malli/true "%s must have a value of `true`" | |
:malli/false "%s must have a value of `false`" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns my.company.either | |
"An implementation of a right-biased Either monad. | |
Representation: | |
- `success`: any success value (even `nil`) | |
- `failure`: represented as `errors` | |
In classical Either monad terms: | |
- `right` is `success` | |
- `left` is `failure` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns my.company.errors | |
"Errors is a collection of `error`." | |
(:require | |
[my.company.coll :as coll] | |
[my.company.error :as error])) | |
;; Functions in addition to: | |
;; https://gist.github.com/mbezjak/c1baeece563b8ed734692938e6d1a36f | |
(defn validate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns my.company.error | |
"Error carries error information as a hash-map. | |
A hash-map can carry any information. Some information is system wide (thus | |
used by the system) and will be promoted as qualified keywords not to conflict | |
with user defined ones. Those are: | |
- `:code` [qualified keyword] - error code | |
- `:args` [collection] - arguments for `format` to build the error message | |
- `:message` [string] - a human error message | |
- `:breadcrumbs` [collection] - a path to the source that caused the error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns my.company.coll | |
"Missing functions in `clojure.core` that accept a collection. | |
Argument names and expected positions use the same convention as `clojure.core.`" | |
(:refer-clojure :exclude [any?])) | |
(defn any? | |
"Opposite of `clojure.core/not-any?`. | |
Returns `false` for empty `coll`." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns defn) | |
(defn symbols [args] | |
(mapcat | |
(fn [a] | |
(cond | |
(map? a) (:keys a) | |
(vector? a) (symbols a) | |
:else [a])) | |
args)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmodel :employee | |
[[:integer id :not-form-updatable] | |
[:string first-name {:sql-column "name" :case :insensitive}] | |
[:string last-name {:max-size 100 :case :upper}] | |
[:string address] | |
[:country country :nullable]]) | |
(defmodel :country | |
[[:string alpha2] | |
[:string alpha3] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
set -o errexit | |
declare -r projectsdir=/tmp/pride-example-projects | |
declare -r libdir=$projectsdir/lib | |
declare -r appdir=$projectsdir/app | |
declare -r pridedir=$projectsdir/pride | |
declare -r maindir=src/main/groovy/com/example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.atmosphere.cpr.AtmosphereResource | |
import org.atmosphere.cpr.AtmosphereResourceEvent | |
class CometService { | |
static transactional = false | |
static final atmosphere = [ mapping : '/atmosphere/messages' ] | |
final onRequest = { AtmosphereResource resource -> | |
// ... |