Skip to content

Instantly share code, notes, and snippets.

View darkleaf's full-sized avatar

Mikhail Kuzmin darkleaf

View GitHub Profile
(ns pool
(:import
(org.apache.commons.pool2 ObjectPool BasePooledObjectFactory PooledObjectFactory)
(org.apache.commons.pool2.impl DefaultPooledObject GenericObjectPool GenericObjectPoolConfig)))
(set! *warn-on-reflection* true)
;; таймаут? W
;; как останавливать? W
;; как плавно расти?
(ns experiments.str
(:import
(java.lang.reflect Field)
(java.io PushbackReader Reader)
(clojure.lang LispReader IFn)))
(set! *warn-on-reflection* true)
(def ^IFn/1 dispatchMacros
(let [field (.getDeclaredField LispReader "dispatchMacros")]
(ns example.core
(:require
[darkleaf.di.core :as di])
(:import
(io.helidon.http Method)
(io.helidon.http.sse SseEvent)
(io.helidon.webserver WebServer WebServerConfig$Builder)
(io.helidon.webserver.http
HttpRouting$Builder Handler
ServerRequest ServerResponse)
(ns experiments.exceptions)
(comment
(require '[criterium.core :as c])
(c/quick-bench
(Object.))
;; Execution time mean : 5,429811 ns
(c/quick-bench
(eval-after-load 'clojure-mode
'(setq clojure--prettify-symbols-alist
'(("\\\"" . ))))
(use-package clojure-mode
:init
(add-hook 'clojure-mode-hook #'prettify-symbols-mode))
package gmonit;
import com.newrelic.api.agent.NewRelic;
import com.newrelic.api.agent.Trace;
import clojure.lang.IFn;
import clojure.lang.ISeq;
public final class TracedFn implements IFn {
IFn fn;
@darkleaf
darkleaf / plan
Last active October 13, 2021 07:41
projectile
magit
parinfer
cider
числа
строки
кейворды
символы
@darkleaf
darkleaf / madbrains
Last active September 7, 2024 12:29
Вводная про монады, монадическое значение, монадическая функция, композер
примеры монад - Promice, Optional, Completable Future, async/await
Do notation
Вводная про континуации, через исключения.
Вводная про генераторы, без стека, со стеком, показать стейт-машину
project loom
Next, return, throw
Цветные функции.
@darkleaf
darkleaf / batch.js
Last active September 4, 2021 17:11
function* getFullPost(id) {
const post = yield ['getPost', id]
const [author, comments] = yield* all([
getFullUser(post.authorId),
all(post.commentIds.map(id => getFullComment(id))),
])
return {
...post,
author,
comments,
@darkleaf
darkleaf / merge-with-key.clj
Created January 9, 2021 07:13 — forked from mlimotte/merge-with-key.clj
Clojure merge-with-key
(ns mlimotte.util)
; A variation on clojure.core/merge-with
(defn merge-with-key
"Returns a map that consists of the rest of the maps conj-ed onto
the first. If a key occurs in more than one map, the mapping(s)
from the latter (left-to-right) will be combined with the mapping in
the result by calling (f key val-in-result val-in-latter)."
[f & maps]