Skip to content

Instantly share code, notes, and snippets.

@joinr
joinr / system-example.clj
Created March 27, 2019 21:41
an example of a core.async process manager thing
(ns system-example
(:require [spork.async.system :as sys]
[clojure.core.async :as async :refer [chan]]))
(def ins (chan (async/dropping-buffer 1)))
(def outs (chan (async/dropping-buffer 1)))
(sys/go-push :clock ins (let [res (async/<! (async/timeout 1000))]
(System/currentTimeMillis)))
@chrispsn
chrispsn / kOS.md
Last active August 26, 2025 13:42
A summary of everything we know about kOS.
@ericnormand
ericnormand / 00_script.clj
Last active April 23, 2025 16:46
Boilerplate for running Clojure as a shebang script
#!/bin/sh
#_(
#_DEPS is same format as deps.edn. Multiline is okay.
DEPS='
{:deps {clj-time {:mvn/version "0.14.2"}}}
'
#_You can put other options here
OPTS='
@mikeananev
mikeananev / deps.edn
Created February 24, 2019 22:28
Clojure compress / decompress data examples
{:deps {org.clojure/clojure {:mvn/version "1.10.0"}
com.taoensso/nippy {:mvn/version "2.14.0"}
org.apache.commons/commons-compress {:mvn/version "1.18"}}}
@mikeananev
mikeananev / deps.edn
Created February 17, 2019 22:28
ED25519 Clojure Example
{:deps {org.clojure/clojure {:mvn/version "1.10.0"}
org.bouncycastle/bcprov-jdk15on {:mvn/version "1.61"}}}
(ns deployer
(:require [clojure.tools.deps.alpha :as deps]
[clojure.tools.deps.alpha.reader :as reader]
[clojure.java.io :as io]
[clojure.string :as string])
(:import (java.security MessageDigest)
(com.jcraft.jsch JSch)
(java.net URI)))
(def hex-alphabet (vec "0123456789ABCDEF"))
@micha
micha / core.clj
Last active January 2, 2019 17:04
(ns hoplonfx.core
(:require
[hoplonfx.ui :refer [run]]
[hoplonfx.util :refer :all])
(:import
[hoplonfx ApplicationShim]
[javafx.application Application]))
(defonce stage
(delay
@luismts
luismts / GitCommitBestPractices.md
Last active March 27, 2026 00:49
Git Tips and Git Commit Best Practices

Git Commit Best Practices

Basic Rules

Commit Related Changes

A commit should be a wrapper for related changes. For example, fixing two different bugs should produce two separate commits. Small commits make it easier for other developers to understand the changes and roll them back if something went wrong. With tools like the staging area and the ability to stage only parts of a file, Git makes it easy to create very granular commits.

Commit Often

Committing often keeps your commits small and, again, helps you commit only related changes. Moreover, it allows you to share your code more frequently with others. That way it‘s easier for everyone to integrate changes regularly and avoid having merge conflicts. Having large commits and sharing them infrequently, in contrast, makes it hard to solve conflicts.

@sashton
sashton / explore_datafy_nav.clj
Last active October 25, 2024 01:51
Clojure datafy/nav exploration
(ns explore-datafy-nav
"Sample code demonstrating naving around a random graph of data.
The graph very likely will have circular references, which is not a problem.
To see the results, execute the entire file.
Each step in the nav process will be printed out, as well as the initial db.
Subsequent executions will generate a new random db."
(:require [clojure.datafy :refer [datafy nav]]))
(defn generate-db
"Generate a random database of users and departments.
@Azel4231
Azel4231 / core.clj
Last active September 16, 2022 13:31
Using multimethod hierarchies with spec
(ns applesoranges.core
(:require [clojure.spec.alpha :as s]))
;; define the properties
(s/def ::fruit-attribute-spec (s/keys :req [::diameter ::color]))
(s/def ::diameter nat-int?)
(s/def ::color #{:green :orange})
;; define the "type"-hierarchy
;; seemed like a good idea to use a separate spec for the hierarchy (in order to keep things simple)