Skip to content

Instantly share code, notes, and snippets.

{
:scale "900*1200" ;; размер картинки
:project-title "Полное название фичи (короткое название)"
:project-header "План на 10-02-2022" ;; Дата обновления плана
:project-starts "2022-02-10"
:project-scale-zoom {:scale :daily :zoom 1}
:tasks-colors {:color/in-progress "GreenYellow/Red"
@mikeananev
mikeananev / a.txt
Last active February 4, 2022 13:04
Babashka global task
mkdir ~/btasks
ltedit ~/btasks/gbb ;; add gbb content to a file
chmod +x ~/btasks/gbb
ltedit ~/.zshrc
;;add content zshrc to the end of .zshrc
ltedit ~/btasks/bb.edn ;; add bb.edn content to a file
@mikeananev
mikeananev / bb.txt
Created January 30, 2022 08:58
Babashka global task
yes, this is possible using --config ...
e.g.: foo:
#!/usr/bin/env bash
bb --config ~/my_tasks/bb.edn $@
and then:
foo tasks
foo my-task
@mikeananev
mikeananev / a.clj
Created January 29, 2022 11:28
File template for Clojure test file
(ns $NS_NAME
(:require [clojure.test :as test :refer [deftest testing is]]
[$TEST_SUBJECT_NS :as sut]
[matcho.core :refer [match]]))
@mikeananev
mikeananev / a.txt
Created January 20, 2022 04:45
babashka tasks as normal functions
Not sure if this is a common case, but i would like to bundle a set of tasks with a library, and to have
them available to consumers of that library (maybe in the form of bb run <lib-name> <task-name>) i haven’t
seen anything about that in docs/open issues, so maybe i’m coming from the wrong direction?
borkdude:clj-kondo: 13:26
@mknoszlig right now there are these options:
write your tasks as normal functions and make a normal library
use that library in tasks and hook up task names to the library functions
or: use the --config (+ optionally --deps-root ) flags to refer to a different bb.edn
(edited)
@mikeananev
mikeananev / example.clj
Created January 17, 2022 11:01
function arguments destructuring
(defn abc [& {a :function/a s :sequence d :d :or {d 5}}]
[a s d])
(abc {:function/a 2 :sequence 3 :d 4})
@mikeananev
mikeananev / webclient.clj
Created January 8, 2022 21:50
Example of Java HTTP Client using Clojure
(ns org.rssys.lib01
(:import (java.net.http HttpClient HttpClient$Version HttpClient$Redirect
HttpResponse$BodyHandlers HttpRequest)
(java.time Duration)
(java.net URI)))
(defn http-get [^String url]
(let [client (-> (HttpClient/newBuilder)
(.version HttpClient$Version/HTTP_1_1)
(.followRedirects HttpClient$Redirect/NORMAL)
@mikeananev
mikeananev / main.js
Last active October 26, 2021 04:56
New HTML/CSS project
import './index.css'
import moment from 'moment'
console.log("Hello from JavaScript!");
console.log(moment().startOf('day').fromNow());
@mikeananev
mikeananev / a.clj
Created October 22, 2021 04:16
Clojure macro to build map from symbols.
(defmacro ->map
"(->map a b) ;;=> {:a a :b b}"
[& symbols]
(assert (every? symbol? symbols))
`(hash-map
~@(interleave (map keyword symbols) symbols)))
@mikeananev
mikeananev / antsgame.clj
Last active October 21, 2021 07:55
Example of FSM (finite state machine) usage in Clojure
(ns antsgame
(:gen-class))
(defn new-ant
"Create new ant"
[name]
{:name name
:distance 0
:state :born