Skip to content

Instantly share code, notes, and snippets.

(ns example.errors)
(defn clean-address [params]
"Ensure (params :address) is present"
(if (empty? (params :address))
[nil "Please enter your address"]
[params nil]))
(defn clean-email [params]
"Ensure (params :email) matches *@*.*"
#!/bin/bash
# * * * * * root /path/to/riak_graphite_stats.sh
set -e
SOURCE=$(hostname)
GRAPHITE_PORT=2003
GRAPHITE_SERVER="server"
PREFIX="riak_stats"
STATUS=$(/usr/sbin/riak-admin status)
;; (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]

BEAM

assemble

$ erlc -S test.erl
(ns storm.starter.clj.word-count-kafka
(:import ;[backtype.storm StormSubmitter LocalCluster]
[storm.kafka KafkaConfig HostPort KafkaSpout SpoutConfig StringScheme])
(:use [backtype.storm clojure config])
(:gen-class))
(def ^{:private true}
host (list "localhost:9092"))
(def ^{:private true
(use '[datomic.api :only [q db] :as d])
(def uri "datomic:mem://accounts")
;; create database
(d/create-database uri)
;; connect to database
(def conn (d/connect uri))
(ns reagent-test.core
(:require [reagent.core :as reagent :refer [atom]]
[datascript :as d]
[cljs-uuid-utils :as uuid]))
(enable-console-print!)
(defn bind
([conn q]
(bind conn q (atom nil)))
(ns reagent-test.core
(:require [reagent.core :as reagent :refer [atom]]
[datascript :as d]
[cljs-uuid-utils :as uuid]))
(enable-console-print!)
(defn bind
([conn q]
(bind conn q (atom nil)))
(ns reagent-test.core
(:require [reagent.core :as reagent :refer [atom]]
[datascript :as d]
[cljs-uuid-utils :as uuid]))
(enable-console-print!)
(defn bind
([conn q]
(bind conn q (atom nil)))