Skip to content

Instantly share code, notes, and snippets.

View MichaelDrogalis's full-sized avatar

Michael Drogalis MichaelDrogalis

  • Confluent
  • Seattle, WA
View GitHub Profile

How Clojure's documentation can leapfrog other languages

Summary

I made a documentation generator that cashes in on Clojure's dynamism. See the play-cljs docs (a ClojureScript game library) for an example of its output.

The Problem

Like many of you, I've often wondered what my final regret will be on my deathbed. My best guess came to me in a dream recently. I was walking across the charred earth of an apocalyptic future world, maneuvering around the remains of the less fortunate. I was startled to find a young girl, barely holding onto her life. She murmured something to me. I asked her to repeat it, and she said more loudly: "I...wish your Clojure projects didn't have such crappy documentation."

@stuarthalloway
stuarthalloway / Nil Finder
Created January 15, 2015 20:51
Finding those nested nils
(ns user)
(def app
"Intenal Helper"
(fnil conj []))
(defprotocol PathSeq
(path-seq* [form path] "Helper for path-seq"))
(extend-protocol PathSeq
@aphyr
aphyr / gist:52ca0aec41abe8921313
Created August 20, 2014 22:17
Macros to make it easier to write serializers for Fressian.
(ns audience.analysis.hadoop.serialization
(:require [clojure.data.fressian :as fress]
[clojure.walk :as walk]
[parkour.wrapper :as wrapper])
(:import (audience.analysis.hadoop FressianWritable)
(java.io DataInput
DataOutput
ByteArrayInputStream
ByteArrayOutputStream)
(java.nio ByteBuffer)
(require '[clojure.core.async :as a])
(def xform (comp (map inc)
(filter even?)
(dedupe)
(flatmap range)
(partition-all 3)
(partition-by #(< (apply + %) 7))
(flatmap flatten)
(random-sample 1.0)
@bitemyapp
bitemyapp / gist:8739525
Last active May 7, 2021 23:22
Learning Haskell
@bodil
bodil / webbit.clj
Created September 26, 2013 17:21
Basic Webbit adapter for Ring.
(ns ring.adapter.webbit
(:require [clojure.string :as s]
[clojure.java.io :as io])
(:import [org.webbitserver WebServer WebServers HttpHandler]
[java.io File InputStream]))
(defn- transform-headers [headers]
(apply hash-map (mapcat (fn [e] [(s/lower-case (.getKey e))
(.getValue e)]) headers)))
(def c (chan))
(defn drain [c]
(go
(loop [col []]
(if-let [v (<! c)]
(recur (conj col v))
col))))
@willurd
willurd / web-servers.md
Last active May 8, 2024 18:19
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@whoahbot
whoahbot / clojure-west.org
Last active October 13, 2016 07:41
Clojure west notes

Clojure West

Domain driven design with Clojure

  • Organizing larger applications
  • Domain logic shouldn’t include handlers for bad/unclean data.
    • validateur, bouncer, clj-schema for checking data going into the pipeline.
    • domain-specific, semantic checks
    • TODO: Any better ways for doing this conditional validation.
    • Need to factor out common data cleaning utils into shared library.