Skip to content

Instantly share code, notes, and snippets.

@kolber
kolber / pandoras_vox.mdown
Created March 20, 2012 05:23
pandora’s vox: on community in cyberspace

pandora’s vox: on community in cyberspace

by humdog (1994)

when i went into cyberspace i went into it thinking that it was a place like any other place and that it would be a human interaction like any other human interaction. i was wrong when i thought that. it was a terrible mistake.

the very first understanding that i had that it was not a place like any place and that the interaction would be different was when people began to talk to me as though i were a man. when they wrote about me in the third person, they would say “he.” it interested me to have people think i was “he” instead of “she” and so at first i did not say anything. i grinned and let them think i was “he.” this went on for a little while and it was fun but after a while i was uncomfortable. finally i said unto them that i, humdog, was a woman and not a man. this surprised them. at that moment i realized that the dissolution of gender-category was something that was happening everywhere, and perhaps it was only just very obvious on the ne

@scttnlsn
scttnlsn / debounce.cljs
Created March 24, 2014 17:03
core.async debounce
(defn debounce [in ms]
(let [out (chan)]
(go-loop [last-val nil]
(let [val (if (nil? last-val) (<! in) last-val)
timer (timeout ms)
[new-val ch] (alts! [in timer])]
(condp = ch
timer (do (>! out val) (recur nil))
in (recur new-val))))
out))
@reborg
reborg / rich-already-answered-that.md
Last active May 8, 2024 14:20
A curated collection of answers that Rich gave throughout the history of Clojure

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.

How to use:

  • The link in the table of content jumps at the copy of the answer on this page.
  • The link on the answer itself points back at the original post.

Table of Content

;; The deps.edn file describes the information needed to build a classpath.
;;
;; When using the `clojure` or `clj` script, there are several deps.edn files
;; that are combined:
;; - install-level
;; - user level (this file)
;; - project level (current directory when invoked)
;;
;; For all attributes other than :paths, these config files are merged left to right.
;; Only the last :paths is kept and others are dropped.
@cgrand
cgrand / gist:564d6e8ad57299f64beb438e4a8b709f
Created July 11, 2020 20:26 — forked from KingCode/gist:773560f4ab5bf91e660a2a26e581b036
cond-let and cond-let| macros, to leverage bindings between test and result expressions, as well as earlier ones (for cond-let)
;; (cond-let
;; (odd? x) [x n] (inc x)
;; (< n 10) [y (inc n)] 10
;; :else n))
;; we want the above to yield
;; (let [x n]
;; (if (odd? x)
;; (inc x)
(defn stateful-map
"Returns a stateful transducer similar to `clojure.core/map-indexed` that
transforms each item with `(f state <the item>)` where `state` is built by
applying `state-building-fn` to the previous state (starting with `init`) and
the transformed item.
Ex., re-implementing map-indexed:
```clojure
(sequence (stateful-map vector (fn build-state [idx _] (if idx (inc idx) 5))) \"abc\")
; => ([nil \\a] [5 \\b] [6 \\c])
@wcalderipe
wcalderipe / README.md
Last active November 27, 2022 15:15
A gist about what are the solution faces of controlling flow in side-effectful function pipelines.

Control flow in Clojure

A gist containing a problem example and different implementations based on what is being discussed at How are clojurians handling control flow on their projects?.

Feel free to leave a comment and feedback is welcome 😃

Examples in this Gist

  • Bult-in exceptions in a thread macro
  • didibus' trylet macro
@didibus
didibus / complex_business_process_example.clj
Last active October 12, 2023 11:16
Example of a complex business process to implement in Clojure. Please link to your solutions for alternative ways to implement the same in Clojure (or other languages).
(ns complex-business-process-example
"A stupid example of a more complex business process to implement as a flowchart.")
;;;; Config
(def config
"When set to :test will trigger the not-boosted branch which won't write to db.
When set to :prod will trigger the boosted branch which will try to write to the db."
{:env :prod})
@leonoel
leonoel / complex_business_process_example_missionary.clj
Last active October 12, 2023 11:16
An alternative solution to didibus' business process using missionary.
(ns complex-business-process-example-missionary
"A stupid example of a more complex business process to implement as a flowchart."
(:require [missionary.core :as m])
(:import missionary.Cancelled))
;;;; Config
(def config
"When set to :test will trigger the not-boosted branch which won't write to db.
When set to :prod will trigger the boosted branch which will try to write to the db."