Skip to content

Instantly share code, notes, and snippets.

View littleli's full-sized avatar

Aleš Najmann littleli

View GitHub Profile
@borkdude
borkdude / delete.clj
Last active October 1, 2020 12:31
Delete file tree recursively using Java NIO
#!/usr/bin/env bb
;; requires bb 0.2.2 or higher
(require '[clojure.java.io :as io])
(defn delete-recursively [f]
(let [dir (io/file f)]
(if (.exists dir)
(do (java.nio.file.Files/walkFileTree
.ONESHELL:
test: .SHELLFLAGS := -i
test: SHELL := bb
test:
(println :wow)
(require '[clojure.string :as s])
(s/reverse (slurp "./Makefile"))
@cldwalker
cldwalker / spike-day-02-03-20.md
Last active June 19, 2024 04:24
GraalVM dive in Clojure at work

Spike

I looked into the state of GraalVM and Clojure and wrote some small work-related scripts.

GraalVM Build Tools

@yogthos
yogthos / clojure-beginner.md
Last active April 18, 2025 02:43
Clojure beginner resources

Introductory resources

final case class ZIO[-R, +E, +A](run: R => Either[E, A]) {
final def map[B](f: A => B): ZIO[R, E, B] =
ZIO(r => run(r).map(f))
final def flatMap[R1 <: R, E1 >: E, B](f: A => ZIO[R1, E1, B]): ZIO[R1, E1, B] =
ZIO(r => run(r).flatMap(a => f(a).run(r)))
final def provide(r: R): ZIO[Any, E, A] =
ZIO(_ => run(r))
@ikitommi
ikitommi / malli.scicloj.clj
Last active October 29, 2019 04:09
malli-sciclj
;; clj -Sdeps '{:deps {metosin/malli {:git/url "https://github.com/metosin/malli"
;; :sha "68b9940fcf4671a3fcff7bb4844f7f06b2277a34"}}}'
;
; ███▄ ▄███▓ ▄▄▄ ██▓ ██▓ ██▓
; ▓██▒▀█▀ ██▒▒████▄ ▓██▒ ▓██▒ ▓██▒
; ▓██ ▓██░▒██ ▀█▄ ▒██░ ▒██░ ▒██▒
; ▒██ ▒██ ░██▄▄▄▄██ ▒██░ ▒██░ ░██░
; ▒██▒ ░██▒ ▓█ ▓██▒░██████▒░██████▒░██░
; ░ ▒░ ░ ░ ▒▒ ▓▒█░░ ▒░▓ ░░ ▒░▓ ░░▓
@katox
katox / smt.clj
Created September 28, 2019 18:34
From elegance to speed (Clojure version)
;;
;; http://johnj.com/from-elegance-to-speed.html
;;
;; The Clojure version
;; -------------------
(ns smt
(:require [net.cgrand.xforms :as x]
[criterium.core :as c :refer [quick-bench]]))
@pjstadig
pjstadig / transducers.md
Last active June 8, 2021 13:22
The secret feature of transducers that no one talks about!

The Pledge

One thing that always made me a little sad about transducers was how map lost its ability to iterate multiple collections in parallel. This is actually my favorite feature of map. For example:

(map + (range 5) (range 5 10))
=> (5 7 9 11 13)

One somewhat practical use of this is if you want to compare two sequences, pairwise, using a comparator. Though I wish that every? took multiple collections, this is an adequate substitute:

@jdh30
jdh30 / JsonParser.fs
Last active February 28, 2025 18:00
Simple JSON parser written in F# using active patterns
type Json =
| Null
| Bool of bool
| Number of float
| String of string
| Array of Json list
| Object of (string * Json) list
type Bracket = Open | Close
@bhb
bhb / README.md
Last active May 15, 2023 01:28
Clojure friendly mode, inspired by https://github.com/slipset/friendly