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 kata | |
(:require [clojure.string :as str] | |
[clojure.pprint :refer [pprint]] | |
[net.cgrand.xforms :as xf)) | |
(def example-input "Los Angeles Clippers 104 Dallas Mavericks 88,New York Knicks 101 Atlanta Hawks 112,Indiana Pacers 103 Memphis Grizzlies 112, Los Angeles Clippers 100 Boston Celtics 12") | |
(defn score? [s] | |
(try (Integer. s) | |
true |
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
(defn wrapped-query [from-db to-db query] | |
(fn [db m] | |
(->> m to-db (query db) from-db))) | |
(defn def-wrapped-query* [from-db to-db query] | |
(let [{:keys [result] :as query-meta} (meta (resolve query))] | |
(case result | |
(:1 :one) `(def ~query ~(with-meta | |
(wrapped-query @(resolve from-db) @(resolve to-db) @(resolve query)) | |
query-meta)) |
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
(fp/defsc GiftList | |
[this {:gql.gift/keys [id name]}] | |
{:ident [:gql.gift/id :gql.gift/id] | |
:query [:gql.gift/id :gql.gift/name]} | |
(js/console.log {:gift [id name]}) | |
(dom/div "Gift list " id ": " name)) | |
(def ui-gift-list (fp/factory GiftList {:keyfn :gql.gift/id})) | |
(fp/defsc GiftListDemo |
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
;; Example error-action | |
(error-action [{:keys [state result] :as env}] | |
(let [message (get-in env [:result :body `create-gift ::p/error ::anom/message])] | |
(swap! state | |
#(-> % | |
(assoc-in [::gift/id id :ui/submitting] false) | |
(assoc-in [:component/id :flash-message] #:ui{:active true | |
:message message | |
:type "negative"}))))) |
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 rocks.mygiftlist.ui.gift-list | |
(:require | |
[com.fulcrologic.fulcro.algorithms.form-state :as fs] | |
[com.fulcrologic.fulcro.algorithms.merge :as merge] | |
[com.fulcrologic.fulcro.components :as comp :refer [defsc]] | |
[com.fulcrologic.fulcro.dom :as dom] | |
[com.fulcrologic.fulcro.mutations :as m] | |
[com.fulcrologic.semantic-ui.elements.button.ui-button :refer [ui-button]] | |
[com.fulcrologic.semantic-ui.collections.form.ui-form :refer [ui-form]] |
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 returning-example.core | |
(:require [clojure.java.jdbc :as jdbc] | |
[honeysql.core :as sql] | |
[honeysql.format] | |
[honeysql-postgres.format])) | |
(def db-spec | |
{:dbtype "postgresql" | |
:dbname "postgres" | |
:user "postgres" |
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
FROM flyway/flyway:6.4.2 | |
COPY migrations /flyway/sql | |
COPY parse-url.sh /parse-url.sh | |
USER root | |
RUN apt update && apt -y install --no-install-recommends curl |