Starting from:
lein new foo
cd foo
Say I have a random JAR file that is not available in any repository:
touch README.md
/* Demonstration of dead-code elimination in the JVM. | |
* | |
* This class demonstrates some of the difficulties of benchmarking | |
* code which may be subject to dead-code elimination by the JVM. | |
* There are two loops, both calling the same function. But only the | |
* second loop actually uses the result of the function. | |
* | |
* When I run this code, I get results like this: | |
* | |
* Dead code: |
;; Example showing that I cannot convey data from an exception within | |
;; a transaction. | |
(ns example | |
(:require [datomic.api :as d])) ; Datomic Free 0.8.4007 | |
(def uri "datomic:mem:example") | |
(d/create-database uri) |
;;; data.json 0.1.x compatibility shim | |
;; Loading this file alongside data.json version 0.2.0 adds | |
;; definitions which make it compatible with the public API of | |
;; data.json version 0.1.3. | |
;; Copyright (c) Stuart Sierra, 2012. All rights reserved. The use and | |
;; distribution terms for this software are covered by the Eclipse | |
;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) |
;; Some example error messages resulting from common mistakes | |
;; using Datomic 0.8.4138 | |
(ns errors | |
(:use [datomic.api :as d :only (db q)])) | |
(def uri "datomic:mem://database") | |
(d/create-database uri) |
(defproject foo "1.0.0-SNAPSHOT" | |
:description "FIXME: write description" | |
:dependencies [[org.clojure/clojure "1.3.0"] | |
[org.clojure/clojurescript "0.0-927"]]) |
(ns test-clj-byte-chunk-seq | |
(:import (java.io InputStream OutputStream | |
FileInputStream FileOutputStream))) | |
(set! *warn-on-reflection* true) | |
(def ^:const ONE_MEG (* 1024 1024)) | |
(deftype ByteArrayChunk [^bytes array ^int offset ^int end] | |
clojure.lang.IChunk |
;; Add this to ~/.emacs | |
;; Missing from ruby-mode.el, see https://groups.google.com/group/emacs-on-rails/msg/565fba8263233c28 | |
(defun ruby-insert-end () | |
"Insert \"end\" at point and reindent current line." | |
(interactive) | |
(insert "end") | |
(ruby-indent-line t) | |
(end-of-line)) |
;;; XML parsing and clojure.zip | |
;;; There's got to be a cleaner way to do this. | |
;;; I have code like this: | |
(defn jdks-loc [xml-zipper] | |
(zip/down | |
(first | |
(filter #(let [n (zip/node %)] |
;; Adapted from "An empirical comparison of C, C++, Java, Perl, | |
;; Python, Rexx, and Tcl for a search/string-processing program" | |
;; by Lutz Prechelt | |
;; This was a 15-minute effort while listening to a talk. It's *not* | |
;; well thought-out or designed. | |
;; By Stuart Sierra, | |
;; @stuartsierra on Twitter |