Skip to content

Instantly share code, notes, and snippets.

View RickMoynihan's full-sized avatar

Rick Moynihan RickMoynihan

  • Swirrl
  • Manchester
View GitHub Profile
(defmacro with-open* [bindings & body]
(let [[sym exp & others] bindings]
(if sym
`(let [~sym ~exp
result# (try
(with-open* [~@others] ~@body)
(catch Throwable t#
(try
(. ~sym close)
(catch Throwable t2#
@borkdude
borkdude / gen-deps.clj
Last active September 14, 2021 08:06
Gen deps.edns in mono-repo using babashka script. Merge default dep versions.
#!/usr/bin/env bb
(ns update-deps
(:require [clojure.edn :as edn]
[clojure.java.io :as io]
[clojure.pprint :as pp :refer [pprint]]
[clojure.walk :as walk]))
(defn- merge-defaults [deps defaults]
(let [ff (some-fn deps (complement (partial contains? deps)))
@sashton
sashton / explore_datafy_nav.clj
Last active January 18, 2023 17:50
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.

State of Clojure Survey 2018 - Open comment question

This is a selection of the most articulated critique found in the open comments section Q25 at the bottom of the survey. Recurring themes are:

  1. Elitism, ivory tower, "not smart enough to get it" attitude of frequent speaker or early adopters.
  2. Poor basic documentation, error messages, beginner friendly resources.
  3. Fear of contribution (with reasons like a. community-built tools open to attack and replacement by core team b. hostile contribution environment c. closed development process)
  • The community has to grow to create more opportunities. Many organizations don't want to even consider using it because they fear not being able to find Clojure developers. Unless you have a mentor or are extremely motivated, Clojure scares away most imperative developers. My suggestions is to team up with a university and get a Clojure course on Coursera or a similar platform. This is the only way I got in
@niclasnilsson
niclasnilsson / config
Last active June 17, 2021 13:30
Example ~/.ssh/config for dealing with JSch and public key authentication with encrypted (password protected) keys.
# Example ~/.ssh/config for dealing with JSch problems regarding
# ssh public key authentication with encrypted (password protected) keys.
#
# First, a problem description and a couple of solutions that worked for me,
# (in March 2018 on MacOS High Sierra) and in the bottom youäll find an example
# config that doesn't interfere with JSch's use of the ssh-agent.
#
#
# Problem description:
# --------------------
@stuarthalloway
stuarthalloway / missing_keys_specs.clj
Created October 14, 2017 11:44
I think it would be a mistake to introduce temporal coupling to prevent typos.
;; I think it would be a mistake to introduce temporal coupling to prevent typos.
;; The example program below lets you identify "missing" keys specs at
;; the time and place of your choosing, and then handle them as you
;; deem appropriate, without imposing those decisions on other
;; users of spec.
(require '[clojure.spec.alpha :as s]
'[clojure.set :as set])
@jasongilman
jasongilman / atom_clojure_setup.md
Last active January 11, 2024 09:13
This describes how I setup Atom for Clojure Development.

Atom Clojure Setup

This describes how I setup Atom for an ideal Clojure development workflow. This fixes indentation on newlines, handles parentheses, etc. The keybinding settings for enter (in keymap.cson) are important to get proper newlines with indentation at the right level. There are other helpers in init.coffee and keymap.cson that are useful for cutting, copying, pasting, deleting, and indenting Lisp expressions.

Install Atom

Download Atom

The Atom documentation is excellent. It's highly worth reading the flight manual.

(declare numbero*)
(defn symbolo* [x]
(reify
IConstraintStep
(-step [this s]
(reify
clojure.lang.IFn
(invoke [_ s]
(let [x (walk s x)]