Skip to content

Instantly share code, notes, and snippets.

@favila
favila / entity-pull.clj
Created February 8, 2017 18:19
entity-pull: a datomic.api/pull that returns values the way datomic.api/entity would, with sets and ident keywords
(require '[datomic.api :as d])
(defn entity-pull
"Like pull, but returns values consistent with d/entity, i.e.,
entities with :db/ident are represented as keywords and sets are
used instead of vectors."
[db pat eid]
(->> (d/pull db pat eid)
(clojure.walk/prewalk
(fn [x]
@staltz
staltz / introrx.md
Last active May 10, 2024 12:08
The introduction to Reactive Programming you've been missing
@phips
phips / ansible.cfg
Last active February 13, 2018 09:31
Ansible for Vagrant
[defaults]
remote_user = vagrant
hostfile = .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory
private_key_file = ~/.vagrant.d/insecure_private_key
(ns hammock-cafe.ui.history
(:require [io.pedestal.app.protocols :as p]
[io.pedestal.app.util.log :as log]
[io.pedestal.app.messages :as msg]))
(def last-page (atom nil))
(def dispatchers (atom {}))
(defn navigate [token]
@ndarville
ndarville / business-models.md
Last active January 13, 2024 17:27
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@ptaoussanis
ptaoussanis / free-port.clj
Created December 14, 2012 06:28
A little utility to allow simple redeployment of Clojure web servers with zero downtime, and without the need for a proxy or load balancer. Just wrap any port-binding calls, and the utility will auto kill pre-existing servers as necessary. *nix only. Based on the blog post by Feng Shen, http://shenfeng.me/fast-restart-clojure-webapp.html
;; (require '[clojure.string :as str] '[clojure.java.shell :as shell] '[taoensso.timbre :as timbre])
(defn with-free-port!
"Attempts to kill any current port-binding process, then repeatedly executes
nullary `bind-port!-fn` (which must return logical true on successful
binding). Returns the function's result when successful, else throws an
exception. *nix only.
This idea courtesy of Feng Shen, Ref. http://goo.gl/kEolu."
[port bind-port!-fn & {:keys [max-attempts sleep-ms]