Skip to content

Instantly share code, notes, and snippets.

Edmund Jackson ejackson

Block or report user

Report or block ejackson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:1380546
~/scratch/clojurescript$ ./script/bootstrap
Fetching Clojure...
Copying clojure-1.3.0/clojure-1.3.0.jar to lib/clojure.jar...
Cleaning up Clojure directory...
Cleaning up Clojure archive...
Fetching Google Closure library...
Cleaning up Google Closure library archive...
Fetching Google Closure compiler...
Cleaning up Google Closure compiler archive...
Building lib/goog.jar...
View gist:1319377
(defn- ipred [[k v]]
(pred/like k v))
(defn- partial-pred [m]
"Turn a map into a predicate format understood by cql. IE {:a 1 :b 2} --> (pred/and* (pred/=* :a 1) (pred/=* :b 2))"
(apply pred/and* (map ipred m)))
(defprotocol MapFindable
"A protocol for clojureQL searchable things that can be found using a map interface"
(find [this search-map]))
View gist:1293529
(ns relation.test.relation
(:require [relation.relation :as rel]
[relation.database :as db]
[clojureql.core :as cql])
(:use [clojure.test]))
(defmacro my-macro
`~(reverse x))
View gist:1264459
ejackson / database.clj
Created Aug 28, 2011
Basic Clojure interaction with SQL
View database.clj
(ns bookkeeper.database
(:require [ :as sql]
[clj-time.format :as f]))
(def db {:classname "com.mysql.jdbc.Driver"
:subprotocol "mysql"
:subname "//database-server:3306/database"
:user "user"
:password "password"})
View gist:1127677
(require 'package)
(add-to-list 'package-archives
'("marmalade" . ""))
View gist:1127627
(eval-after-load 'clojure-mode
(require 'paredit)
(defun clojure-paredit-hook () (paredit-mode +1))
(add-hook 'clojure-mode-hook 'clojure-paredit-hook)
(define-key clojure-mode-map "{" 'paredit-open-brace)
(define-key clojure-mode-map "}" 'paredit-close-brace)))
ejackson / gist:962673
Created May 9, 2011
View gist:962673
(defproject com.evocomputing/rincanter
:description "Clojure/R integration using rosuda JRIEngine"
:dependencies [[org.clojure/clojure "1.2.0"]
[org.clojure/clojure-contrib "1.2.0"]
[incanter "1.2.3"]]
:native-dependencies [[jriengine "0.8.4"]]
View nothing.html
This is a brief post about how laziness can be used to construct a step-wise quicksort, or somebody gets excited about laziness.
Laziness is not something I'd come across before Clojure, and I've been repeatedly bitten by forgetting about it. So it was a real pleasure the other day to see the laziness revealed in some code, and for once not have this as the result of protracted debugging. I was so taken aback that I'm sharing the experience.
<h2>The Algo</h2>
We all know the <a href="">algorithm</a>, and <a href="">here's</a> a pretty Clojure implementation:
<pre class="brush:Clojure">
(defn qsort [[pivot & tail]]
ejackson / gist:911386
Created Apr 9, 2011
binding over map function
View gist:911386
(declare *connection*)
(defn it-works []
(binding [*connection* "hello, world"]
(prn *connection*)))
(defn it-works-now []
(binding [*connection* "hello, world"]
(bound-fn [_] (prn *connection*))
You can’t perform that action at this time.