Здесь представлены мои индивидуальные настройки для разработки на Clojure с помощью Idea + Cursive.
This file contains hidden or 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
;; Find minimal result from applying all permutations of operations to all permutations of numbers | |
(defn remove-first [pred s] | |
(lazy-seq | |
(when-let [[x & xs] (seq s)] | |
(cond (pred x) xs | |
:else (cons x (remove-first pred xs)))))) | |
(defn permutations [s] |
This file contains hidden or 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
{ | |
:mvn/repos {"clojars" {:url "https://repo.clojars.org/"} | |
"central" {:url "https://repo1.maven.org/maven2/"}} | |
:paths ["src" "resources"] | |
:deps {org.clojure/clojure {:mvn/version "1.11.1"} | |
io.github.nextjournal/clerk {:mvn/version "0.11.603"} | |
meta-csv/meta-csv {:mvn/version "0.1.0"} | |
kixi/stats {:mvn/version "0.5.5"} |
This file contains hidden or 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
(defproject geni-cookbook "0.0.1-SNAPSHOT" | |
:description "FIXME: write description" | |
:url "http://example.com/FIXME" | |
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0" | |
:url "https://www.eclipse.org/legal/epl-2.0/"} | |
:dependencies [[org.clojure/clojure "1.11.1"] | |
[zero.one/geni "0.0.40"] | |
[com.fasterxml.jackson.core/jackson-annotations "2.12.3" | |
:exclusions [com.fasterxml.jackson.core/jackson-databind]] | |
[metosin/jsonista "0.3.3" |
This file contains hidden or 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
(require '[com.brunobonacci.mulog :as u]) | |
(require '[com.brunobonacci.mulog.flakes]) | |
;; | |
;; Start publisher | |
;; | |
(def publisher (u/start-publisher! {:type :console :pretty? true})) | |
(u/set-global-context! {:app-name "my-app" | |
:jvm-version (System/getProperty "java.version") |
This file contains hidden or 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 jira-gantt-report | |
"Create Gantt EDN-report from Jira" | |
(:require | |
[babashka.cli :as cli] | |
[babashka.curl :as curl] | |
[babashka.fs :as fs] | |
[babashka.process :refer [check pb pipeline process sh]] | |
[cheshire.core :as json] | |
[clojure.string :as string] | |
[clojure.walk] |
This file contains hidden or 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 org.rssys.xchart | |
(:gen-class) | |
(:require [clojure.math :as math] | |
[com.brunobonacci.mulog :as mulog] | |
[com.hypirion.clj-xchart :as c]) | |
(:import (org.knowm.xchart XYChart))) | |
(def chart | |
^XYChart (c/xy-chart {"Sin" {:x (range 0 63) | |
:y (range 0 63) |
This file contains hidden or 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
(defmacro ^:private doto-cond | |
"Example: | |
(doto-cond expr | |
cond1 (my call) | |
cond2 (my2 call2)) | |
=> | |
(let [e# expr] | |
(when cond1 (my #e call)) | |
(when cond2 (my2 #2 call2)))" | |
[expr & clauses] |
This file contains hidden or 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
(-> | |
(process ["echo" (pr-str {:a 1 :b 2 :qwe "1234"})]) | |
(process [cljstyle-program "pipe"] {:out :string}) | |
deref | |
:out) | |
(-> (process ["echo" (pr-str {:a 1 :b 2 :qwe "1234"})]) | |
(process ["cat"] {:out :string}) | |
deref | |
:out) |
This file contains hidden or 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
(def object-gen #(gen/fmap (fn [_] (Object.)) (gen/return 1))) | |
(s/def ::object (s/with-gen any? object-gen)) | |
(gen/sample (gen/bind (gen/return 3) (fn [x] (gen/return (+ x 4))))) | |
(gen/sample (gen/let [strs (gen/not-empty (gen/list gen/string)) | |
s (gen/elements strs)] | |
{:some-strings strs :one-of-those-strings s})) |
NewerOlder