This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add these to your .bash_profile / .zshrc / etc. | |
# Starts a Clojure repl | |
function rebel-clj() { | |
clojure -Sdeps "{:deps {com.bhauman/rebel-readline {:mvn/version \"0.1.4\"} $@}}" -m rebel-readline.main | |
} | |
# Starts a browser REPL | |
function rebel-cljs() { | |
clojure -Sdeps "{:deps {com.bhauman/figwheel-main {:mvn/version \"0.1.7\"} com.bhauman/rebel-readline-cljs {:mvn/version \"0.1.4\"} $@}}" -m figwheel.main |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro defspec-test | |
([name sym-or-syms] `(defspec-test ~name ~sym-or-syms nil)) | |
([name sym-or-syms opts] | |
(when t/*load-tests* | |
`(def ~(vary-meta name assoc :test `(fn [] | |
(let [check-results# (clojure.spec.test/check ~sym-or-syms ~opts) | |
checks-passed?# (every? nil? (map :failure check-results#))] | |
(if checks-passed?# | |
(t/do-report {:type :pass | |
:message (str "Generative tests pass for " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns foo.test-helper | |
(:require [clojure.spec :as s] | |
[clojure.spec.test :as st] | |
[clojure.string :as str] | |
[clojure.test :refer :all] | |
[clojure.test.check.generators :as gen] | |
[clojure.test.check.random :refer [IRandom]] | |
[clojure.test.check.rose-tree :as rose])) | |
(defn instrument-all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns channel-of.core | |
(:require [clojure.spec :as s] | |
[clojure.core.async :as a] | |
[clojure.core.async.impl.protocols :as ap])) | |
(defmacro chan-of [spec & chan-args] | |
`(let [ch# (a/chan ~@chan-args)] | |
(reify | |
ap/ReadPort | |
(take! [_ fn1-handler#] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro dbg [body] | |
`(let [x# ~body] | |
(println "dbg:" '~body "=" x#) | |
x#)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
# file: ~/bin/c | |
# | |
# usage: highlight lines and pipe them to stdout in your editor. nothing | |
# changes except they are copied to your paste buffer. should be modified to | |
# work with linux using xclip | |
$VERBOSE=nil | |
STDOUT.sync = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bundle exec ruby ext_finder.rb | |
require 'rubygems' | |
Gem::Specification.each do |spec| | |
ext = spec.extensions | |
puts "#{spec.name} (#{spec.version}) has extensions: #{ext}" unless ext.empty? | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for f in $(egrep -o -R "defn?-? [^ ]*" * --include '*.clj' | cut -d \ -f 2 | sort | uniq); do | |
echo $f $(grep -R --include '*.clj' -- "$f" * | wc -l); | |
done | grep " 1$" |